diff mbox series

[v7,10/10] x86/nmi: Print source information with the unknown NMI console message

Message ID 20250612214849.3950094-11-sohil.mehta@intel.com
State New
Headers show
Series x86: Add support for NMI-source reporting with FRED | expand

Commit Message

Sohil Mehta June 12, 2025, 9:48 p.m. UTC
The NMI-source bitmap is a useful piece of information provided by the
NMI-source reporting feature. It is very helpful for debugging unknown
NMIs, as it can pinpoint the exact source that caused the NMI.

Print the complete source bitmap along with the "unknown NMI" kernel log
message, since unexpected sources might have triggered the NMI.

Signed-off-by: Sohil Mehta <sohil.mehta@intel.com>
---
v7: No change.

v6: Drop the tracepoint modification part for now.

v5: New patch
---
 arch/x86/kernel/nmi.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/arch/x86/kernel/nmi.c b/arch/x86/kernel/nmi.c
index 3d2b636e9379..0b5bb20c5eb7 100644
--- a/arch/x86/kernel/nmi.c
+++ b/arch/x86/kernel/nmi.c
@@ -379,6 +379,9 @@  unknown_nmi_error(unsigned char reason, struct pt_regs *regs)
 	pr_emerg_ratelimited("Uhhuh. NMI received for unknown reason %02x on CPU %d.\n",
 			     reason, smp_processor_id());
 
+	if (cpu_feature_enabled(X86_FEATURE_NMI_SOURCE))
+		pr_emerg_ratelimited("NMI-source bitmap is 0x%lx\n", fred_event_data(regs));
+
 	if (unknown_nmi_panic || panic_on_unrecovered_nmi)
 		nmi_panic(regs, "NMI: Not continuing");