diff options
author | Steven Rostedt <rostedt@goodmis.org> | 2008-10-30 16:08:33 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-10-30 16:30:09 -0400 |
commit | b807c3d0f8e39ed7cbbbe6da162650e305e8de15 (patch) | |
tree | 59d2d75f221099bf5df7d6bcb71eaa63b6f424e8 /arch/x86/kernel | |
parent | 17666f02b118099028522dfc3df00a235700e216 (diff) |
ftrace: nmi update statistics
Impact: add more debug info to /debugfs/tracing/dyn_ftrace_total_info
This patch adds dynamic ftrace NMI update statistics to the
/debugfs/tracing/dyn_ftrace_total_info stat file.
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel')
-rw-r--r-- | arch/x86/kernel/ftrace.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c index fe5f859130b5..6685b0fc1b44 100644 --- a/arch/x86/kernel/ftrace.c +++ b/arch/x86/kernel/ftrace.c | |||
@@ -91,6 +91,19 @@ static int mod_code_write; | |||
91 | static void *mod_code_ip; | 91 | static void *mod_code_ip; |
92 | static void *mod_code_newcode; | 92 | static void *mod_code_newcode; |
93 | 93 | ||
94 | static int nmi_wait_count; | ||
95 | static atomic_t nmi_update_count; | ||
96 | |||
97 | int ftrace_arch_read_dyn_info(char *buf, int size) | ||
98 | { | ||
99 | int r; | ||
100 | |||
101 | r = snprintf(buf, size, "%u %u", | ||
102 | nmi_wait_count, | ||
103 | atomic_read(&nmi_update_count)); | ||
104 | return r; | ||
105 | } | ||
106 | |||
94 | static void ftrace_mod_code(void) | 107 | static void ftrace_mod_code(void) |
95 | { | 108 | { |
96 | /* | 109 | /* |
@@ -109,8 +122,10 @@ void ftrace_nmi_enter(void) | |||
109 | atomic_inc(&in_nmi); | 122 | atomic_inc(&in_nmi); |
110 | /* Must have in_nmi seen before reading write flag */ | 123 | /* Must have in_nmi seen before reading write flag */ |
111 | smp_mb(); | 124 | smp_mb(); |
112 | if (mod_code_write) | 125 | if (mod_code_write) { |
113 | ftrace_mod_code(); | 126 | ftrace_mod_code(); |
127 | atomic_inc(&nmi_update_count); | ||
128 | } | ||
114 | } | 129 | } |
115 | 130 | ||
116 | void ftrace_nmi_exit(void) | 131 | void ftrace_nmi_exit(void) |
@@ -122,8 +137,15 @@ void ftrace_nmi_exit(void) | |||
122 | 137 | ||
123 | static void wait_for_nmi(void) | 138 | static void wait_for_nmi(void) |
124 | { | 139 | { |
125 | while (atomic_read(&in_nmi)) | 140 | int waited = 0; |
141 | |||
142 | while (atomic_read(&in_nmi)) { | ||
143 | waited = 1; | ||
126 | cpu_relax(); | 144 | cpu_relax(); |
145 | } | ||
146 | |||
147 | if (waited) | ||
148 | nmi_wait_count++; | ||
127 | } | 149 | } |
128 | 150 | ||
129 | static int | 151 | static int |