aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/jump_label.c
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2013-07-12 05:22:09 -0400
committerH. Peter Anvin <hpa@linux.intel.com>2013-07-16 20:55:37 -0400
commit51b2c07b22261f19188d9a9071943d60a067481c (patch)
treec4c220205050ed11403ed8610fd557d44296bbb1 /arch/x86/kernel/jump_label.c
parentfd4363fff3d96795d3feb1b3fb48ce590f186bdd (diff)
x86: Make jump_label use int3-based patching
Make jump labels use text_poke_bp() for text patching instead of text_poke_smp(), avoiding the need for stop_machine(). Reviewed-by: Steven Rostedt <rostedt@goodmis.org> Reviewed-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz> Link: http://lkml.kernel.org/r/alpine.LNX.2.00.1307121120250.29788@pobox.suse.cz Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'arch/x86/kernel/jump_label.c')
-rw-r--r--arch/x86/kernel/jump_label.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/arch/x86/kernel/jump_label.c b/arch/x86/kernel/jump_label.c
index 2889b3d43882..460f5d9ceebb 100644
--- a/arch/x86/kernel/jump_label.c
+++ b/arch/x86/kernel/jump_label.c
@@ -37,7 +37,19 @@ static void __jump_label_transform(struct jump_entry *entry,
37 } else 37 } else
38 memcpy(&code, ideal_nops[NOP_ATOMIC5], JUMP_LABEL_NOP_SIZE); 38 memcpy(&code, ideal_nops[NOP_ATOMIC5], JUMP_LABEL_NOP_SIZE);
39 39
40 (*poker)((void *)entry->code, &code, JUMP_LABEL_NOP_SIZE); 40 /*
41 * Make text_poke_bp() a default fallback poker.
42 *
43 * At the time the change is being done, just ignore whether we
44 * are doing nop -> jump or jump -> nop transition, and assume
45 * always nop being the 'currently valid' instruction
46 *
47 */
48 if (poker)
49 (*poker)((void *)entry->code, &code, JUMP_LABEL_NOP_SIZE);
50 else
51 text_poke_bp((void *)entry->code, &code, JUMP_LABEL_NOP_SIZE,
52 (void *)entry->code + JUMP_LABEL_NOP_SIZE);
41} 53}
42 54
43void arch_jump_label_transform(struct jump_entry *entry, 55void arch_jump_label_transform(struct jump_entry *entry,
@@ -45,7 +57,7 @@ void arch_jump_label_transform(struct jump_entry *entry,
45{ 57{
46 get_online_cpus(); 58 get_online_cpus();
47 mutex_lock(&text_mutex); 59 mutex_lock(&text_mutex);
48 __jump_label_transform(entry, type, text_poke_smp); 60 __jump_label_transform(entry, type, NULL);
49 mutex_unlock(&text_mutex); 61 mutex_unlock(&text_mutex);
50 put_online_cpus(); 62 put_online_cpus();
51} 63}