[PATCH] x86/apic: Silence LAPIC kernel warning on early boot

Eric Schikschneit posted 1 patch 2 months, 1 week ago
arch/x86/kernel/apic/apic.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
[PATCH] x86/apic: Silence LAPIC kernel warning on early boot
Posted by Eric Schikschneit 2 months, 1 week ago
The code currently issues the user a warning unconditionally:

WARNING: CPU: 0 PID: 0 at /arch/x86/kernel/apic/apic.c:2129
	register_lapic_address+0x3d/0x50
Modules linked in:
CPU: 0 PID: 0 Comm: swapper Not tainted 6.6.62-rt31-yocto-preempt-rt #1
RIP: 0010:register_lapic_address+0x3d/0x50
Call Trace:
 <TASK>
 ? show_regs+0x69/0x80
 ? __warn+0x8e/0x160
 ? register_lapic_address+0x3d/0x50
 ? report_bug+0x171/0x1a0
 ? early_fixup_exception+0xb8/0xd0
 ? do_early_exception+0x1f/0x60
 ? early_idt_handler_common+0x2f/0x40
 ? register_lapic_address+0x3d/0x50
 ? register_lapic_address+0x9/0x50
 ? x86_dtb_init+0xdc/0x2f0
 ? __pfx_acpi_parse_lapic+0x10/0x10
 setup_arch+0x8e1/0xd70
 start_kernel+0x66/0x6e0
 x86_64_start_reservations+0x1c/0x30
 x86_64_start_kernel+0xce/0xe0
 secondary_startup_64_no_verify+0x18a/0x18b
 </TASK>

This warning may lead users to believe they have a early kernel panic,
or major issue stemming from BIOS. This can be avoided unless the
kernel is being passed a non-default value for LAPIC address.

Fixes: 81287ad65da5b8 ("x86/apic: Sanitize APIC address setup")
Signed-off-by: Eric Schikschneit <eric.schikschneit@novatechautomation.com>
---
 arch/x86/kernel/apic/apic.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index d73ba5a7b623..e71cc6f776fe 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -2078,7 +2078,9 @@ static __init void apic_set_fixmap(bool read_apic)
 void __init register_lapic_address(unsigned long address)
 {
 	/* This should only happen once */
-	WARN_ON_ONCE(mp_lapic_addr);
+	if (address != APIC_DEFAULT_PHYS_BASE)
+		WARN_ON_ONCE(mp_lapic_addr);
+
 	mp_lapic_addr = address;
 
 	if (!x2apic_mode)
-- 
2.43.0