aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/trace
diff options
context:
space:
mode:
authorDave Hansen <dave.hansen@linux.intel.com>2013-06-21 11:51:38 -0400
committerIngo Molnar <mingo@kernel.org>2013-06-23 05:52:58 -0400
commit0c4df02d739fed5ab081b330d67403206dd3967e (patch)
tree37296c48ff5adef1537fd5c64977a3c1a0e8cff2 /Documentation/trace
parent14c63f17b1fde5a575a28e96547a22b451c71fb5 (diff)
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 'Documentation/trace')
-rw-r--r--Documentation/trace/events-nmi.txt43
1 files changed, 43 insertions, 0 deletions
diff --git a/Documentation/trace/events-nmi.txt b/Documentation/trace/events-nmi.txt
new file mode 100644
index 000000000000..c03c8c89f08d
--- /dev/null
+++ b/Documentation/trace/events-nmi.txt
@@ -0,0 +1,43 @@
1NMI Trace Events
2
3These events normally show up here:
4
5 /sys/kernel/debug/tracing/events/nmi
6
7--
8
9nmi_handler:
10
11You might want to use this tracepoint if you suspect that your
12NMI handlers are hogging large amounts of CPU time. The kernel
13will warn if it sees long-running handlers:
14
15 INFO: NMI handler took too long to run: 9.207 msecs
16
17and this tracepoint will allow you to drill down and get some
18more details.
19
20Let's say you suspect that perf_event_nmi_handler() is causing
21you some problems and you only want to trace that handler
22specifically. You need to find its address:
23
24 $ grep perf_event_nmi_handler /proc/kallsyms
25 ffffffff81625600 t perf_event_nmi_handler
26
27Let's also say you are only interested in when that function is
28really hogging a lot of CPU time, like a millisecond at a time.
29Note that the kernel's output is in milliseconds, but the input
30to the filter is in nanoseconds! You can filter on 'delta_ns':
31
32cd /sys/kernel/debug/tracing/events/nmi/nmi_handler
33echo 'handler==0xffffffff81625600 && delta_ns>1000000' > filter
34echo 1 > enable
35
36Your output would then look like:
37
38$ cat /sys/kernel/debug/tracing/trace_pipe
39<idle>-0 [000] d.h3 505.397558: nmi_handler: perf_event_nmi_handler() delta_ns: 3236765 handled: 1
40<idle>-0 [000] d.h3 505.805893: nmi_handler: perf_event_nmi_handler() delta_ns: 3174234 handled: 1
41<idle>-0 [000] d.h3 506.158206: nmi_handler: perf_event_nmi_handler() delta_ns: 3084642 handled: 1
42<idle>-0 [000] d.h3 506.334346: nmi_handler: perf_event_nmi_handler() delta_ns: 3080351 handled: 1
43