linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/apic/32: avoid bogus LDR warnings
@ 2019-10-29  9:34 Jan Beulich
  2019-11-04 23:22 ` [tip: x86/urgent] x86/apic/32: Avoid " tip-bot2 for Jan Beulich
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Beulich @ 2019-10-29  9:34 UTC (permalink / raw)
  To: the arch/x86 maintainers, Thomas Gleixner, Borislav Petkov,
	H. Peter Anvin, Ingo Molnar
  Cc: lkml, bsd

The removal of the LDR initialization for bigsmp has surfaced a warning per AP:

WARNING: CPU: 1 PID: 0 at arch/x86/kernel/apic/apic.c:1626 setup_local_APIC.cold+0x26/0x8c
Modules linked in:
Supported: No, Unreleased kernel
CPU: 1 PID: 0 Comm: swapper/1 Not tainted 5.3.4-2019-10-04-jb32 #3 SLE0 (unreleased)
Hardware name: Dell Inc. Precision Tower 7810/0GWHMW, BIOS A27 06/25/2018
EIP: setup_local_APIC.cold+0x5b/0xc5
Code: ...
EAX: 00000024 EBX: 00000000 ECX: c15947f8 EDX: 00200082
ESI: 00000002 EDI: 00000001 EBP: 00000000 ESP: e9887f38
DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068 EFLAGS: 00210096
CR0: 80050033 CR2: 00000000 CR3: 0164f000 CR4: 001406b0
Call Trace:
 ? vprintk_default+0xf/0x20
 ? fpu__init_cpu_generic+0x5c/0x60
 ? cpu_init+0x174/0x330
 ? apic_ap_setup+0x5/0x10
 ? start_secondary+0x4d/0x180
 ? startup_32_smp+0x164/0x168

Only do the check and override when the APIC is actually run in a setup
using logical destination mode.

Fixes: bae3a8d3308 ("x86/apic: Do not initialize LDR and DFR for bigsmp")
Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -1586,9 +1586,6 @@ static void setup_local_APIC(void)
 {
 	int cpu = smp_processor_id();
 	unsigned int value;
-#ifdef CONFIG_X86_32
-	int logical_apicid, ldr_apicid;
-#endif
 
 	if (disable_apic) {
 		disable_ioapic_support();
@@ -1626,16 +1623,21 @@ static void setup_local_APIC(void)
 	apic->init_apic_ldr();
 
 #ifdef CONFIG_X86_32
-	/*
-	 * APIC LDR is initialized.  If logical_apicid mapping was
-	 * initialized during get_smp_config(), make sure it matches the
-	 * actual value.
-	 */
-	logical_apicid = early_per_cpu(x86_cpu_to_logical_apicid, cpu);
-	ldr_apicid = GET_APIC_LOGICAL_ID(apic_read(APIC_LDR));
-	WARN_ON(logical_apicid != BAD_APICID && logical_apicid != ldr_apicid);
-	/* always use the value from LDR */
-	early_per_cpu(x86_cpu_to_logical_apicid, cpu) = ldr_apicid;
+	if (apic->dest_logical) {
+		int logical_apicid, ldr_apicid;
+
+		/*
+		 * APIC LDR is initialized.  If logical_apicid mapping was
+		 * initialized during get_smp_config(), make sure it matches
+		 * the actual value.
+		 */
+		logical_apicid = early_per_cpu(x86_cpu_to_logical_apicid, cpu);
+		ldr_apicid = GET_APIC_LOGICAL_ID(apic_read(APIC_LDR));
+		if (logical_apicid != BAD_APICID)
+			WARN_ON(logical_apicid != ldr_apicid);
+		/* Always use the value from LDR. */
+		early_per_cpu(x86_cpu_to_logical_apicid, cpu) = ldr_apicid;
+	}
 #endif
 
 	/*

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [tip: x86/urgent] x86/apic/32: Avoid bogus LDR warnings
  2019-10-29  9:34 [PATCH] x86/apic/32: avoid bogus LDR warnings Jan Beulich
@ 2019-11-04 23:22 ` tip-bot2 for Jan Beulich
  0 siblings, 0 replies; 2+ messages in thread
From: tip-bot2 for Jan Beulich @ 2019-11-04 23:22 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Jan Beulich, Thomas Gleixner, stable, Ingo Molnar,
	Borislav Petkov, linux-kernel

The following commit has been merged into the x86/urgent branch of tip:

Commit-ID:     fe6f85ca121e9c74e7490fe66b0c5aae38e332c3
Gitweb:        https://git.kernel.org/tip/fe6f85ca121e9c74e7490fe66b0c5aae38e332c3
Author:        Jan Beulich <jbeulich@suse.com>
AuthorDate:    Tue, 29 Oct 2019 10:34:19 +01:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Tue, 05 Nov 2019 00:11:00 +01:00

x86/apic/32: Avoid bogus LDR warnings

The removal of the LDR initialization in the bigsmp_32 APIC code unearthed
a problem in setup_local_APIC().

The code checks unconditionally for a mismatch of the logical APIC id by
comparing the early APIC id which was initialized in get_smp_config() with
the actual LDR value in the APIC.

Due to the removal of the bogus LDR initialization the check now can
trigger on bigsmp_32 APIC systems emitting a warning for every booting
CPU. This is of course a false positive because the APIC is not using
logical destination mode.

Restrict the check and the possibly resulting fixup to systems which are
actually using the APIC in logical destination mode.

[ tglx: Massaged changelog and added Cc stable ]

Fixes: bae3a8d3308 ("x86/apic: Do not initialize LDR and DFR for bigsmp")
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/666d8f91-b5a8-1afd-7add-821e72a35f03@suse.com
---
 arch/x86/kernel/apic/apic.c | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index 9e2dd2b..2b0faf8 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -1586,9 +1586,6 @@ static void setup_local_APIC(void)
 {
 	int cpu = smp_processor_id();
 	unsigned int value;
-#ifdef CONFIG_X86_32
-	int logical_apicid, ldr_apicid;
-#endif
 
 	if (disable_apic) {
 		disable_ioapic_support();
@@ -1626,16 +1623,21 @@ static void setup_local_APIC(void)
 	apic->init_apic_ldr();
 
 #ifdef CONFIG_X86_32
-	/*
-	 * APIC LDR is initialized.  If logical_apicid mapping was
-	 * initialized during get_smp_config(), make sure it matches the
-	 * actual value.
-	 */
-	logical_apicid = early_per_cpu(x86_cpu_to_logical_apicid, cpu);
-	ldr_apicid = GET_APIC_LOGICAL_ID(apic_read(APIC_LDR));
-	WARN_ON(logical_apicid != BAD_APICID && logical_apicid != ldr_apicid);
-	/* always use the value from LDR */
-	early_per_cpu(x86_cpu_to_logical_apicid, cpu) = ldr_apicid;
+	if (apic->dest_logical) {
+		int logical_apicid, ldr_apicid;
+
+		/*
+		 * APIC LDR is initialized.  If logical_apicid mapping was
+		 * initialized during get_smp_config(), make sure it matches
+		 * the actual value.
+		 */
+		logical_apicid = early_per_cpu(x86_cpu_to_logical_apicid, cpu);
+		ldr_apicid = GET_APIC_LOGICAL_ID(apic_read(APIC_LDR));
+		if (logical_apicid != BAD_APICID)
+			WARN_ON(logical_apicid != ldr_apicid);
+		/* Always use the value from LDR. */
+		early_per_cpu(x86_cpu_to_logical_apicid, cpu) = ldr_apicid;
+	}
 #endif
 
 	/*

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-11-04 23:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-29  9:34 [PATCH] x86/apic/32: avoid bogus LDR warnings Jan Beulich
2019-11-04 23:22 ` [tip: x86/urgent] x86/apic/32: Avoid " tip-bot2 for Jan Beulich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).