summaryrefslogtreecommitdiff
path: root/arch/x86
diff options
context:
space:
mode:
authorDave Hansen <dave.hansen@linux.intel.com>2013-06-21 19:51:38 +0400
committerIngo Molnar <mingo@kernel.org>2013-06-23 13:52:58 +0400
commit0c4df02d739fed5ab081b330d67403206dd3967e (patch)
tree37296c48ff5adef1537fd5c64977a3c1a0e8cff2 /arch/x86
parent14c63f17b1fde5a575a28e96547a22b451c71fb5 (diff)
downloadlinux-0c4df02d739fed5ab081b330d67403206dd3967e.tar.xz
x86: Add NMI duration tracepoints
This patch has been invaluable in my adventures finding issues in the perf NMI handler. I'm as big a fan of printk() as anybody is, but using printk() in NMIs is deadly when they're happening frequently. Even hacking in trace_printk() ended up eating enough CPU to throw off some of the measurements I was making. Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com> Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: paulus@samba.org Cc: acme@ghostprotocols.net Cc: Dave Hansen <dave@sr71.net> Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/kernel/nmi.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/arch/x86/kernel/nmi.c b/arch/x86/kernel/nmi.c
index e9bae4c2f2dd..0920212e6159 100644
--- a/arch/x86/kernel/nmi.c
+++ b/arch/x86/kernel/nmi.c
@@ -30,6 +30,9 @@
#include <asm/nmi.h>
#include <asm/x86_init.h>
+#define CREATE_TRACE_POINTS
+#include <trace/events/nmi.h>
+
struct nmi_desc {
spinlock_t lock;
struct list_head head;
@@ -108,11 +111,13 @@ static int __kprobes nmi_handle(unsigned int type, struct pt_regs *regs, bool b2
*/
list_for_each_entry_rcu(a, &desc->head, list) {
u64 before, delta, whole_msecs;
- int decimal_msecs;
+ int decimal_msecs, thishandled;
before = local_clock();
- handled += a->handler(type, regs);
+ thishandled = a->handler(type, regs);
+ handled += thishandled;
delta = local_clock() - before;
+ trace_nmi_handler(a->handler, (int)delta, thishandled);
if (delta < nmi_longest_ns)
continue;