summaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/ftrace.c
diff options
context:
space:
mode:
authorSteven Rostedt <rostedt@goodmis.org>2008-10-30 16:08:33 -0400
committerIngo Molnar <mingo@elte.hu>2008-10-30 21:30:09 +0100
commitb807c3d0f8e39ed7cbbbe6da162650e305e8de15 (patch)
tree59d2d75f221099bf5df7d6bcb71eaa63b6f424e8 /arch/x86/kernel/ftrace.c
parent17666f02b118099028522dfc3df00a235700e216 (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/ftrace.c')
-rw-r--r--arch/x86/kernel/ftrace.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c
index fe5f859130b..6685b0fc1b4 100644
--- a/arch/x86/kernel/ftrace.c
+++ b/arch/x86/kernel/ftrace.c
@@ -91,6 +91,19 @@ static int mod_code_write;
static void *mod_code_ip;
static void *mod_code_newcode;
+static int nmi_wait_count;
+static atomic_t nmi_update_count;
+
+int ftrace_arch_read_dyn_info(char *buf, int size)
+{
+ int r;
+
+ r = snprintf(buf, size, "%u %u",
+ nmi_wait_count,
+ atomic_read(&nmi_update_count));
+ return r;
+}
+
static void ftrace_mod_code(void)
{
/*
@@ -109,8 +122,10 @@ void ftrace_nmi_enter(void)
atomic_inc(&in_nmi);
/* Must have in_nmi seen before reading write flag */
smp_mb();
- if (mod_code_write)
+ if (mod_code_write) {
ftrace_mod_code();
+ atomic_inc(&nmi_update_count);
+ }
}
void ftrace_nmi_exit(void)
@@ -122,8 +137,15 @@ void ftrace_nmi_exit(void)
static void wait_for_nmi(void)
{
- while (atomic_read(&in_nmi))
+ int waited = 0;
+
+ while (atomic_read(&in_nmi)) {
+ waited = 1;
cpu_relax();
+ }
+
+ if (waited)
+ nmi_wait_count++;
}
static int