diff options
author | Steven Rostedt <rostedt@goodmis.org> | 2008-10-31 00:03:22 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-10-31 05:29:17 -0400 |
commit | a26a2a27396c0a0877aa701f8f92d08ba550a6c9 (patch) | |
tree | 8e314b970e0219419b89204d3197fbc1257bf36e /arch/x86 | |
parent | b807c3d0f8e39ed7cbbbe6da162650e305e8de15 (diff) |
ftrace: nmi safe code clean ups
Impact: cleanup
This patch cleans up the NMI safe code for dynamic ftrace as suggested
by Andrew Morton.
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/include/asm/ftrace.h | 10 | ||||
-rw-r--r-- | arch/x86/kernel/ftrace.c | 16 |
2 files changed, 13 insertions, 13 deletions
diff --git a/arch/x86/include/asm/ftrace.h b/arch/x86/include/asm/ftrace.h index f2ed6b704a75..a23468194b8c 100644 --- a/arch/x86/include/asm/ftrace.h +++ b/arch/x86/include/asm/ftrace.h | |||
@@ -22,16 +22,16 @@ static inline unsigned long ftrace_call_adjust(unsigned long addr) | |||
22 | extern void ftrace_nmi_enter(void); | 22 | extern void ftrace_nmi_enter(void); |
23 | extern void ftrace_nmi_exit(void); | 23 | extern void ftrace_nmi_exit(void); |
24 | #else | 24 | #else |
25 | #define ftrace_nmi_enter() do { } while (0) | 25 | static inline void ftrace_nmi_enter(void) { } |
26 | #define ftrace_nmi_exit() do { } while (0) | 26 | static inline void ftrace_nmi_exit(void) { } |
27 | #endif | ||
28 | #endif | 27 | #endif |
28 | #endif /* __ASSEMBLY__ */ | ||
29 | 29 | ||
30 | #else /* CONFIG_FUNCTION_TRACER */ | 30 | #else /* CONFIG_FUNCTION_TRACER */ |
31 | 31 | ||
32 | #ifndef __ASSEMBLY__ | 32 | #ifndef __ASSEMBLY__ |
33 | #define ftrace_nmi_enter() do { } while (0) | 33 | static inline void ftrace_nmi_enter(void) { } |
34 | #define ftrace_nmi_exit() do { } while (0) | 34 | static inline void ftrace_nmi_exit(void) { } |
35 | #endif | 35 | #endif |
36 | 36 | ||
37 | #endif /* CONFIG_FUNCTION_TRACER */ | 37 | #endif /* CONFIG_FUNCTION_TRACER */ |
diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c index 6685b0fc1b44..69149337f2fe 100644 --- a/arch/x86/kernel/ftrace.c +++ b/arch/x86/kernel/ftrace.c | |||
@@ -67,7 +67,7 @@ unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr) | |||
67 | * | 67 | * |
68 | * Two buffers are added: An IP buffer and a "code" buffer. | 68 | * Two buffers are added: An IP buffer and a "code" buffer. |
69 | * | 69 | * |
70 | * 1) Put in the instruction pointer into the IP buffer | 70 | * 1) Put the instruction pointer into the IP buffer |
71 | * and the new code into the "code" buffer. | 71 | * and the new code into the "code" buffer. |
72 | * 2) Set a flag that says we are modifying code | 72 | * 2) Set a flag that says we are modifying code |
73 | * 3) Wait for any running NMIs to finish. | 73 | * 3) Wait for any running NMIs to finish. |
@@ -85,14 +85,14 @@ unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr) | |||
85 | * are the same as what exists. | 85 | * are the same as what exists. |
86 | */ | 86 | */ |
87 | 87 | ||
88 | static atomic_t in_nmi; | 88 | static atomic_t in_nmi = ATOMIC_INIT(0); |
89 | static int mod_code_status; | 89 | static int mod_code_status; /* holds return value of text write */ |
90 | static int mod_code_write; | 90 | static int mod_code_write; /* set when NMI should do the write */ |
91 | static void *mod_code_ip; | 91 | static void *mod_code_ip; /* holds the IP to write to */ |
92 | static void *mod_code_newcode; | 92 | static void *mod_code_newcode; /* holds the text to write to the IP */ |
93 | 93 | ||
94 | static int nmi_wait_count; | 94 | static unsigned nmi_wait_count; |
95 | static atomic_t nmi_update_count; | 95 | static atomic_t nmi_update_count = ATOMIC_INIT(0); |
96 | 96 | ||
97 | int ftrace_arch_read_dyn_info(char *buf, int size) | 97 | int ftrace_arch_read_dyn_info(char *buf, int size) |
98 | { | 98 | { |