Skip to content

Commit 97ce2c8

Browse files
author
Jeremy Fitzhardinge
committed
jump-label: initialize jump-label subsystem much earlier
Initialize jump_labels much, much earlier, so they're available for use during system setup. Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
1 parent e71a5be commit 97ce2c8

3 files changed

Lines changed: 13 additions & 9 deletions

File tree

‎include/linux/jump_label.h‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ struct jump_label_key {
1616

1717
# include <asm/jump_label.h>
1818
# define HAVE_JUMP_LABEL
19-
#endif
19+
#endif /* CC_HAVE_ASM_GOTO && CONFIG_JUMP_LABEL */
2020

2121
enum jump_label_type {
2222
JUMP_LABEL_DISABLE = 0,
@@ -41,6 +41,7 @@ static __always_inline bool static_branch(struct jump_label_key *key)
4141
extern struct jump_entry __start___jump_table[];
4242
extern struct jump_entry __stop___jump_table[];
4343

44+
extern void jump_label_init(void);
4445
extern void jump_label_lock(void);
4546
extern void jump_label_unlock(void);
4647
extern void arch_jump_label_transform(struct jump_entry *entry,
@@ -53,7 +54,7 @@ extern void jump_label_dec(struct jump_label_key *key);
5354
extern bool jump_label_enabled(struct jump_label_key *key);
5455
extern void jump_label_apply_nops(struct module *mod);
5556

56-
#else
57+
#else /* !HAVE_JUMP_LABEL */
5758

5859
#include <linux/atomic.h>
5960

@@ -63,6 +64,10 @@ struct jump_label_key {
6364
atomic_t enabled;
6465
};
6566

67+
static __always_inline void jump_label_init(void)
68+
{
69+
}
70+
6671
static __always_inline bool static_branch(struct jump_label_key *key)
6772
{
6873
if (unlikely(atomic_read(&key->enabled)))
@@ -97,7 +102,6 @@ static inline int jump_label_apply_nops(struct module *mod)
97102
{
98103
return 0;
99104
}
105+
#endif /* HAVE_JUMP_LABEL */
100106

101-
#endif
102-
103-
#endif
107+
#endif /* _LINUX_JUMP_LABEL_H */

‎init/main.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,9 @@ asmlinkage void __init start_kernel(void)
515515
parse_args("Booting kernel", static_command_line, __start___param,
516516
__stop___param - __start___param,
517517
&unknown_bootoption);
518+
519+
jump_label_init();
520+
518521
/*
519522
* These use large bootmem allocations and must precede
520523
* kmem_cache_init()

‎kernel/jump_label.c‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ static void __jump_label_update(struct jump_label_key *key,
133133
}
134134
}
135135

136-
static __init int jump_label_init(void)
136+
void __init jump_label_init(void)
137137
{
138138
struct jump_entry *iter_start = __start___jump_table;
139139
struct jump_entry *iter_stop = __stop___jump_table;
@@ -159,10 +159,7 @@ static __init int jump_label_init(void)
159159
#endif
160160
}
161161
jump_label_unlock();
162-
163-
return 0;
164162
}
165-
early_initcall(jump_label_init);
166163

167164
#ifdef CONFIG_MODULES
168165

0 commit comments

Comments
 (0)