How can I configure my system to crash when NMI switch is pushed?

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux
  • Arch: x86_64

Issue

  • How can I configure my system to crash when NMI switch is pushed? I pushed the switch, but it did not crash and the following messages were output in /var/log/messages.

    kernel: Uhhuh. NMI received for unknown reason 3c.
    kernel: Do you have a strange power saving mode enabled?
    kernel: Dazed and confused, but trying to continue
    

Resolution

  • Enable all NMI related panic option in /etc/sysctl.conf which will cause the system to encounter a kernel panic when it receives an NMI from an unknown source.
  1. Add the following line to /etc/sysctl.conf

    kernel.unknown_nmi_panic=1 
    kernel.panic_on_io_nmi=1
    kernel.panic_on_unrecovered_nmi=1
    
  2. Reboot the system OR run the following command.

    # sysctl -p
    
  • If netdump, diskdump or kdump is configured on the system, a vmcore file will be saved by NMI switch.

Root Cause

  • Per the kernel documentation, an unknown NMI can trigger a kernel panic when appropriately tuned to do so. Otherwise the error reported above will be written to the kernel ring buffer and no further action taken.

  • /usr/share/doc/kernel-doc-2.6.32/Documentation/sysctl/kernel.txt:

    unknown_nmi_panic:
    
    The value in this file affects behavior of handling NMI. When the value is
    non-zero, unknown NMI is trapped and then panic occurs. At that time, kernel
    debugging information is displayed on console.
    
    NMI switch that most IA32 servers have fires unknown NMI up, for example.
    If a system hangs up, try pressing the NMI switch.
    
  • To only set kernel.unknown_nmi_panic=1 cannot crash the system with the NMI switch in some hardwares. For details, please refer to Why is triggering a panic using the NMI switch on a machine not working? .

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments