PageRenderTime 4447ms CodeModel.GetById 68ms RepoModel.GetById 18ms app.codeStats 0ms

Plain Text | 83 lines | 67 code | 16 blank | 0 comment | 0 complexity | e97e95155db16c1131fe415f330ceea0 MD5 | raw file
Possible License(s): CC-BY-SA-3.0, GPL-2.0, LGPL-2.0, AGPL-1.0
  1. [NMI watchdog is available for x86 and x86-64 architectures]
  2. Is your system locking up unpredictably? No keyboard activity, just
  3. a frustrating complete hard lockup? Do you want to help us debugging
  4. such lockups? If all yes then this document is definitely for you.
  5. On many x86/x86-64 type hardware there is a feature that enables
  6. us to generate 'watchdog NMI interrupts'. (NMI: Non Maskable Interrupt
  7. which get executed even if the system is otherwise locked up hard).
  8. This can be used to debug hard kernel lockups. By executing periodic
  9. NMI interrupts, the kernel can monitor whether any CPU has locked up,
  10. and print out debugging messages if so.
  11. In order to use the NMI watchdog, you need to have APIC support in your
  12. kernel. For SMP kernels, APIC support gets compiled in automatically. For
  13. UP, enable either CONFIG_X86_UP_APIC (Processor type and features -> Local
  14. APIC support on uniprocessors) or CONFIG_X86_UP_IOAPIC (Processor type and
  15. features -> IO-APIC support on uniprocessors) in your kernel config.
  16. CONFIG_X86_UP_APIC is for uniprocessor machines without an IO-APIC.
  17. CONFIG_X86_UP_IOAPIC is for uniprocessor with an IO-APIC. [Note: certain
  18. kernel debugging options, such as Kernel Stack Meter or Kernel Tracer,
  19. may implicitly disable the NMI watchdog.]
  20. For x86-64, the needed APIC is always compiled in.
  21. Using local APIC (nmi_watchdog=2) needs the first performance register, so
  22. you can't use it for other purposes (such as high precision performance
  23. profiling.) However, at least oprofile and the perfctr driver disable the
  24. local APIC NMI watchdog automatically.
  25. To actually enable the NMI watchdog, use the 'nmi_watchdog=N' boot
  26. parameter. Eg. the relevant lilo.conf entry:
  27. append="nmi_watchdog=1"
  28. For SMP machines and UP machines with an IO-APIC use nmi_watchdog=1.
  29. For UP machines without an IO-APIC use nmi_watchdog=2, this only works
  30. for some processor types. If in doubt, boot with nmi_watchdog=1 and
  31. check the NMI count in /proc/interrupts; if the count is zero then
  32. reboot with nmi_watchdog=2 and check the NMI count. If it is still
  33. zero then log a problem, you probably have a processor that needs to be
  34. added to the nmi code.
  35. A 'lockup' is the following scenario: if any CPU in the system does not
  36. execute the period local timer interrupt for more than 5 seconds, then
  37. the NMI handler generates an oops and kills the process. This
  38. 'controlled crash' (and the resulting kernel messages) can be used to
  39. debug the lockup. Thus whenever the lockup happens, wait 5 seconds and
  40. the oops will show up automatically. If the kernel produces no messages
  41. then the system has crashed so hard (eg. hardware-wise) that either it
  42. cannot even accept NMI interrupts, or the crash has made the kernel
  43. unable to print messages.
  44. Be aware that when using local APIC, the frequency of NMI interrupts
  45. it generates, depends on the system load. The local APIC NMI watchdog,
  46. lacking a better source, uses the "cycles unhalted" event. As you may
  47. guess it doesn't tick when the CPU is in the halted state (which happens
  48. when the system is idle), but if your system locks up on anything but the
  49. "hlt" processor instruction, the watchdog will trigger very soon as the
  50. "cycles unhalted" event will happen every clock tick. If it locks up on
  51. "hlt", then you are out of luck -- the event will not happen at all and the
  52. watchdog won't trigger. This is a shortcoming of the local APIC watchdog
  53. -- unfortunately there is no "clock ticks" event that would work all the
  54. time. The I/O APIC watchdog is driven externally and has no such shortcoming.
  55. But its NMI frequency is much higher, resulting in a more significant hit
  56. to the overall system performance.
  57. On x86 nmi_watchdog is disabled by default so you have to enable it with
  58. a boot time parameter.
  59. It's possible to disable the NMI watchdog in run-time by writing "0" to
  60. /proc/sys/kernel/nmi_watchdog. Writing "1" to the same file will re-enable
  61. the NMI watchdog. Notice that you still need to use "nmi_watchdog=" parameter
  62. at boot time.
  63. NOTE: In kernels prior to 2.4.2-ac18 the NMI-oopser is enabled unconditionally
  64. on x86 SMP boxes.
  65. [ feel free to send bug reports, suggestions and patches to
  66. Ingo Molnar <> or the Linux SMP mailing
  67. list at <> ]