]> git.ipfire.org Git - thirdparty/linux.git/commit
x86/nmi: Simplify unknown NMI panic handling
authorSohil Mehta <sohil.mehta@intel.com>
Thu, 27 Mar 2025 23:46:21 +0000 (23:46 +0000)
committerIngo Molnar <mingo@kernel.org>
Tue, 1 Apr 2025 20:25:41 +0000 (22:25 +0200)
commit2e016da1cbbd013368095270c040e065678c38f7
treede74e1dd912a26252d65928ff43c63417c9149e1
parent08733088b566b58283f0f12fb73f5db6a9a9de30
x86/nmi: Simplify unknown NMI panic handling

The unknown_nmi_panic variable is used to control whether the kernel
should panic on unknown NMIs. There is a sysctl entry under:

  /proc/sys/kernel/unknown_nmi_panic

which can be used to change the behavior at runtime.

However, it seems that in some places, the option unnecessarily depends
on CONFIG_X86_LOCAL_APIC. Other code in nmi.c uses unknown_nmi_panic
without such a dependency. This results in a few messy #ifdefs
splattered across the code. The dependency was likely introduce due to a
potential build bug reported a long time ago:

  https://lore.kernel.org/lkml/40BC67F9.3000609@myrealbox.com/

This build bug no longer exists.

Also, similar NMI panic options, such as panic_on_unrecovered_nmi and
panic_on_io_nmi, do not have an explicit dependency on the local APIC
either.

Though, it's hard to imagine a production system without the local APIC
configuration, making a specific NMI sysctl option dependent on it
doesn't make sense.

Remove the explicit dependency between unknown NMI handling and the
local APIC to make the code cleaner and more consistent.

While at it, reorder the header includes to maintain alphabetical order.

[ mingo: Cleaned up the changelog a bit, truly ordered the headers ... ]

Signed-off-by: Sohil Mehta <sohil.mehta@intel.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Nikolay Borisov <nik.borisov@suse.com>
Link: https://lore.kernel.org/r/20250327234629.3953536-2-sohil.mehta@intel.com
arch/x86/include/asm/nmi.h
arch/x86/kernel/setup.c