x86/jump_label: add arch_jump_label_transform_static()
This allows jump-label entries to be cheaply updated on code which is not yet live. Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> Acked-by: Jason Baron <jbaron@redhat.com> Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
This commit is contained in:
@@ -24,8 +24,9 @@ union jump_code_union {
|
|||||||
} __attribute__((packed));
|
} __attribute__((packed));
|
||||||
};
|
};
|
||||||
|
|
||||||
void arch_jump_label_transform(struct jump_entry *entry,
|
static void __jump_label_transform(struct jump_entry *entry,
|
||||||
enum jump_label_type type)
|
enum jump_label_type type,
|
||||||
|
void *(*poker)(void *, const void *, size_t))
|
||||||
{
|
{
|
||||||
union jump_code_union code;
|
union jump_code_union code;
|
||||||
|
|
||||||
@@ -35,11 +36,24 @@ void arch_jump_label_transform(struct jump_entry *entry,
|
|||||||
(entry->code + JUMP_LABEL_NOP_SIZE);
|
(entry->code + JUMP_LABEL_NOP_SIZE);
|
||||||
} else
|
} else
|
||||||
memcpy(&code, ideal_nops[NOP_ATOMIC5], JUMP_LABEL_NOP_SIZE);
|
memcpy(&code, ideal_nops[NOP_ATOMIC5], JUMP_LABEL_NOP_SIZE);
|
||||||
|
|
||||||
|
(*poker)((void *)entry->code, &code, JUMP_LABEL_NOP_SIZE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void arch_jump_label_transform(struct jump_entry *entry,
|
||||||
|
enum jump_label_type type)
|
||||||
|
{
|
||||||
get_online_cpus();
|
get_online_cpus();
|
||||||
mutex_lock(&text_mutex);
|
mutex_lock(&text_mutex);
|
||||||
text_poke_smp((void *)entry->code, &code, JUMP_LABEL_NOP_SIZE);
|
__jump_label_transform(entry, type, text_poke_smp);
|
||||||
mutex_unlock(&text_mutex);
|
mutex_unlock(&text_mutex);
|
||||||
put_online_cpus();
|
put_online_cpus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void arch_jump_label_transform_static(struct jump_entry *entry,
|
||||||
|
enum jump_label_type type)
|
||||||
|
{
|
||||||
|
__jump_label_transform(entry, type, text_poke_early);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user