mirror of
https://github.com/torvalds/linux.git
synced 2025-01-01 07:42:07 +00:00
jump_label: Free jump_entry::key bit1 for build use
Have jump_label_init() set jump_entry::key bit1 to either 0 ot 1 unconditionally. This makes it available for build-time games. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Link: https://lore.kernel.org/r/20210506194157.906893264@infradead.org
This commit is contained in:
parent
001951bea7
commit
5af0ea293d
@ -171,9 +171,12 @@ static inline bool jump_entry_is_init(const struct jump_entry *entry)
|
|||||||
return (unsigned long)entry->key & 2UL;
|
return (unsigned long)entry->key & 2UL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void jump_entry_set_init(struct jump_entry *entry)
|
static inline void jump_entry_set_init(struct jump_entry *entry, bool set)
|
||||||
{
|
{
|
||||||
entry->key |= 2;
|
if (set)
|
||||||
|
entry->key |= 2;
|
||||||
|
else
|
||||||
|
entry->key &= ~2;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int jump_entry_size(struct jump_entry *entry)
|
static inline int jump_entry_size(struct jump_entry *entry)
|
||||||
|
@ -483,13 +483,14 @@ void __init jump_label_init(void)
|
|||||||
|
|
||||||
for (iter = iter_start; iter < iter_stop; iter++) {
|
for (iter = iter_start; iter < iter_stop; iter++) {
|
||||||
struct static_key *iterk;
|
struct static_key *iterk;
|
||||||
|
bool in_init;
|
||||||
|
|
||||||
/* rewrite NOPs */
|
/* rewrite NOPs */
|
||||||
if (jump_label_type(iter) == JUMP_LABEL_NOP)
|
if (jump_label_type(iter) == JUMP_LABEL_NOP)
|
||||||
arch_jump_label_transform_static(iter, JUMP_LABEL_NOP);
|
arch_jump_label_transform_static(iter, JUMP_LABEL_NOP);
|
||||||
|
|
||||||
if (init_section_contains((void *)jump_entry_code(iter), 1))
|
in_init = init_section_contains((void *)jump_entry_code(iter), 1);
|
||||||
jump_entry_set_init(iter);
|
jump_entry_set_init(iter, in_init);
|
||||||
|
|
||||||
iterk = jump_entry_key(iter);
|
iterk = jump_entry_key(iter);
|
||||||
if (iterk == key)
|
if (iterk == key)
|
||||||
@ -634,9 +635,10 @@ static int jump_label_add_module(struct module *mod)
|
|||||||
|
|
||||||
for (iter = iter_start; iter < iter_stop; iter++) {
|
for (iter = iter_start; iter < iter_stop; iter++) {
|
||||||
struct static_key *iterk;
|
struct static_key *iterk;
|
||||||
|
bool in_init;
|
||||||
|
|
||||||
if (within_module_init(jump_entry_code(iter), mod))
|
in_init = within_module_init(jump_entry_code(iter), mod);
|
||||||
jump_entry_set_init(iter);
|
jump_entry_set_init(iter, in_init);
|
||||||
|
|
||||||
iterk = jump_entry_key(iter);
|
iterk = jump_entry_key(iter);
|
||||||
if (iterk == key)
|
if (iterk == key)
|
||||||
|
Loading…
Reference in New Issue
Block a user