diff options
author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2018-12-30 10:14:15 -0500 |
---|---|---|
committer | Masahiro Yamada <yamada.masahiro@socionext.com> | 2019-01-05 19:46:51 -0500 |
commit | e9666d10a5677a494260d60d1fa0b73cc7646eb3 (patch) | |
tree | fd609e683efff32ed6cc1458e20c40969328a33e | |
parent | 72d3ebb929de339f991fc49b58942d2d5ecdb753 (diff) |
jump_label: move 'asm goto' support test to Kconfig
Currently, CONFIG_JUMP_LABEL just means "I _want_ to use jump label".
The jump label is controlled by HAVE_JUMP_LABEL, which is defined
like this:
#if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_JUMP_LABEL)
# define HAVE_JUMP_LABEL
#endif
We can improve this by testing 'asm goto' support in Kconfig, then
make JUMP_LABEL depend on CC_HAS_ASM_GOTO.
Ugly #ifdef HAVE_JUMP_LABEL will go away, and CONFIG_JUMP_LABEL will
match to the real kernel capability.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
42 files changed, 65 insertions, 119 deletions
@@ -514,13 +514,6 @@ RETPOLINE_VDSO_CFLAGS := $(call cc-option,$(RETPOLINE_VDSO_CFLAGS_GCC),$(call cc | |||
514 | export RETPOLINE_CFLAGS | 514 | export RETPOLINE_CFLAGS |
515 | export RETPOLINE_VDSO_CFLAGS | 515 | export RETPOLINE_VDSO_CFLAGS |
516 | 516 | ||
517 | # check for 'asm goto' | ||
518 | ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC) $(KBUILD_CFLAGS)), y) | ||
519 | CC_HAVE_ASM_GOTO := 1 | ||
520 | KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO | ||
521 | KBUILD_AFLAGS += -DCC_HAVE_ASM_GOTO | ||
522 | endif | ||
523 | |||
524 | # The expansion should be delayed until arch/$(SRCARCH)/Makefile is included. | 517 | # The expansion should be delayed until arch/$(SRCARCH)/Makefile is included. |
525 | # Some architectures define CROSS_COMPILE in arch/$(SRCARCH)/Makefile. | 518 | # Some architectures define CROSS_COMPILE in arch/$(SRCARCH)/Makefile. |
526 | # CC_VERSION_TEXT is referenced from Kconfig (so it needs export), | 519 | # CC_VERSION_TEXT is referenced from Kconfig (so it needs export), |
diff --git a/arch/Kconfig b/arch/Kconfig index b70c952ac838..4cfb6de48f79 100644 --- a/arch/Kconfig +++ b/arch/Kconfig | |||
@@ -71,6 +71,7 @@ config KPROBES | |||
71 | config JUMP_LABEL | 71 | config JUMP_LABEL |
72 | bool "Optimize very unlikely/likely branches" | 72 | bool "Optimize very unlikely/likely branches" |
73 | depends on HAVE_ARCH_JUMP_LABEL | 73 | depends on HAVE_ARCH_JUMP_LABEL |
74 | depends on CC_HAS_ASM_GOTO | ||
74 | help | 75 | help |
75 | This option enables a transparent branch optimization that | 76 | This option enables a transparent branch optimization that |
76 | makes certain almost-always-true or almost-always-false branch | 77 | makes certain almost-always-true or almost-always-false branch |
diff --git a/arch/arm/kernel/jump_label.c b/arch/arm/kernel/jump_label.c index 90bce3d9928e..303b3ab87f7e 100644 --- a/arch/arm/kernel/jump_label.c +++ b/arch/arm/kernel/jump_label.c | |||
@@ -4,8 +4,6 @@ | |||
4 | #include <asm/patch.h> | 4 | #include <asm/patch.h> |
5 | #include <asm/insn.h> | 5 | #include <asm/insn.h> |
6 | 6 | ||
7 | #ifdef HAVE_JUMP_LABEL | ||
8 | |||
9 | static void __arch_jump_label_transform(struct jump_entry *entry, | 7 | static void __arch_jump_label_transform(struct jump_entry *entry, |
10 | enum jump_label_type type, | 8 | enum jump_label_type type, |
11 | bool is_static) | 9 | bool is_static) |
@@ -35,5 +33,3 @@ void arch_jump_label_transform_static(struct jump_entry *entry, | |||
35 | { | 33 | { |
36 | __arch_jump_label_transform(entry, type, true); | 34 | __arch_jump_label_transform(entry, type, true); |
37 | } | 35 | } |
38 | |||
39 | #endif | ||
diff --git a/arch/arm64/kernel/jump_label.c b/arch/arm64/kernel/jump_label.c index 646b9562ee64..1eff270e8861 100644 --- a/arch/arm64/kernel/jump_label.c +++ b/arch/arm64/kernel/jump_label.c | |||
@@ -20,8 +20,6 @@ | |||
20 | #include <linux/jump_label.h> | 20 | #include <linux/jump_label.h> |
21 | #include <asm/insn.h> | 21 | #include <asm/insn.h> |
22 | 22 | ||
23 | #ifdef HAVE_JUMP_LABEL | ||
24 | |||
25 | void arch_jump_label_transform(struct jump_entry *entry, | 23 | void arch_jump_label_transform(struct jump_entry *entry, |
26 | enum jump_label_type type) | 24 | enum jump_label_type type) |
27 | { | 25 | { |
@@ -49,5 +47,3 @@ void arch_jump_label_transform_static(struct jump_entry *entry, | |||
49 | * NOP needs to be replaced by a branch. | 47 | * NOP needs to be replaced by a branch. |
50 | */ | 48 | */ |
51 | } | 49 | } |
52 | |||
53 | #endif /* HAVE_JUMP_LABEL */ | ||
diff --git a/arch/mips/kernel/jump_label.c b/arch/mips/kernel/jump_label.c index 32e3168316cd..ab943927f97a 100644 --- a/arch/mips/kernel/jump_label.c +++ b/arch/mips/kernel/jump_label.c | |||
@@ -16,8 +16,6 @@ | |||
16 | #include <asm/cacheflush.h> | 16 | #include <asm/cacheflush.h> |
17 | #include <asm/inst.h> | 17 | #include <asm/inst.h> |
18 | 18 | ||
19 | #ifdef HAVE_JUMP_LABEL | ||
20 | |||
21 | /* | 19 | /* |
22 | * Define parameters for the standard MIPS and the microMIPS jump | 20 | * Define parameters for the standard MIPS and the microMIPS jump |
23 | * instruction encoding respectively: | 21 | * instruction encoding respectively: |
@@ -70,5 +68,3 @@ void arch_jump_label_transform(struct jump_entry *e, | |||
70 | 68 | ||
71 | mutex_unlock(&text_mutex); | 69 | mutex_unlock(&text_mutex); |
72 | } | 70 | } |
73 | |||
74 | #endif /* HAVE_JUMP_LABEL */ | ||
diff --git a/arch/powerpc/include/asm/asm-prototypes.h b/arch/powerpc/include/asm/asm-prototypes.h index 6f201b199c02..1d911f68a23b 100644 --- a/arch/powerpc/include/asm/asm-prototypes.h +++ b/arch/powerpc/include/asm/asm-prototypes.h | |||
@@ -38,7 +38,7 @@ extern struct static_key hcall_tracepoint_key; | |||
38 | void __trace_hcall_entry(unsigned long opcode, unsigned long *args); | 38 | void __trace_hcall_entry(unsigned long opcode, unsigned long *args); |
39 | void __trace_hcall_exit(long opcode, long retval, unsigned long *retbuf); | 39 | void __trace_hcall_exit(long opcode, long retval, unsigned long *retbuf); |
40 | /* OPAL tracing */ | 40 | /* OPAL tracing */ |
41 | #ifdef HAVE_JUMP_LABEL | 41 | #ifdef CONFIG_JUMP_LABEL |
42 | extern struct static_key opal_tracepoint_key; | 42 | extern struct static_key opal_tracepoint_key; |
43 | #endif | 43 | #endif |
44 | 44 | ||
diff --git a/arch/powerpc/kernel/jump_label.c b/arch/powerpc/kernel/jump_label.c index 6472472093d0..0080c5fbd225 100644 --- a/arch/powerpc/kernel/jump_label.c +++ b/arch/powerpc/kernel/jump_label.c | |||
@@ -11,7 +11,6 @@ | |||
11 | #include <linux/jump_label.h> | 11 | #include <linux/jump_label.h> |
12 | #include <asm/code-patching.h> | 12 | #include <asm/code-patching.h> |
13 | 13 | ||
14 | #ifdef HAVE_JUMP_LABEL | ||
15 | void arch_jump_label_transform(struct jump_entry *entry, | 14 | void arch_jump_label_transform(struct jump_entry *entry, |
16 | enum jump_label_type type) | 15 | enum jump_label_type type) |
17 | { | 16 | { |
@@ -22,4 +21,3 @@ void arch_jump_label_transform(struct jump_entry *entry, | |||
22 | else | 21 | else |
23 | patch_instruction(addr, PPC_INST_NOP); | 22 | patch_instruction(addr, PPC_INST_NOP); |
24 | } | 23 | } |
25 | #endif | ||
diff --git a/arch/powerpc/platforms/powernv/opal-tracepoints.c b/arch/powerpc/platforms/powernv/opal-tracepoints.c index 1ab7d26c0a2c..f16a43540e30 100644 --- a/arch/powerpc/platforms/powernv/opal-tracepoints.c +++ b/arch/powerpc/platforms/powernv/opal-tracepoints.c | |||
@@ -4,7 +4,7 @@ | |||
4 | #include <asm/trace.h> | 4 | #include <asm/trace.h> |
5 | #include <asm/asm-prototypes.h> | 5 | #include <asm/asm-prototypes.h> |
6 | 6 | ||
7 | #ifdef HAVE_JUMP_LABEL | 7 | #ifdef CONFIG_JUMP_LABEL |
8 | struct static_key opal_tracepoint_key = STATIC_KEY_INIT; | 8 | struct static_key opal_tracepoint_key = STATIC_KEY_INIT; |
9 | 9 | ||
10 | int opal_tracepoint_regfunc(void) | 10 | int opal_tracepoint_regfunc(void) |
diff --git a/arch/powerpc/platforms/powernv/opal-wrappers.S b/arch/powerpc/platforms/powernv/opal-wrappers.S index 251528231a9e..f4875fe3f8ff 100644 --- a/arch/powerpc/platforms/powernv/opal-wrappers.S +++ b/arch/powerpc/platforms/powernv/opal-wrappers.S | |||
@@ -20,7 +20,7 @@ | |||
20 | .section ".text" | 20 | .section ".text" |
21 | 21 | ||
22 | #ifdef CONFIG_TRACEPOINTS | 22 | #ifdef CONFIG_TRACEPOINTS |
23 | #ifdef HAVE_JUMP_LABEL | 23 | #ifdef CONFIG_JUMP_LABEL |
24 | #define OPAL_BRANCH(LABEL) \ | 24 | #define OPAL_BRANCH(LABEL) \ |
25 | ARCH_STATIC_BRANCH(LABEL, opal_tracepoint_key) | 25 | ARCH_STATIC_BRANCH(LABEL, opal_tracepoint_key) |
26 | #else | 26 | #else |
diff --git a/arch/powerpc/platforms/pseries/hvCall.S b/arch/powerpc/platforms/pseries/hvCall.S index d91412c591ef..50dc9426d0be 100644 --- a/arch/powerpc/platforms/pseries/hvCall.S +++ b/arch/powerpc/platforms/pseries/hvCall.S | |||
@@ -19,7 +19,7 @@ | |||
19 | 19 | ||
20 | #ifdef CONFIG_TRACEPOINTS | 20 | #ifdef CONFIG_TRACEPOINTS |
21 | 21 | ||
22 | #ifndef HAVE_JUMP_LABEL | 22 | #ifndef CONFIG_JUMP_LABEL |
23 | .section ".toc","aw" | 23 | .section ".toc","aw" |
24 | 24 | ||
25 | .globl hcall_tracepoint_refcount | 25 | .globl hcall_tracepoint_refcount |
@@ -79,7 +79,7 @@ hcall_tracepoint_refcount: | |||
79 | mr r5,BUFREG; \ | 79 | mr r5,BUFREG; \ |
80 | __HCALL_INST_POSTCALL | 80 | __HCALL_INST_POSTCALL |
81 | 81 | ||
82 | #ifdef HAVE_JUMP_LABEL | 82 | #ifdef CONFIG_JUMP_LABEL |
83 | #define HCALL_BRANCH(LABEL) \ | 83 | #define HCALL_BRANCH(LABEL) \ |
84 | ARCH_STATIC_BRANCH(LABEL, hcall_tracepoint_key) | 84 | ARCH_STATIC_BRANCH(LABEL, hcall_tracepoint_key) |
85 | #else | 85 | #else |
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c index 32d4452973e7..f2a9f0adc2d3 100644 --- a/arch/powerpc/platforms/pseries/lpar.c +++ b/arch/powerpc/platforms/pseries/lpar.c | |||
@@ -1040,7 +1040,7 @@ EXPORT_SYMBOL(arch_free_page); | |||
1040 | #endif /* CONFIG_PPC_BOOK3S_64 */ | 1040 | #endif /* CONFIG_PPC_BOOK3S_64 */ |
1041 | 1041 | ||
1042 | #ifdef CONFIG_TRACEPOINTS | 1042 | #ifdef CONFIG_TRACEPOINTS |
1043 | #ifdef HAVE_JUMP_LABEL | 1043 | #ifdef CONFIG_JUMP_LABEL |
1044 | struct static_key hcall_tracepoint_key = STATIC_KEY_INIT; | 1044 | struct static_key hcall_tracepoint_key = STATIC_KEY_INIT; |
1045 | 1045 | ||
1046 | int hcall_tracepoint_regfunc(void) | 1046 | int hcall_tracepoint_regfunc(void) |
diff --git a/arch/s390/kernel/Makefile b/arch/s390/kernel/Makefile index 386b1abb217b..e216e116a9a9 100644 --- a/arch/s390/kernel/Makefile +++ b/arch/s390/kernel/Makefile | |||
@@ -48,7 +48,7 @@ CFLAGS_ptrace.o += -DUTS_MACHINE='"$(UTS_MACHINE)"' | |||
48 | obj-y := traps.o time.o process.o base.o early.o setup.o idle.o vtime.o | 48 | obj-y := traps.o time.o process.o base.o early.o setup.o idle.o vtime.o |
49 | obj-y += processor.o sys_s390.o ptrace.o signal.o cpcmd.o ebcdic.o nmi.o | 49 | obj-y += processor.o sys_s390.o ptrace.o signal.o cpcmd.o ebcdic.o nmi.o |
50 | obj-y += debug.o irq.o ipl.o dis.o diag.o vdso.o early_nobss.o | 50 | obj-y += debug.o irq.o ipl.o dis.o diag.o vdso.o early_nobss.o |
51 | obj-y += sysinfo.o jump_label.o lgr.o os_info.o machine_kexec.o pgm_check.o | 51 | obj-y += sysinfo.o lgr.o os_info.o machine_kexec.o pgm_check.o |
52 | obj-y += runtime_instr.o cache.o fpu.o dumpstack.o guarded_storage.o sthyi.o | 52 | obj-y += runtime_instr.o cache.o fpu.o dumpstack.o guarded_storage.o sthyi.o |
53 | obj-y += entry.o reipl.o relocate_kernel.o kdebugfs.o alternative.o | 53 | obj-y += entry.o reipl.o relocate_kernel.o kdebugfs.o alternative.o |
54 | obj-y += nospec-branch.o ipl_vmparm.o | 54 | obj-y += nospec-branch.o ipl_vmparm.o |
@@ -72,6 +72,7 @@ obj-$(CONFIG_KPROBES) += kprobes.o | |||
72 | obj-$(CONFIG_FUNCTION_TRACER) += mcount.o ftrace.o | 72 | obj-$(CONFIG_FUNCTION_TRACER) += mcount.o ftrace.o |
73 | obj-$(CONFIG_CRASH_DUMP) += crash_dump.o | 73 | obj-$(CONFIG_CRASH_DUMP) += crash_dump.o |
74 | obj-$(CONFIG_UPROBES) += uprobes.o | 74 | obj-$(CONFIG_UPROBES) += uprobes.o |
75 | obj-$(CONFIG_JUMP_LABEL) += jump_label.o | ||
75 | 76 | ||
76 | obj-$(CONFIG_KEXEC_FILE) += machine_kexec_file.o kexec_image.o | 77 | obj-$(CONFIG_KEXEC_FILE) += machine_kexec_file.o kexec_image.o |
77 | obj-$(CONFIG_KEXEC_FILE) += kexec_elf.o | 78 | obj-$(CONFIG_KEXEC_FILE) += kexec_elf.o |
diff --git a/arch/s390/kernel/jump_label.c b/arch/s390/kernel/jump_label.c index 50a1798604a8..3f10b56bd5a3 100644 --- a/arch/s390/kernel/jump_label.c +++ b/arch/s390/kernel/jump_label.c | |||
@@ -10,8 +10,6 @@ | |||
10 | #include <linux/jump_label.h> | 10 | #include <linux/jump_label.h> |
11 | #include <asm/ipl.h> | 11 | #include <asm/ipl.h> |
12 | 12 | ||
13 | #ifdef HAVE_JUMP_LABEL | ||
14 | |||
15 | struct insn { | 13 | struct insn { |
16 | u16 opcode; | 14 | u16 opcode; |
17 | s32 offset; | 15 | s32 offset; |
@@ -103,5 +101,3 @@ void arch_jump_label_transform_static(struct jump_entry *entry, | |||
103 | { | 101 | { |
104 | __jump_label_transform(entry, type, 1); | 102 | __jump_label_transform(entry, type, 1); |
105 | } | 103 | } |
106 | |||
107 | #endif | ||
diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile index cf8640841b7a..97c0e19263d1 100644 --- a/arch/sparc/kernel/Makefile +++ b/arch/sparc/kernel/Makefile | |||
@@ -118,4 +118,4 @@ pc--$(CONFIG_PERF_EVENTS) := perf_event.o | |||
118 | obj-$(CONFIG_SPARC64) += $(pc--y) | 118 | obj-$(CONFIG_SPARC64) += $(pc--y) |
119 | 119 | ||
120 | obj-$(CONFIG_UPROBES) += uprobes.o | 120 | obj-$(CONFIG_UPROBES) += uprobes.o |
121 | obj-$(CONFIG_SPARC64) += jump_label.o | 121 | obj-$(CONFIG_JUMP_LABEL) += jump_label.o |
diff --git a/arch/sparc/kernel/jump_label.c b/arch/sparc/kernel/jump_label.c index 7f8eac51df33..a4cfaeecaf5e 100644 --- a/arch/sparc/kernel/jump_label.c +++ b/arch/sparc/kernel/jump_label.c | |||
@@ -9,8 +9,6 @@ | |||
9 | 9 | ||
10 | #include <asm/cacheflush.h> | 10 | #include <asm/cacheflush.h> |
11 | 11 | ||
12 | #ifdef HAVE_JUMP_LABEL | ||
13 | |||
14 | void arch_jump_label_transform(struct jump_entry *entry, | 12 | void arch_jump_label_transform(struct jump_entry *entry, |
15 | enum jump_label_type type) | 13 | enum jump_label_type type) |
16 | { | 14 | { |
@@ -47,5 +45,3 @@ void arch_jump_label_transform(struct jump_entry *entry, | |||
47 | flushi(insn); | 45 | flushi(insn); |
48 | mutex_unlock(&text_mutex); | 46 | mutex_unlock(&text_mutex); |
49 | } | 47 | } |
50 | |||
51 | #endif | ||
diff --git a/arch/x86/Makefile b/arch/x86/Makefile index 16c3145c0a5f..9c5a67d1b9c1 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile | |||
@@ -289,7 +289,7 @@ vdso_install: | |||
289 | 289 | ||
290 | archprepare: checkbin | 290 | archprepare: checkbin |
291 | checkbin: | 291 | checkbin: |
292 | ifndef CC_HAVE_ASM_GOTO | 292 | ifndef CONFIG_CC_HAS_ASM_GOTO |
293 | @echo Compiler lacks asm-goto support. | 293 | @echo Compiler lacks asm-goto support. |
294 | @exit 1 | 294 | @exit 1 |
295 | endif | 295 | endif |
diff --git a/arch/x86/entry/calling.h b/arch/x86/entry/calling.h index 20d0885b00fb..efb0d1b1f15f 100644 --- a/arch/x86/entry/calling.h +++ b/arch/x86/entry/calling.h | |||
@@ -351,7 +351,7 @@ For 32-bit we have the following conventions - kernel is built with | |||
351 | */ | 351 | */ |
352 | .macro CALL_enter_from_user_mode | 352 | .macro CALL_enter_from_user_mode |
353 | #ifdef CONFIG_CONTEXT_TRACKING | 353 | #ifdef CONFIG_CONTEXT_TRACKING |
354 | #ifdef HAVE_JUMP_LABEL | 354 | #ifdef CONFIG_JUMP_LABEL |
355 | STATIC_JUMP_IF_FALSE .Lafter_call_\@, context_tracking_enabled, def=0 | 355 | STATIC_JUMP_IF_FALSE .Lafter_call_\@, context_tracking_enabled, def=0 |
356 | #endif | 356 | #endif |
357 | call enter_from_user_mode | 357 | call enter_from_user_mode |
diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h index aced6c9290d6..ce95b8cbd229 100644 --- a/arch/x86/include/asm/cpufeature.h +++ b/arch/x86/include/asm/cpufeature.h | |||
@@ -140,7 +140,7 @@ extern void clear_cpu_cap(struct cpuinfo_x86 *c, unsigned int bit); | |||
140 | 140 | ||
141 | #define setup_force_cpu_bug(bit) setup_force_cpu_cap(bit) | 141 | #define setup_force_cpu_bug(bit) setup_force_cpu_cap(bit) |
142 | 142 | ||
143 | #if defined(__clang__) && !defined(CC_HAVE_ASM_GOTO) | 143 | #if defined(__clang__) && !defined(CONFIG_CC_HAS_ASM_GOTO) |
144 | 144 | ||
145 | /* | 145 | /* |
146 | * Workaround for the sake of BPF compilation which utilizes kernel | 146 | * Workaround for the sake of BPF compilation which utilizes kernel |
diff --git a/arch/x86/include/asm/jump_label.h b/arch/x86/include/asm/jump_label.h index 21efc9d07ed9..65191ce8e1cf 100644 --- a/arch/x86/include/asm/jump_label.h +++ b/arch/x86/include/asm/jump_label.h | |||
@@ -2,19 +2,6 @@ | |||
2 | #ifndef _ASM_X86_JUMP_LABEL_H | 2 | #ifndef _ASM_X86_JUMP_LABEL_H |
3 | #define _ASM_X86_JUMP_LABEL_H | 3 | #define _ASM_X86_JUMP_LABEL_H |
4 | 4 | ||
5 | #ifndef HAVE_JUMP_LABEL | ||
6 | /* | ||
7 | * For better or for worse, if jump labels (the gcc extension) are missing, | ||
8 | * then the entire static branch patching infrastructure is compiled out. | ||
9 | * If that happens, the code in here will malfunction. Raise a compiler | ||
10 | * error instead. | ||
11 | * | ||
12 | * In theory, jump labels and the static branch patching infrastructure | ||
13 | * could be decoupled to fix this. | ||
14 | */ | ||
15 | #error asm/jump_label.h included on a non-jump-label kernel | ||
16 | #endif | ||
17 | |||
18 | #define JUMP_LABEL_NOP_SIZE 5 | 5 | #define JUMP_LABEL_NOP_SIZE 5 |
19 | 6 | ||
20 | #ifdef CONFIG_X86_64 | 7 | #ifdef CONFIG_X86_64 |
diff --git a/arch/x86/include/asm/rmwcc.h b/arch/x86/include/asm/rmwcc.h index 46ac84b506f5..8a9eba191516 100644 --- a/arch/x86/include/asm/rmwcc.h +++ b/arch/x86/include/asm/rmwcc.h | |||
@@ -11,7 +11,7 @@ | |||
11 | 11 | ||
12 | #define __CLOBBERS_MEM(clb...) "memory", ## clb | 12 | #define __CLOBBERS_MEM(clb...) "memory", ## clb |
13 | 13 | ||
14 | #if !defined(__GCC_ASM_FLAG_OUTPUTS__) && defined(CC_HAVE_ASM_GOTO) | 14 | #if !defined(__GCC_ASM_FLAG_OUTPUTS__) && defined(CONFIG_CC_HAS_ASM_GOTO) |
15 | 15 | ||
16 | /* Use asm goto */ | 16 | /* Use asm goto */ |
17 | 17 | ||
@@ -27,7 +27,7 @@ cc_label: c = true; \ | |||
27 | c; \ | 27 | c; \ |
28 | }) | 28 | }) |
29 | 29 | ||
30 | #else /* defined(__GCC_ASM_FLAG_OUTPUTS__) || !defined(CC_HAVE_ASM_GOTO) */ | 30 | #else /* defined(__GCC_ASM_FLAG_OUTPUTS__) || !defined(CONFIG_CC_HAS_ASM_GOTO) */ |
31 | 31 | ||
32 | /* Use flags output or a set instruction */ | 32 | /* Use flags output or a set instruction */ |
33 | 33 | ||
@@ -40,7 +40,7 @@ cc_label: c = true; \ | |||
40 | c; \ | 40 | c; \ |
41 | }) | 41 | }) |
42 | 42 | ||
43 | #endif /* defined(__GCC_ASM_FLAG_OUTPUTS__) || !defined(CC_HAVE_ASM_GOTO) */ | 43 | #endif /* defined(__GCC_ASM_FLAG_OUTPUTS__) || !defined(CONFIG_CC_HAS_ASM_GOTO) */ |
44 | 44 | ||
45 | #define GEN_UNARY_RMWcc_4(op, var, cc, arg0) \ | 45 | #define GEN_UNARY_RMWcc_4(op, var, cc, arg0) \ |
46 | __GEN_RMWcc(op " " arg0, var, cc, __CLOBBERS_MEM()) | 46 | __GEN_RMWcc(op " " arg0, var, cc, __CLOBBERS_MEM()) |
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile index eb51b0e1189c..00b7e27bc2b7 100644 --- a/arch/x86/kernel/Makefile +++ b/arch/x86/kernel/Makefile | |||
@@ -49,7 +49,8 @@ obj-$(CONFIG_COMPAT) += signal_compat.o | |||
49 | obj-y += traps.o idt.o irq.o irq_$(BITS).o dumpstack_$(BITS).o | 49 | obj-y += traps.o idt.o irq.o irq_$(BITS).o dumpstack_$(BITS).o |
50 | obj-y += time.o ioport.o dumpstack.o nmi.o | 50 | obj-y += time.o ioport.o dumpstack.o nmi.o |
51 | obj-$(CONFIG_MODIFY_LDT_SYSCALL) += ldt.o | 51 | obj-$(CONFIG_MODIFY_LDT_SYSCALL) += ldt.o |
52 | obj-y += setup.o x86_init.o i8259.o irqinit.o jump_label.o | 52 | obj-y += setup.o x86_init.o i8259.o irqinit.o |
53 | obj-$(CONFIG_JUMP_LABEL) += jump_label.o | ||
53 | obj-$(CONFIG_IRQ_WORK) += irq_work.o | 54 | obj-$(CONFIG_IRQ_WORK) += irq_work.o |
54 | obj-y += probe_roms.o | 55 | obj-y += probe_roms.o |
55 | obj-$(CONFIG_X86_64) += sys_x86_64.o | 56 | obj-$(CONFIG_X86_64) += sys_x86_64.o |
diff --git a/arch/x86/kernel/jump_label.c b/arch/x86/kernel/jump_label.c index aac0c1f7e354..f99bd26bd3f1 100644 --- a/arch/x86/kernel/jump_label.c +++ b/arch/x86/kernel/jump_label.c | |||
@@ -16,8 +16,6 @@ | |||
16 | #include <asm/alternative.h> | 16 | #include <asm/alternative.h> |
17 | #include <asm/text-patching.h> | 17 | #include <asm/text-patching.h> |
18 | 18 | ||
19 | #ifdef HAVE_JUMP_LABEL | ||
20 | |||
21 | union jump_code_union { | 19 | union jump_code_union { |
22 | char code[JUMP_LABEL_NOP_SIZE]; | 20 | char code[JUMP_LABEL_NOP_SIZE]; |
23 | struct { | 21 | struct { |
@@ -130,5 +128,3 @@ __init_or_module void arch_jump_label_transform_static(struct jump_entry *entry, | |||
130 | if (jlstate == JL_STATE_UPDATE) | 128 | if (jlstate == JL_STATE_UPDATE) |
131 | __jump_label_transform(entry, type, text_poke_early, 1); | 129 | __jump_label_transform(entry, type, text_poke_early, 1); |
132 | } | 130 | } |
133 | |||
134 | #endif | ||
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 78e430f4e15c..c338984c850d 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c | |||
@@ -456,7 +456,7 @@ FOP_END; | |||
456 | 456 | ||
457 | /* | 457 | /* |
458 | * XXX: inoutclob user must know where the argument is being expanded. | 458 | * XXX: inoutclob user must know where the argument is being expanded. |
459 | * Relying on CC_HAVE_ASM_GOTO would allow us to remove _fault. | 459 | * Relying on CONFIG_CC_HAS_ASM_GOTO would allow us to remove _fault. |
460 | */ | 460 | */ |
461 | #define asm_safe(insn, inoutclob...) \ | 461 | #define asm_safe(insn, inoutclob...) \ |
462 | ({ \ | 462 | ({ \ |
diff --git a/arch/xtensa/kernel/jump_label.c b/arch/xtensa/kernel/jump_label.c index d108f721c116..61cf6497a646 100644 --- a/arch/xtensa/kernel/jump_label.c +++ b/arch/xtensa/kernel/jump_label.c | |||
@@ -10,8 +10,6 @@ | |||
10 | 10 | ||
11 | #include <asm/cacheflush.h> | 11 | #include <asm/cacheflush.h> |
12 | 12 | ||
13 | #ifdef HAVE_JUMP_LABEL | ||
14 | |||
15 | #define J_OFFSET_MASK 0x0003ffff | 13 | #define J_OFFSET_MASK 0x0003ffff |
16 | #define J_SIGN_MASK (~(J_OFFSET_MASK >> 1)) | 14 | #define J_SIGN_MASK (~(J_OFFSET_MASK >> 1)) |
17 | 15 | ||
@@ -95,5 +93,3 @@ void arch_jump_label_transform(struct jump_entry *e, | |||
95 | 93 | ||
96 | patch_text(jump_entry_code(e), &insn, JUMP_LABEL_NOP_SIZE); | 94 | patch_text(jump_entry_code(e), &insn, JUMP_LABEL_NOP_SIZE); |
97 | } | 95 | } |
98 | |||
99 | #endif /* HAVE_JUMP_LABEL */ | ||
diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 2fd8006153c3..b3419da1a776 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h | |||
@@ -2,7 +2,7 @@ | |||
2 | #ifndef _DYNAMIC_DEBUG_H | 2 | #ifndef _DYNAMIC_DEBUG_H |
3 | #define _DYNAMIC_DEBUG_H | 3 | #define _DYNAMIC_DEBUG_H |
4 | 4 | ||
5 | #if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_JUMP_LABEL) | 5 | #if defined(CONFIG_JUMP_LABEL) |
6 | #include <linux/jump_label.h> | 6 | #include <linux/jump_label.h> |
7 | #endif | 7 | #endif |
8 | 8 | ||
@@ -38,7 +38,7 @@ struct _ddebug { | |||
38 | #define _DPRINTK_FLAGS_DEFAULT 0 | 38 | #define _DPRINTK_FLAGS_DEFAULT 0 |
39 | #endif | 39 | #endif |
40 | unsigned int flags:8; | 40 | unsigned int flags:8; |
41 | #ifdef HAVE_JUMP_LABEL | 41 | #ifdef CONFIG_JUMP_LABEL |
42 | union { | 42 | union { |
43 | struct static_key_true dd_key_true; | 43 | struct static_key_true dd_key_true; |
44 | struct static_key_false dd_key_false; | 44 | struct static_key_false dd_key_false; |
@@ -83,7 +83,7 @@ void __dynamic_netdev_dbg(struct _ddebug *descriptor, | |||
83 | dd_key_init(key, init) \ | 83 | dd_key_init(key, init) \ |
84 | } | 84 | } |
85 | 85 | ||
86 | #ifdef HAVE_JUMP_LABEL | 86 | #ifdef CONFIG_JUMP_LABEL |
87 | 87 | ||
88 | #define dd_key_init(key, init) key = (init) | 88 | #define dd_key_init(key, init) key = (init) |
89 | 89 | ||
diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h index 5df6a621e464..3e113a1fa0f1 100644 --- a/include/linux/jump_label.h +++ b/include/linux/jump_label.h | |||
@@ -71,10 +71,6 @@ | |||
71 | * Additional babbling in: Documentation/static-keys.txt | 71 | * Additional babbling in: Documentation/static-keys.txt |
72 | */ | 72 | */ |
73 | 73 | ||
74 | #if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_JUMP_LABEL) | ||
75 | # define HAVE_JUMP_LABEL | ||
76 | #endif | ||
77 | |||
78 | #ifndef __ASSEMBLY__ | 74 | #ifndef __ASSEMBLY__ |
79 | 75 | ||
80 | #include <linux/types.h> | 76 | #include <linux/types.h> |
@@ -86,7 +82,7 @@ extern bool static_key_initialized; | |||
86 | "%s(): static key '%pS' used before call to jump_label_init()", \ | 82 | "%s(): static key '%pS' used before call to jump_label_init()", \ |
87 | __func__, (key)) | 83 | __func__, (key)) |
88 | 84 | ||
89 | #ifdef HAVE_JUMP_LABEL | 85 | #ifdef CONFIG_JUMP_LABEL |
90 | 86 | ||
91 | struct static_key { | 87 | struct static_key { |
92 | atomic_t enabled; | 88 | atomic_t enabled; |
@@ -114,10 +110,10 @@ struct static_key { | |||
114 | struct static_key { | 110 | struct static_key { |
115 | atomic_t enabled; | 111 | atomic_t enabled; |
116 | }; | 112 | }; |
117 | #endif /* HAVE_JUMP_LABEL */ | 113 | #endif /* CONFIG_JUMP_LABEL */ |
118 | #endif /* __ASSEMBLY__ */ | 114 | #endif /* __ASSEMBLY__ */ |
119 | 115 | ||
120 | #ifdef HAVE_JUMP_LABEL | 116 | #ifdef CONFIG_JUMP_LABEL |
121 | #include <asm/jump_label.h> | 117 | #include <asm/jump_label.h> |
122 | 118 | ||
123 | #ifndef __ASSEMBLY__ | 119 | #ifndef __ASSEMBLY__ |
@@ -192,7 +188,7 @@ enum jump_label_type { | |||
192 | 188 | ||
193 | struct module; | 189 | struct module; |
194 | 190 | ||
195 | #ifdef HAVE_JUMP_LABEL | 191 | #ifdef CONFIG_JUMP_LABEL |
196 | 192 | ||
197 | #define JUMP_TYPE_FALSE 0UL | 193 | #define JUMP_TYPE_FALSE 0UL |
198 | #define JUMP_TYPE_TRUE 1UL | 194 | #define JUMP_TYPE_TRUE 1UL |
@@ -245,7 +241,7 @@ extern void static_key_disable_cpuslocked(struct static_key *key); | |||
245 | { .enabled = { 0 }, \ | 241 | { .enabled = { 0 }, \ |
246 | { .entries = (void *)JUMP_TYPE_FALSE } } | 242 | { .entries = (void *)JUMP_TYPE_FALSE } } |
247 | 243 | ||
248 | #else /* !HAVE_JUMP_LABEL */ | 244 | #else /* !CONFIG_JUMP_LABEL */ |
249 | 245 | ||
250 | #include <linux/atomic.h> | 246 | #include <linux/atomic.h> |
251 | #include <linux/bug.h> | 247 | #include <linux/bug.h> |
@@ -330,7 +326,7 @@ static inline void static_key_disable(struct static_key *key) | |||
330 | #define STATIC_KEY_INIT_TRUE { .enabled = ATOMIC_INIT(1) } | 326 | #define STATIC_KEY_INIT_TRUE { .enabled = ATOMIC_INIT(1) } |
331 | #define STATIC_KEY_INIT_FALSE { .enabled = ATOMIC_INIT(0) } | 327 | #define STATIC_KEY_INIT_FALSE { .enabled = ATOMIC_INIT(0) } |
332 | 328 | ||
333 | #endif /* HAVE_JUMP_LABEL */ | 329 | #endif /* CONFIG_JUMP_LABEL */ |
334 | 330 | ||
335 | #define STATIC_KEY_INIT STATIC_KEY_INIT_FALSE | 331 | #define STATIC_KEY_INIT STATIC_KEY_INIT_FALSE |
336 | #define jump_label_enabled static_key_enabled | 332 | #define jump_label_enabled static_key_enabled |
@@ -394,7 +390,7 @@ extern bool ____wrong_branch_error(void); | |||
394 | static_key_count((struct static_key *)x) > 0; \ | 390 | static_key_count((struct static_key *)x) > 0; \ |
395 | }) | 391 | }) |
396 | 392 | ||
397 | #ifdef HAVE_JUMP_LABEL | 393 | #ifdef CONFIG_JUMP_LABEL |
398 | 394 | ||
399 | /* | 395 | /* |
400 | * Combine the right initial value (type) with the right branch order | 396 | * Combine the right initial value (type) with the right branch order |
@@ -476,12 +472,12 @@ extern bool ____wrong_branch_error(void); | |||
476 | unlikely(branch); \ | 472 | unlikely(branch); \ |
477 | }) | 473 | }) |
478 | 474 | ||
479 | #else /* !HAVE_JUMP_LABEL */ | 475 | #else /* !CONFIG_JUMP_LABEL */ |
480 | 476 | ||
481 | #define static_branch_likely(x) likely(static_key_enabled(&(x)->key)) | 477 | #define static_branch_likely(x) likely(static_key_enabled(&(x)->key)) |
482 | #define static_branch_unlikely(x) unlikely(static_key_enabled(&(x)->key)) | 478 | #define static_branch_unlikely(x) unlikely(static_key_enabled(&(x)->key)) |
483 | 479 | ||
484 | #endif /* HAVE_JUMP_LABEL */ | 480 | #endif /* CONFIG_JUMP_LABEL */ |
485 | 481 | ||
486 | /* | 482 | /* |
487 | * Advanced usage; refcount, branch is enabled when: count != 0 | 483 | * Advanced usage; refcount, branch is enabled when: count != 0 |
diff --git a/include/linux/jump_label_ratelimit.h b/include/linux/jump_label_ratelimit.h index baa8eabbaa56..a49f2b45b3f0 100644 --- a/include/linux/jump_label_ratelimit.h +++ b/include/linux/jump_label_ratelimit.h | |||
@@ -5,21 +5,19 @@ | |||
5 | #include <linux/jump_label.h> | 5 | #include <linux/jump_label.h> |
6 | #include <linux/workqueue.h> | 6 | #include <linux/workqueue.h> |
7 | 7 | ||
8 | #if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_JUMP_LABEL) | 8 | #if defined(CONFIG_JUMP_LABEL) |
9 | struct static_key_deferred { | 9 | struct static_key_deferred { |
10 | struct static_key key; | 10 | struct static_key key; |
11 | unsigned long timeout; | 11 | unsigned long timeout; |
12 | struct delayed_work work; | 12 | struct delayed_work work; |
13 | }; | 13 | }; |
14 | #endif | ||
15 | 14 | ||
16 | #ifdef HAVE_JUMP_LABEL | ||
17 | extern void static_key_slow_dec_deferred(struct static_key_deferred *key); | 15 | extern void static_key_slow_dec_deferred(struct static_key_deferred *key); |
18 | extern void static_key_deferred_flush(struct static_key_deferred *key); | 16 | extern void static_key_deferred_flush(struct static_key_deferred *key); |
19 | extern void | 17 | extern void |
20 | jump_label_rate_limit(struct static_key_deferred *key, unsigned long rl); | 18 | jump_label_rate_limit(struct static_key_deferred *key, unsigned long rl); |
21 | 19 | ||
22 | #else /* !HAVE_JUMP_LABEL */ | 20 | #else /* !CONFIG_JUMP_LABEL */ |
23 | struct static_key_deferred { | 21 | struct static_key_deferred { |
24 | struct static_key key; | 22 | struct static_key key; |
25 | }; | 23 | }; |
@@ -38,5 +36,5 @@ jump_label_rate_limit(struct static_key_deferred *key, | |||
38 | { | 36 | { |
39 | STATIC_KEY_CHECK_USE(key); | 37 | STATIC_KEY_CHECK_USE(key); |
40 | } | 38 | } |
41 | #endif /* HAVE_JUMP_LABEL */ | 39 | #endif /* CONFIG_JUMP_LABEL */ |
42 | #endif /* _LINUX_JUMP_LABEL_RATELIMIT_H */ | 40 | #endif /* _LINUX_JUMP_LABEL_RATELIMIT_H */ |
diff --git a/include/linux/module.h b/include/linux/module.h index d5453eb5a68b..9a21fe3509af 100644 --- a/include/linux/module.h +++ b/include/linux/module.h | |||
@@ -436,7 +436,7 @@ struct module { | |||
436 | unsigned int num_bpf_raw_events; | 436 | unsigned int num_bpf_raw_events; |
437 | struct bpf_raw_event_map *bpf_raw_events; | 437 | struct bpf_raw_event_map *bpf_raw_events; |
438 | #endif | 438 | #endif |
439 | #ifdef HAVE_JUMP_LABEL | 439 | #ifdef CONFIG_JUMP_LABEL |
440 | struct jump_entry *jump_entries; | 440 | struct jump_entry *jump_entries; |
441 | unsigned int num_jump_entries; | 441 | unsigned int num_jump_entries; |
442 | #endif | 442 | #endif |
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h index bbe99d2b28b4..72cb19c3db6a 100644 --- a/include/linux/netfilter.h +++ b/include/linux/netfilter.h | |||
@@ -176,7 +176,7 @@ void nf_unregister_net_hooks(struct net *net, const struct nf_hook_ops *reg, | |||
176 | int nf_register_sockopt(struct nf_sockopt_ops *reg); | 176 | int nf_register_sockopt(struct nf_sockopt_ops *reg); |
177 | void nf_unregister_sockopt(struct nf_sockopt_ops *reg); | 177 | void nf_unregister_sockopt(struct nf_sockopt_ops *reg); |
178 | 178 | ||
179 | #ifdef HAVE_JUMP_LABEL | 179 | #ifdef CONFIG_JUMP_LABEL |
180 | extern struct static_key nf_hooks_needed[NFPROTO_NUMPROTO][NF_MAX_HOOKS]; | 180 | extern struct static_key nf_hooks_needed[NFPROTO_NUMPROTO][NF_MAX_HOOKS]; |
181 | #endif | 181 | #endif |
182 | 182 | ||
@@ -198,7 +198,7 @@ static inline int nf_hook(u_int8_t pf, unsigned int hook, struct net *net, | |||
198 | struct nf_hook_entries *hook_head = NULL; | 198 | struct nf_hook_entries *hook_head = NULL; |
199 | int ret = 1; | 199 | int ret = 1; |
200 | 200 | ||
201 | #ifdef HAVE_JUMP_LABEL | 201 | #ifdef CONFIG_JUMP_LABEL |
202 | if (__builtin_constant_p(pf) && | 202 | if (__builtin_constant_p(pf) && |
203 | __builtin_constant_p(hook) && | 203 | __builtin_constant_p(hook) && |
204 | !static_key_false(&nf_hooks_needed[pf][hook])) | 204 | !static_key_false(&nf_hooks_needed[pf][hook])) |
diff --git a/include/linux/netfilter_ingress.h b/include/linux/netfilter_ingress.h index 554c920691dd..a13774be2eb5 100644 --- a/include/linux/netfilter_ingress.h +++ b/include/linux/netfilter_ingress.h | |||
@@ -8,7 +8,7 @@ | |||
8 | #ifdef CONFIG_NETFILTER_INGRESS | 8 | #ifdef CONFIG_NETFILTER_INGRESS |
9 | static inline bool nf_hook_ingress_active(const struct sk_buff *skb) | 9 | static inline bool nf_hook_ingress_active(const struct sk_buff *skb) |
10 | { | 10 | { |
11 | #ifdef HAVE_JUMP_LABEL | 11 | #ifdef CONFIG_JUMP_LABEL |
12 | if (!static_key_false(&nf_hooks_needed[NFPROTO_NETDEV][NF_NETDEV_INGRESS])) | 12 | if (!static_key_false(&nf_hooks_needed[NFPROTO_NETDEV][NF_NETDEV_INGRESS])) |
13 | return false; | 13 | return false; |
14 | #endif | 14 | #endif |
diff --git a/init/Kconfig b/init/Kconfig index 3e6be1694766..d47cb77a220e 100644 --- a/init/Kconfig +++ b/init/Kconfig | |||
@@ -23,6 +23,9 @@ config CLANG_VERSION | |||
23 | int | 23 | int |
24 | default $(shell,$(srctree)/scripts/clang-version.sh $(CC)) | 24 | default $(shell,$(srctree)/scripts/clang-version.sh $(CC)) |
25 | 25 | ||
26 | config CC_HAS_ASM_GOTO | ||
27 | def_bool $(success,$(srctree)/scripts/gcc-goto.sh $(CC)) | ||
28 | |||
26 | config CONSTRUCTORS | 29 | config CONSTRUCTORS |
27 | bool | 30 | bool |
28 | depends on !UML | 31 | depends on !UML |
diff --git a/kernel/jump_label.c b/kernel/jump_label.c index b28028b08d44..bad96b476eb6 100644 --- a/kernel/jump_label.c +++ b/kernel/jump_label.c | |||
@@ -18,8 +18,6 @@ | |||
18 | #include <linux/cpu.h> | 18 | #include <linux/cpu.h> |
19 | #include <asm/sections.h> | 19 | #include <asm/sections.h> |
20 | 20 | ||
21 | #ifdef HAVE_JUMP_LABEL | ||
22 | |||
23 | /* mutex to protect coming/going of the the jump_label table */ | 21 | /* mutex to protect coming/going of the the jump_label table */ |
24 | static DEFINE_MUTEX(jump_label_mutex); | 22 | static DEFINE_MUTEX(jump_label_mutex); |
25 | 23 | ||
@@ -80,13 +78,13 @@ jump_label_sort_entries(struct jump_entry *start, struct jump_entry *stop) | |||
80 | static void jump_label_update(struct static_key *key); | 78 | static void jump_label_update(struct static_key *key); |
81 | 79 | ||
82 | /* | 80 | /* |
83 | * There are similar definitions for the !HAVE_JUMP_LABEL case in jump_label.h. | 81 | * There are similar definitions for the !CONFIG_JUMP_LABEL case in jump_label.h. |
84 | * The use of 'atomic_read()' requires atomic.h and its problematic for some | 82 | * The use of 'atomic_read()' requires atomic.h and its problematic for some |
85 | * kernel headers such as kernel.h and others. Since static_key_count() is not | 83 | * kernel headers such as kernel.h and others. Since static_key_count() is not |
86 | * used in the branch statements as it is for the !HAVE_JUMP_LABEL case its ok | 84 | * used in the branch statements as it is for the !CONFIG_JUMP_LABEL case its ok |
87 | * to have it be a function here. Similarly, for 'static_key_enable()' and | 85 | * to have it be a function here. Similarly, for 'static_key_enable()' and |
88 | * 'static_key_disable()', which require bug.h. This should allow jump_label.h | 86 | * 'static_key_disable()', which require bug.h. This should allow jump_label.h |
89 | * to be included from most/all places for HAVE_JUMP_LABEL. | 87 | * to be included from most/all places for CONFIG_JUMP_LABEL. |
90 | */ | 88 | */ |
91 | int static_key_count(struct static_key *key) | 89 | int static_key_count(struct static_key *key) |
92 | { | 90 | { |
@@ -791,5 +789,3 @@ static __init int jump_label_test(void) | |||
791 | } | 789 | } |
792 | early_initcall(jump_label_test); | 790 | early_initcall(jump_label_test); |
793 | #endif /* STATIC_KEYS_SELFTEST */ | 791 | #endif /* STATIC_KEYS_SELFTEST */ |
794 | |||
795 | #endif /* HAVE_JUMP_LABEL */ | ||
diff --git a/kernel/module.c b/kernel/module.c index fcbc0128810b..2ad1b5239910 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -3102,7 +3102,7 @@ static int find_module_sections(struct module *mod, struct load_info *info) | |||
3102 | sizeof(*mod->bpf_raw_events), | 3102 | sizeof(*mod->bpf_raw_events), |
3103 | &mod->num_bpf_raw_events); | 3103 | &mod->num_bpf_raw_events); |
3104 | #endif | 3104 | #endif |
3105 | #ifdef HAVE_JUMP_LABEL | 3105 | #ifdef CONFIG_JUMP_LABEL |
3106 | mod->jump_entries = section_objs(info, "__jump_table", | 3106 | mod->jump_entries = section_objs(info, "__jump_table", |
3107 | sizeof(*mod->jump_entries), | 3107 | sizeof(*mod->jump_entries), |
3108 | &mod->num_jump_entries); | 3108 | &mod->num_jump_entries); |
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 223f78d5c111..a674c7db2f29 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c | |||
@@ -24,7 +24,7 @@ | |||
24 | 24 | ||
25 | DEFINE_PER_CPU_SHARED_ALIGNED(struct rq, runqueues); | 25 | DEFINE_PER_CPU_SHARED_ALIGNED(struct rq, runqueues); |
26 | 26 | ||
27 | #if defined(CONFIG_SCHED_DEBUG) && defined(HAVE_JUMP_LABEL) | 27 | #if defined(CONFIG_SCHED_DEBUG) && defined(CONFIG_JUMP_LABEL) |
28 | /* | 28 | /* |
29 | * Debugging: various feature bits | 29 | * Debugging: various feature bits |
30 | * | 30 | * |
diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c index 02bd5f969b21..de3de997e245 100644 --- a/kernel/sched/debug.c +++ b/kernel/sched/debug.c | |||
@@ -73,7 +73,7 @@ static int sched_feat_show(struct seq_file *m, void *v) | |||
73 | return 0; | 73 | return 0; |
74 | } | 74 | } |
75 | 75 | ||
76 | #ifdef HAVE_JUMP_LABEL | 76 | #ifdef CONFIG_JUMP_LABEL |
77 | 77 | ||
78 | #define jump_label_key__true STATIC_KEY_INIT_TRUE | 78 | #define jump_label_key__true STATIC_KEY_INIT_TRUE |
79 | #define jump_label_key__false STATIC_KEY_INIT_FALSE | 79 | #define jump_label_key__false STATIC_KEY_INIT_FALSE |
@@ -99,7 +99,7 @@ static void sched_feat_enable(int i) | |||
99 | #else | 99 | #else |
100 | static void sched_feat_disable(int i) { }; | 100 | static void sched_feat_disable(int i) { }; |
101 | static void sched_feat_enable(int i) { }; | 101 | static void sched_feat_enable(int i) { }; |
102 | #endif /* HAVE_JUMP_LABEL */ | 102 | #endif /* CONFIG_JUMP_LABEL */ |
103 | 103 | ||
104 | static int sched_feat_set(char *cmp) | 104 | static int sched_feat_set(char *cmp) |
105 | { | 105 | { |
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 6483834f1278..50aa2aba69bd 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c | |||
@@ -4217,7 +4217,7 @@ entity_tick(struct cfs_rq *cfs_rq, struct sched_entity *curr, int queued) | |||
4217 | 4217 | ||
4218 | #ifdef CONFIG_CFS_BANDWIDTH | 4218 | #ifdef CONFIG_CFS_BANDWIDTH |
4219 | 4219 | ||
4220 | #ifdef HAVE_JUMP_LABEL | 4220 | #ifdef CONFIG_JUMP_LABEL |
4221 | static struct static_key __cfs_bandwidth_used; | 4221 | static struct static_key __cfs_bandwidth_used; |
4222 | 4222 | ||
4223 | static inline bool cfs_bandwidth_used(void) | 4223 | static inline bool cfs_bandwidth_used(void) |
@@ -4234,7 +4234,7 @@ void cfs_bandwidth_usage_dec(void) | |||
4234 | { | 4234 | { |
4235 | static_key_slow_dec_cpuslocked(&__cfs_bandwidth_used); | 4235 | static_key_slow_dec_cpuslocked(&__cfs_bandwidth_used); |
4236 | } | 4236 | } |
4237 | #else /* HAVE_JUMP_LABEL */ | 4237 | #else /* CONFIG_JUMP_LABEL */ |
4238 | static bool cfs_bandwidth_used(void) | 4238 | static bool cfs_bandwidth_used(void) |
4239 | { | 4239 | { |
4240 | return true; | 4240 | return true; |
@@ -4242,7 +4242,7 @@ static bool cfs_bandwidth_used(void) | |||
4242 | 4242 | ||
4243 | void cfs_bandwidth_usage_inc(void) {} | 4243 | void cfs_bandwidth_usage_inc(void) {} |
4244 | void cfs_bandwidth_usage_dec(void) {} | 4244 | void cfs_bandwidth_usage_dec(void) {} |
4245 | #endif /* HAVE_JUMP_LABEL */ | 4245 | #endif /* CONFIG_JUMP_LABEL */ |
4246 | 4246 | ||
4247 | /* | 4247 | /* |
4248 | * default period for cfs group bandwidth. | 4248 | * default period for cfs group bandwidth. |
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 0ba08924e017..d04530bf251f 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h | |||
@@ -1488,7 +1488,7 @@ enum { | |||
1488 | 1488 | ||
1489 | #undef SCHED_FEAT | 1489 | #undef SCHED_FEAT |
1490 | 1490 | ||
1491 | #if defined(CONFIG_SCHED_DEBUG) && defined(HAVE_JUMP_LABEL) | 1491 | #if defined(CONFIG_SCHED_DEBUG) && defined(CONFIG_JUMP_LABEL) |
1492 | 1492 | ||
1493 | /* | 1493 | /* |
1494 | * To support run-time toggling of sched features, all the translation units | 1494 | * To support run-time toggling of sched features, all the translation units |
@@ -1508,7 +1508,7 @@ static __always_inline bool static_branch_##name(struct static_key *key) \ | |||
1508 | extern struct static_key sched_feat_keys[__SCHED_FEAT_NR]; | 1508 | extern struct static_key sched_feat_keys[__SCHED_FEAT_NR]; |
1509 | #define sched_feat(x) (static_branch_##x(&sched_feat_keys[__SCHED_FEAT_##x])) | 1509 | #define sched_feat(x) (static_branch_##x(&sched_feat_keys[__SCHED_FEAT_##x])) |
1510 | 1510 | ||
1511 | #else /* !(SCHED_DEBUG && HAVE_JUMP_LABEL) */ | 1511 | #else /* !(SCHED_DEBUG && CONFIG_JUMP_LABEL) */ |
1512 | 1512 | ||
1513 | /* | 1513 | /* |
1514 | * Each translation unit has its own copy of sysctl_sched_features to allow | 1514 | * Each translation unit has its own copy of sysctl_sched_features to allow |
@@ -1524,7 +1524,7 @@ static const_debug __maybe_unused unsigned int sysctl_sched_features = | |||
1524 | 1524 | ||
1525 | #define sched_feat(x) !!(sysctl_sched_features & (1UL << __SCHED_FEAT_##x)) | 1525 | #define sched_feat(x) !!(sysctl_sched_features & (1UL << __SCHED_FEAT_##x)) |
1526 | 1526 | ||
1527 | #endif /* SCHED_DEBUG && HAVE_JUMP_LABEL */ | 1527 | #endif /* SCHED_DEBUG && CONFIG_JUMP_LABEL */ |
1528 | 1528 | ||
1529 | extern struct static_key_false sched_numa_balancing; | 1529 | extern struct static_key_false sched_numa_balancing; |
1530 | extern struct static_key_false sched_schedstats; | 1530 | extern struct static_key_false sched_schedstats; |
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index c7c96bc7654a..dbf2b457e47e 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c | |||
@@ -188,7 +188,7 @@ static int ddebug_change(const struct ddebug_query *query, | |||
188 | newflags = (dp->flags & mask) | flags; | 188 | newflags = (dp->flags & mask) | flags; |
189 | if (newflags == dp->flags) | 189 | if (newflags == dp->flags) |
190 | continue; | 190 | continue; |
191 | #ifdef HAVE_JUMP_LABEL | 191 | #ifdef CONFIG_JUMP_LABEL |
192 | if (dp->flags & _DPRINTK_FLAGS_PRINT) { | 192 | if (dp->flags & _DPRINTK_FLAGS_PRINT) { |
193 | if (!(flags & _DPRINTK_FLAGS_PRINT)) | 193 | if (!(flags & _DPRINTK_FLAGS_PRINT)) |
194 | static_branch_disable(&dp->key.dd_key_true); | 194 | static_branch_disable(&dp->key.dd_key_true); |
diff --git a/net/core/dev.c b/net/core/dev.c index 1b5a4410be0e..82f20022259d 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -1821,7 +1821,7 @@ EXPORT_SYMBOL_GPL(net_dec_egress_queue); | |||
1821 | #endif | 1821 | #endif |
1822 | 1822 | ||
1823 | static DEFINE_STATIC_KEY_FALSE(netstamp_needed_key); | 1823 | static DEFINE_STATIC_KEY_FALSE(netstamp_needed_key); |
1824 | #ifdef HAVE_JUMP_LABEL | 1824 | #ifdef CONFIG_JUMP_LABEL |
1825 | static atomic_t netstamp_needed_deferred; | 1825 | static atomic_t netstamp_needed_deferred; |
1826 | static atomic_t netstamp_wanted; | 1826 | static atomic_t netstamp_wanted; |
1827 | static void netstamp_clear(struct work_struct *work) | 1827 | static void netstamp_clear(struct work_struct *work) |
@@ -1840,7 +1840,7 @@ static DECLARE_WORK(netstamp_work, netstamp_clear); | |||
1840 | 1840 | ||
1841 | void net_enable_timestamp(void) | 1841 | void net_enable_timestamp(void) |
1842 | { | 1842 | { |
1843 | #ifdef HAVE_JUMP_LABEL | 1843 | #ifdef CONFIG_JUMP_LABEL |
1844 | int wanted; | 1844 | int wanted; |
1845 | 1845 | ||
1846 | while (1) { | 1846 | while (1) { |
@@ -1860,7 +1860,7 @@ EXPORT_SYMBOL(net_enable_timestamp); | |||
1860 | 1860 | ||
1861 | void net_disable_timestamp(void) | 1861 | void net_disable_timestamp(void) |
1862 | { | 1862 | { |
1863 | #ifdef HAVE_JUMP_LABEL | 1863 | #ifdef CONFIG_JUMP_LABEL |
1864 | int wanted; | 1864 | int wanted; |
1865 | 1865 | ||
1866 | while (1) { | 1866 | while (1) { |
diff --git a/net/netfilter/core.c b/net/netfilter/core.c index dc240cb47ddf..93aaec3a54ec 100644 --- a/net/netfilter/core.c +++ b/net/netfilter/core.c | |||
@@ -33,7 +33,7 @@ EXPORT_SYMBOL_GPL(nf_ipv6_ops); | |||
33 | DEFINE_PER_CPU(bool, nf_skb_duplicated); | 33 | DEFINE_PER_CPU(bool, nf_skb_duplicated); |
34 | EXPORT_SYMBOL_GPL(nf_skb_duplicated); | 34 | EXPORT_SYMBOL_GPL(nf_skb_duplicated); |
35 | 35 | ||
36 | #ifdef HAVE_JUMP_LABEL | 36 | #ifdef CONFIG_JUMP_LABEL |
37 | struct static_key nf_hooks_needed[NFPROTO_NUMPROTO][NF_MAX_HOOKS]; | 37 | struct static_key nf_hooks_needed[NFPROTO_NUMPROTO][NF_MAX_HOOKS]; |
38 | EXPORT_SYMBOL(nf_hooks_needed); | 38 | EXPORT_SYMBOL(nf_hooks_needed); |
39 | #endif | 39 | #endif |
@@ -347,7 +347,7 @@ static int __nf_register_net_hook(struct net *net, int pf, | |||
347 | if (pf == NFPROTO_NETDEV && reg->hooknum == NF_NETDEV_INGRESS) | 347 | if (pf == NFPROTO_NETDEV && reg->hooknum == NF_NETDEV_INGRESS) |
348 | net_inc_ingress_queue(); | 348 | net_inc_ingress_queue(); |
349 | #endif | 349 | #endif |
350 | #ifdef HAVE_JUMP_LABEL | 350 | #ifdef CONFIG_JUMP_LABEL |
351 | static_key_slow_inc(&nf_hooks_needed[pf][reg->hooknum]); | 351 | static_key_slow_inc(&nf_hooks_needed[pf][reg->hooknum]); |
352 | #endif | 352 | #endif |
353 | BUG_ON(p == new_hooks); | 353 | BUG_ON(p == new_hooks); |
@@ -405,7 +405,7 @@ static void __nf_unregister_net_hook(struct net *net, int pf, | |||
405 | if (pf == NFPROTO_NETDEV && reg->hooknum == NF_NETDEV_INGRESS) | 405 | if (pf == NFPROTO_NETDEV && reg->hooknum == NF_NETDEV_INGRESS) |
406 | net_dec_ingress_queue(); | 406 | net_dec_ingress_queue(); |
407 | #endif | 407 | #endif |
408 | #ifdef HAVE_JUMP_LABEL | 408 | #ifdef CONFIG_JUMP_LABEL |
409 | static_key_slow_dec(&nf_hooks_needed[pf][reg->hooknum]); | 409 | static_key_slow_dec(&nf_hooks_needed[pf][reg->hooknum]); |
410 | #endif | 410 | #endif |
411 | } else { | 411 | } else { |
diff --git a/scripts/gcc-goto.sh b/scripts/gcc-goto.sh index 083c526073ef..8b980fb2270a 100755 --- a/scripts/gcc-goto.sh +++ b/scripts/gcc-goto.sh | |||
@@ -3,7 +3,7 @@ | |||
3 | # Test for gcc 'asm goto' support | 3 | # Test for gcc 'asm goto' support |
4 | # Copyright (C) 2010, Jason Baron <jbaron@redhat.com> | 4 | # Copyright (C) 2010, Jason Baron <jbaron@redhat.com> |
5 | 5 | ||
6 | cat << "END" | $@ -x c - -c -o /dev/null >/dev/null 2>&1 && echo "y" | 6 | cat << "END" | $@ -x c - -fno-PIE -c -o /dev/null |
7 | int main(void) | 7 | int main(void) |
8 | { | 8 | { |
9 | #if defined(__arm__) || defined(__aarch64__) | 9 | #if defined(__arm__) || defined(__aarch64__) |
diff --git a/tools/arch/x86/include/asm/rmwcc.h b/tools/arch/x86/include/asm/rmwcc.h index dc90c0c2fae3..fee7983a90b4 100644 --- a/tools/arch/x86/include/asm/rmwcc.h +++ b/tools/arch/x86/include/asm/rmwcc.h | |||
@@ -2,7 +2,7 @@ | |||
2 | #ifndef _TOOLS_LINUX_ASM_X86_RMWcc | 2 | #ifndef _TOOLS_LINUX_ASM_X86_RMWcc |
3 | #define _TOOLS_LINUX_ASM_X86_RMWcc | 3 | #define _TOOLS_LINUX_ASM_X86_RMWcc |
4 | 4 | ||
5 | #ifdef CC_HAVE_ASM_GOTO | 5 | #ifdef CONFIG_CC_HAS_ASM_GOTO |
6 | 6 | ||
7 | #define __GEN_RMWcc(fullop, var, cc, ...) \ | 7 | #define __GEN_RMWcc(fullop, var, cc, ...) \ |
8 | do { \ | 8 | do { \ |
@@ -20,7 +20,7 @@ cc_label: \ | |||
20 | #define GEN_BINARY_RMWcc(op, var, vcon, val, arg0, cc) \ | 20 | #define GEN_BINARY_RMWcc(op, var, vcon, val, arg0, cc) \ |
21 | __GEN_RMWcc(op " %1, " arg0, var, cc, vcon (val)) | 21 | __GEN_RMWcc(op " %1, " arg0, var, cc, vcon (val)) |
22 | 22 | ||
23 | #else /* !CC_HAVE_ASM_GOTO */ | 23 | #else /* !CONFIG_CC_HAS_ASM_GOTO */ |
24 | 24 | ||
25 | #define __GEN_RMWcc(fullop, var, cc, ...) \ | 25 | #define __GEN_RMWcc(fullop, var, cc, ...) \ |
26 | do { \ | 26 | do { \ |
@@ -37,6 +37,6 @@ do { \ | |||
37 | #define GEN_BINARY_RMWcc(op, var, vcon, val, arg0, cc) \ | 37 | #define GEN_BINARY_RMWcc(op, var, vcon, val, arg0, cc) \ |
38 | __GEN_RMWcc(op " %2, " arg0, var, cc, vcon (val)) | 38 | __GEN_RMWcc(op " %2, " arg0, var, cc, vcon (val)) |
39 | 39 | ||
40 | #endif /* CC_HAVE_ASM_GOTO */ | 40 | #endif /* CONFIG_CC_HAS_ASM_GOTO */ |
41 | 41 | ||
42 | #endif /* _TOOLS_LINUX_ASM_X86_RMWcc */ | 42 | #endif /* _TOOLS_LINUX_ASM_X86_RMWcc */ |