diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-02-22 18:12:01 +0100 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-02-22 18:12:01 +0100 |
commit | c478f8786973d6d7552c652ddad3f6fd86b5af28 (patch) | |
tree | 39967f4bb9a35d626584bd46f1acd916c6b5278d /arch/x86/kernel/ftrace.c | |
parent | 843adf2379c18ed9a1b7493ee208bfd5512732e0 (diff) | |
parent | 4377245aa93b65b6597e4b7bb460fb9abc48b56b (diff) |
Merge branch 'tip/x86/ftrace' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace into tracing/ftrace
Conflicts:
include/linux/ftrace.h
kernel/trace/ftrace.c
Diffstat (limited to 'arch/x86/kernel/ftrace.c')
-rw-r--r-- | arch/x86/kernel/ftrace.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c index c2e057d9f88..3925ec0184b 100644 --- a/arch/x86/kernel/ftrace.c +++ b/arch/x86/kernel/ftrace.c @@ -18,6 +18,7 @@ #include <linux/init.h> #include <linux/list.h> +#include <asm/cacheflush.h> #include <asm/ftrace.h> #include <linux/ftrace.h> #include <asm/nops.h> @@ -26,6 +27,18 @@ #ifdef CONFIG_DYNAMIC_FTRACE +int ftrace_arch_code_modify_prepare(void) +{ + set_kernel_text_rw(); + return 0; +} + +int ftrace_arch_code_modify_post_process(void) +{ + set_kernel_text_ro(); + return 0; +} + union ftrace_code_union { char code[MCOUNT_INSN_SIZE]; struct { @@ -111,6 +124,10 @@ static void ftrace_mod_code(void) */ mod_code_status = probe_kernel_write(mod_code_ip, mod_code_newcode, MCOUNT_INSN_SIZE); + + /* if we fail, then kill any new writers */ + if (mod_code_status) + mod_code_write = 0; } void ftrace_nmi_enter(void) |