[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 2 Feb 2024 03:51:58 +0000
From: NOMURA JUNICHI(野村 淳一)
<junichi.nomura@....com>
To: "x86@...nel.org" <x86@...nel.org>, "mingo@...hat.com" <mingo@...hat.com>,
"tglx@...utronix.de" <tglx@...utronix.de>, "bp@...en8.de" <bp@...en8.de>,
"dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>
CC: "hpa@...or.com" <hpa@...or.com>, "ardb@...nel.org" <ardb@...nel.org>,
"david@...hat.com" <david@...hat.com>, "debarbos@...hat.com"
<debarbos@...hat.com>, "dzickus@...hat.com" <dzickus@...hat.com>,
"jlelli@...hat.com" <jlelli@...hat.com>,
NOMURA JUNICHI(野村 淳一)
<junichi.nomura@....com>, "kirill.shutemov@...ux.intel.com"
<kirill.shutemov@...ux.intel.com>, "lgoncalv@...hat.com"
<lgoncalv@...hat.com>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "nikunj@....com" <nikunj@....com>,
"thomas.lendacky@....com" <thomas.lendacky@....com>
Subject: [PATCH 2/2] x86/boot: Add a message about ignored early NMIs
Commit
78a509fba9c9 ("x86/boot: Ignore NMIs during very early boot")
added an empty handler in early boot stage to avoid boot failure due to
spurious NMIs.
Add a diagnostic message to show when early NMIs have occurred and/or
what happened to them.
[ bp: Touchups. ]
Suggested-by: Borislav Petkov <bp@...en8.de>
Suggested-by: H. Peter Anvin <hpa@...or.com>
Signed-off-by: Jun'ichi Nomura <junichi.nomura@....com>
Signed-off-by: Borislav Petkov (AMD) <bp@...en8.de>
Acked-by: Kirill A. Shutemov <kirill.shutemov@...ux.intel.com>
Link: https://lore.kernel.org/lkml/20231130103339.GCZWhlA196uRklTMNF@fat_crate.local
--
v2
* Moved variable declaration and definition to the right place
based on comments from Kirill.
No functional changes.
v3
* Removed comment and updated message in the NMI handler.
* Use error_putdec() helper.
diff --git a/arch/x86/boot/compressed/ident_map_64.c b/arch/x86/boot/compressed/ident_map_64.c
--- a/arch/x86/boot/compressed/ident_map_64.c
+++ b/arch/x86/boot/compressed/ident_map_64.c
@@ -389,5 +389,5 @@ void do_boot_page_fault(struct pt_regs *regs, unsigned long error_code)
void do_boot_nmi_trap(struct pt_regs *regs, unsigned long error_code)
{
- /* Empty handler to ignore NMI during early boot */
+ spurious_nmi_count++;
}
diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c
--- a/arch/x86/boot/compressed/misc.c
+++ b/arch/x86/boot/compressed/misc.c
@@ -52,6 +52,7 @@ struct port_io_ops pio_ops;
memptr free_mem_ptr;
memptr free_mem_end_ptr;
+int spurious_nmi_count;
static char *vidmem;
static int vidport;
@@ -493,6 +494,12 @@ asmlinkage __visible void *extract_kernel(void *rmode, unsigned char *output)
/* Disable exception handling before booting the kernel */
cleanup_exception_handling();
+ if (spurious_nmi_count) {
+ error_putstr("Spurious early NMIs ignored: ");
+ error_putdec(spurious_nmi_count);
+ error_putstr("\n");
+ }
+
return output + entry_offset;
}
diff --git a/arch/x86/boot/compressed/misc.h b/arch/x86/boot/compressed/misc.h
--- a/arch/x86/boot/compressed/misc.h
+++ b/arch/x86/boot/compressed/misc.h
@@ -59,6 +59,7 @@ extern char _head[], _end[];
/* misc.c */
extern memptr free_mem_ptr;
extern memptr free_mem_end_ptr;
+extern int spurious_nmi_count;
void *malloc(int size);
void free(void *where);
void __putstr(const char *s);
Powered by blists - more mailing lists