s390: enable CPU alternatives unconditionally
authorHeiko Carstens <heiko.carstens@de.ibm.com>
Tue, 14 Nov 2017 14:20:24 +0000 (15:20 +0100)
committerHeiko Carstens <heiko.carstens@de.ibm.com>
Tue, 14 Nov 2017 21:08:12 +0000 (22:08 +0100)
Remove the CPU_ALTERNATIVES config option and enable the code
unconditionally. The config option was only added to avoid a conflict
with the named saved segment support. Since that code is gone there is
no reason to keep the CPU_ALTERNATIVES config option.

Just enable it unconditionally to also reduce the number of config
options and make it less likely that something breaks.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
arch/s390/Kconfig
arch/s390/include/asm/alternative.h
arch/s390/kernel/Makefile
arch/s390/kernel/module.c

index f5beccbe74d88bf8dafc76b90d822c73c0ca1cf9..84767046daff90be9b9641491fce0c4fbd47cfa0 100644 (file)
@@ -539,22 +539,6 @@ config ARCH_RANDOM
 
          If unsure, say Y.
 
-config ALTERNATIVES
-       def_bool y
-       prompt "Patch optimized instructions for running CPU type"
-       help
-         When enabled the kernel code is compiled with additional
-         alternative instructions blocks optimized for newer CPU types.
-         These alternative instructions blocks are patched at kernel boot
-         time when running CPU supports them. This mechanism is used to
-         optimize some critical code paths (i.e. spinlocks) for newer CPUs
-         even if kernel is build to support older machine generations.
-
-         This mechanism could be disabled by appending "noaltinstr"
-         option to the kernel command line.
-
-         If unsure, say Y.
-
 endmenu
 
 menu "Memory setup"
index 6c268f6a51d318003ebe42e00cf512508ba937a6..a72002056b54848103fc626338fee956c145bfc9 100644 (file)
@@ -15,14 +15,9 @@ struct alt_instr {
        u8  replacementlen;     /* length of new instruction */
 } __packed;
 
-#ifdef CONFIG_ALTERNATIVES
-extern void apply_alternative_instructions(void);
-extern void apply_alternatives(struct alt_instr *start, struct alt_instr *end);
-#else
-static inline void apply_alternative_instructions(void) {};
-static inline void apply_alternatives(struct alt_instr *start,
-                                     struct alt_instr *end) {};
-#endif
+void apply_alternative_instructions(void);
+void apply_alternatives(struct alt_instr *start, struct alt_instr *end);
+
 /*
  * |661:       |662:     |6620      |663:
  * +-----------+---------------------+
@@ -109,7 +104,6 @@ static inline void apply_alternatives(struct alt_instr *start,
        b_altinstr(num)":\n\t" altinstr "\n" e_altinstr(num) ":\n"      \
        INSTR_LEN_SANITY_CHECK(altinstr_len(num))
 
-#ifdef CONFIG_ALTERNATIVES
 /* alternative assembly primitive: */
 #define ALTERNATIVE(oldinstr, altinstr, facility) \
        ".pushsection .altinstr_replacement, \"ax\"\n"                  \
@@ -130,14 +124,6 @@ static inline void apply_alternatives(struct alt_instr *start,
        ALTINSTR_ENTRY(facility1, 1)                                    \
        ALTINSTR_ENTRY(facility2, 2)                                    \
        ".popsection\n"
-#else
-/* Alternative instructions are disabled, let's put just oldinstr in */
-#define ALTERNATIVE(oldinstr, altinstr, facility) \
-       oldinstr "\n"
-
-#define ALTERNATIVE_2(oldinstr, altinstr1, facility1, altinstr2, facility2) \
-       oldinstr "\n"
-#endif
 
 /*
  * Alternative instructions for different CPU types or capabilities.
index 83bc82001c06ff1c7bd3dee875a6a6901adce115..0319f4e81ea4f9fc0cf95a1a9cfd2e1098b0477e 100644 (file)
@@ -59,7 +59,7 @@ obj-y += processor.o sys_s390.o ptrace.o signal.o cpcmd.o ebcdic.o nmi.o
 obj-y  += debug.o irq.o ipl.o dis.o diag.o vdso.o als.o
 obj-y  += sysinfo.o jump_label.o lgr.o os_info.o machine_kexec.o pgm_check.o
 obj-y  += runtime_instr.o cache.o fpu.o dumpstack.o guarded_storage.o sthyi.o
-obj-y  += entry.o reipl.o relocate_kernel.o kdebugfs.o
+obj-y  += entry.o reipl.o relocate_kernel.o kdebugfs.o alternative.o
 
 extra-y                                += head.o head64.o vmlinux.lds
 
@@ -77,7 +77,6 @@ obj-$(CONFIG_KPROBES)         += kprobes.o
 obj-$(CONFIG_FUNCTION_TRACER)  += mcount.o ftrace.o
 obj-$(CONFIG_CRASH_DUMP)       += crash_dump.o
 obj-$(CONFIG_UPROBES)          += uprobes.o
-obj-$(CONFIG_ALTERNATIVES)     += alternative.o
 
 obj-$(CONFIG_PERF_EVENTS)      += perf_event.o perf_cpum_cf.o perf_cpum_sf.o
 obj-$(CONFIG_PERF_EVENTS)      += perf_cpum_cf_events.o
index 6d9f73bb4142ab1b95a9dfd2dadc61853175961c..7b87991416fd6d882e7edf3f52b6f4af6fc45ad3 100644 (file)
@@ -433,16 +433,13 @@ int module_finalize(const Elf_Ehdr *hdr,
        const Elf_Shdr *s;
        char *secstrings;
 
-       if (IS_ENABLED(CONFIG_ALTERNATIVES)) {
-               secstrings = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset;
-               for (s = sechdrs; s < sechdrs + hdr->e_shnum; s++) {
-                       if (!strcmp(".altinstructions",
-                                   secstrings + s->sh_name)) {
-                               /* patch .altinstructions */
-                               void *aseg = (void *)s->sh_addr;
+       secstrings = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset;
+       for (s = sechdrs; s < sechdrs + hdr->e_shnum; s++) {
+               if (!strcmp(".altinstructions", secstrings + s->sh_name)) {
+                       /* patch .altinstructions */
+                       void *aseg = (void *)s->sh_addr;
 
-                               apply_alternatives(aseg, aseg + s->sh_size);
-                       }
+                       apply_alternatives(aseg, aseg + s->sh_size);
                }
        }