events-nmi.rst 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. ================
  2. NMI Trace Events
  3. ================
  4. These events normally show up here:
  5. /sys/kernel/debug/tracing/events/nmi
  6. nmi_handler
  7. -----------
  8. You might want to use this tracepoint if you suspect that your
  9. NMI handlers are hogging large amounts of CPU time. The kernel
  10. will warn if it sees long-running handlers::
  11. INFO: NMI handler took too long to run: 9.207 msecs
  12. and this tracepoint will allow you to drill down and get some
  13. more details.
  14. Let's say you suspect that perf_event_nmi_handler() is causing
  15. you some problems and you only want to trace that handler
  16. specifically. You need to find its address::
  17. $ grep perf_event_nmi_handler /proc/kallsyms
  18. ffffffff81625600 t perf_event_nmi_handler
  19. Let's also say you are only interested in when that function is
  20. really hogging a lot of CPU time, like a millisecond at a time.
  21. Note that the kernel's output is in milliseconds, but the input
  22. to the filter is in nanoseconds! You can filter on 'delta_ns'::
  23. cd /sys/kernel/debug/tracing/events/nmi/nmi_handler
  24. echo 'handler==0xffffffff81625600 && delta_ns>1000000' > filter
  25. echo 1 > enable
  26. Your output would then look like::
  27. $ cat /sys/kernel/debug/tracing/trace_pipe
  28. <idle>-0 [000] d.h3 505.397558: nmi_handler: perf_event_nmi_handler() delta_ns: 3236765 handled: 1
  29. <idle>-0 [000] d.h3 505.805893: nmi_handler: perf_event_nmi_handler() delta_ns: 3174234 handled: 1
  30. <idle>-0 [000] d.h3 506.158206: nmi_handler: perf_event_nmi_handler() delta_ns: 3084642 handled: 1
  31. <idle>-0 [000] d.h3 506.334346: nmi_handler: perf_event_nmi_handler() delta_ns: 3080351 handled: 1