linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: the arch/x86 maintainers <x86@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Borislav Petkov <bp@alien8.de>, "H. Peter Anvin" <hpa@zytor.com>,
	Ingo Molnar <mingo@redhat.com>
Cc: lkml <linux-kernel@vger.kernel.org>, bsd@redhat.com
Subject: [PATCH] x86/apic/32: avoid bogus LDR warnings
Date: Tue, 29 Oct 2019 10:34:19 +0100	[thread overview]
Message-ID: <666d8f91-b5a8-1afd-7add-821e72a35f03@suse.com> (raw)

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
 
 	/*

             reply	other threads:[~2019-10-29  9:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-29  9:34 Jan Beulich [this message]
2019-11-04 23:22 ` [tip: x86/urgent] x86/apic/32: Avoid bogus LDR warnings tip-bot2 for Jan Beulich

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=666d8f91-b5a8-1afd-7add-821e72a35f03@suse.com \
    --to=jbeulich@suse.com \
    --cc=bp@alien8.de \
    --cc=bsd@redhat.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --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 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).