diff options
-rw-r--r-- | include/linux/jump_label.h | 14 | ||||
-rw-r--r-- | init/main.c | 3 | ||||
-rw-r--r-- | kernel/jump_label.c | 5 |
3 files changed, 13 insertions, 9 deletions
diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h index 56594e45b011..388b0d425b50 100644 --- a/include/linux/jump_label.h +++ b/include/linux/jump_label.h | |||
@@ -16,7 +16,7 @@ struct jump_label_key { | |||
16 | 16 | ||
17 | # include <asm/jump_label.h> | 17 | # include <asm/jump_label.h> |
18 | # define HAVE_JUMP_LABEL | 18 | # define HAVE_JUMP_LABEL |
19 | #endif | 19 | #endif /* CC_HAVE_ASM_GOTO && CONFIG_JUMP_LABEL */ |
20 | 20 | ||
21 | enum jump_label_type { | 21 | enum jump_label_type { |
22 | JUMP_LABEL_DISABLE = 0, | 22 | JUMP_LABEL_DISABLE = 0, |
@@ -41,6 +41,7 @@ static __always_inline bool static_branch(struct jump_label_key *key) | |||
41 | extern struct jump_entry __start___jump_table[]; | 41 | extern struct jump_entry __start___jump_table[]; |
42 | extern struct jump_entry __stop___jump_table[]; | 42 | extern struct jump_entry __stop___jump_table[]; |
43 | 43 | ||
44 | extern void jump_label_init(void); | ||
44 | extern void jump_label_lock(void); | 45 | extern void jump_label_lock(void); |
45 | extern void jump_label_unlock(void); | 46 | extern void jump_label_unlock(void); |
46 | extern void arch_jump_label_transform(struct jump_entry *entry, | 47 | extern void arch_jump_label_transform(struct jump_entry *entry, |
@@ -53,7 +54,7 @@ extern void jump_label_dec(struct jump_label_key *key); | |||
53 | extern bool jump_label_enabled(struct jump_label_key *key); | 54 | extern bool jump_label_enabled(struct jump_label_key *key); |
54 | extern void jump_label_apply_nops(struct module *mod); | 55 | extern void jump_label_apply_nops(struct module *mod); |
55 | 56 | ||
56 | #else | 57 | #else /* !HAVE_JUMP_LABEL */ |
57 | 58 | ||
58 | #include <linux/atomic.h> | 59 | #include <linux/atomic.h> |
59 | 60 | ||
@@ -63,6 +64,10 @@ struct jump_label_key { | |||
63 | atomic_t enabled; | 64 | atomic_t enabled; |
64 | }; | 65 | }; |
65 | 66 | ||
67 | static __always_inline void jump_label_init(void) | ||
68 | { | ||
69 | } | ||
70 | |||
66 | static __always_inline bool static_branch(struct jump_label_key *key) | 71 | static __always_inline bool static_branch(struct jump_label_key *key) |
67 | { | 72 | { |
68 | if (unlikely(atomic_read(&key->enabled))) | 73 | if (unlikely(atomic_read(&key->enabled))) |
@@ -97,7 +102,6 @@ static inline int jump_label_apply_nops(struct module *mod) | |||
97 | { | 102 | { |
98 | return 0; | 103 | return 0; |
99 | } | 104 | } |
105 | #endif /* HAVE_JUMP_LABEL */ | ||
100 | 106 | ||
101 | #endif | 107 | #endif /* _LINUX_JUMP_LABEL_H */ |
102 | |||
103 | #endif | ||
diff --git a/init/main.c b/init/main.c index 2a9b88aa5e76..29d8d847de94 100644 --- a/init/main.c +++ b/init/main.c | |||
@@ -515,6 +515,9 @@ asmlinkage void __init start_kernel(void) | |||
515 | parse_args("Booting kernel", static_command_line, __start___param, | 515 | parse_args("Booting kernel", static_command_line, __start___param, |
516 | __stop___param - __start___param, | 516 | __stop___param - __start___param, |
517 | &unknown_bootoption); | 517 | &unknown_bootoption); |
518 | |||
519 | jump_label_init(); | ||
520 | |||
518 | /* | 521 | /* |
519 | * These use large bootmem allocations and must precede | 522 | * These use large bootmem allocations and must precede |
520 | * kmem_cache_init() | 523 | * kmem_cache_init() |
diff --git a/kernel/jump_label.c b/kernel/jump_label.c index ff2028f35aa8..bbdfe2a462a0 100644 --- a/kernel/jump_label.c +++ b/kernel/jump_label.c | |||
@@ -133,7 +133,7 @@ static void __jump_label_update(struct jump_label_key *key, | |||
133 | } | 133 | } |
134 | } | 134 | } |
135 | 135 | ||
136 | static __init int jump_label_init(void) | 136 | void __init jump_label_init(void) |
137 | { | 137 | { |
138 | struct jump_entry *iter_start = __start___jump_table; | 138 | struct jump_entry *iter_start = __start___jump_table; |
139 | struct jump_entry *iter_stop = __stop___jump_table; | 139 | struct jump_entry *iter_stop = __stop___jump_table; |
@@ -159,10 +159,7 @@ static __init int jump_label_init(void) | |||
159 | #endif | 159 | #endif |
160 | } | 160 | } |
161 | jump_label_unlock(); | 161 | jump_label_unlock(); |
162 | |||
163 | return 0; | ||
164 | } | 162 | } |
165 | early_initcall(jump_label_init); | ||
166 | 163 | ||
167 | #ifdef CONFIG_MODULES | 164 | #ifdef CONFIG_MODULES |
168 | 165 | ||