From: "NOMURA JUNICHI(野村 淳一)" <junichi.nomura@nec.com>
To: "kirill.shutemov@linux.intel.com"
<kirill.shutemov@linux.intel.com>,
"mingo@redhat.com" <mingo@redhat.com>,
"tglx@linutronix.de" <tglx@linutronix.de>,
"bp@alien8.de" <bp@alien8.de>,
"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>,
"x86@kernel.org" <x86@kernel.org>
Cc: "hpa@zytor.com" <hpa@zytor.com>,
"ardb@kernel.org" <ardb@kernel.org>,
"david@redhat.com" <david@redhat.com>,
"nikunj@amd.com" <nikunj@amd.com>,
"thomas.lendacky@amd.com" <thomas.lendacky@amd.com>,
"debarbos@redhat.com" <debarbos@redhat.com>,
"jlelli@redhat.com" <jlelli@redhat.com>,
"lgoncalv@redhat.com" <lgoncalv@redhat.com>,
"dzickus@redhat.com" <dzickus@redhat.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [PATCH v2] x86/boot: Add a message about ignored early NMIs
Date: Mon, 15 Jan 2024 08:57:45 +0000 [thread overview]
Message-ID: <ZaTziftQSSg/v5Np@jeru.linux.bs1.fc.nec.co.jp> (raw)
In-Reply-To: <20240112120616.5zjojjmjeqg5egb7@box>
Commit 78a509fba9c9 ("x86/boot: Ignore NMIs during very early boot") added
empty handler in early boot stage to avoid boot failure by spurious NMIs.
Add a diagnostic message in case we need to know whether early NMIs have
occurred and/or what happened to them.
Signed-off-by: Jun'ichi Nomura <junichi.nomura@nec.com>
Suggested-by: Borislav Petkov <bp@alien8.de>
Suggested-by: H. Peter Anvin <hpa@zytor.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.
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
@@ -390,4 +390,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 NMI ignored. Number of NMIs: 0x");
+ error_puthex(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);
next prev parent reply other threads:[~2024-01-15 8:57 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-12 11:13 [PATCH repost] x86/boot: Add a message about ignored early NMIs NOMURA JUNICHI(野村 淳一)
2024-01-12 12:06 ` kirill.shutemov
2024-01-15 8:57 ` NOMURA JUNICHI(野村 淳一) [this message]
2024-01-15 10:14 ` [PATCH v2] " kirill.shutemov
2024-01-23 11:26 ` Borislav Petkov
2024-01-24 11:44 ` NOMURA JUNICHI(野村 淳一)
2024-01-25 2:00 ` H. Peter Anvin
2024-01-26 2:15 ` NOMURA JUNICHI(野村 淳一)
2024-02-01 17:22 ` H. Peter Anvin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZaTziftQSSg/v5Np@jeru.linux.bs1.fc.nec.co.jp \
--to=junichi.nomura@nec.com \
--cc=ardb@kernel.org \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=david@redhat.com \
--cc=debarbos@redhat.com \
--cc=dzickus@redhat.com \
--cc=hpa@zytor.com \
--cc=jlelli@redhat.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=lgoncalv@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=nikunj@amd.com \
--cc=tglx@linutronix.de \
--cc=thomas.lendacky@amd.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.