Enable panic when NMI handler runs for too long
Hardware and firmware issues can cause NMI handlers to run for too long,
as in for tens of seconds. These issues can be difficult to debug,
because by the time stall mechanisms notice a problem, critically
important debugging information has vanished. A new toolong_nmi_panic
kernel boot parameter that causes the system to panic immediately
upon return from any NMI handler that ran for longer than the number
of milliseconds specifed by toolong_nmi_panic, thus increasing the
probability that the needed debug information will still be available.
x86/nmi: Enable panic() when NMI handler runs too long
Firmware, device-driver, and configuration issues can result in
long-running NMI handlers, for example, nmi_cpu_backtrace_handler()
running for more than two seconds, and with no console issues. In this
case, this is not the fault of nmi_cpu_backtrace_handler(), but it is
the first symptom of the underlying problem. These NMI handlers result
in various other problems, including CSD-lock warnings, clocksource
watchdog false positives, scheduler frequency invariance wobbliness,
systemd excessive-CPU complaints, and even the occasional RCU CPU
stall warning. Eventually, the automation will take the system out of
service, but with quite a bit of noise obscuring the underlying issue,
and thus confusing both automation and human beings.
Therefore, provide a toolong_nmi_panic __setup() parameter that makes
nmi_check_duration() invoke nmi_panic() if the just-completed NMI handler
ran for more than the specified number of milliseconds. This parameter
defaults to zero, which disables the nmi_panic(). As in, by default
you get the same behavior that you get today.
[ paulmck: Apply kernel test robot feedback, add documentation. ]
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Cc: Thomas Gleixner <tglx@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: <x86@kernel.org>
2 files changed