This patch fixes my bug in 4.4.206:
https://bugzilla.kernel.org/show_bug.cgi?id=205729
It could use testing by someone who exercises the code in a virtual machine environment...
-----------------------------------------------------------------------------------
From: Jan Beulich jbeulich@suse.com
[ Upstream commit fe6f85ca121e9c74e7490fe66b0c5aae38e332c3 ]
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 [ comet.berkeley: Backported to 4.4: adjust context ] Signed-off-by: Richard Narron comet.berkeley@gmail.com
--- a/arch/x86/kernel/apic/apic.c.orig 2019-11-29 00:30:25.000000000 -0800 +++ b/arch/x86/kernel/apic/apic.c 2019-12-04 07:47:16.913136344 -0800 @@ -1298,16 +1298,21 @@ 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. - */ - i = early_per_cpu(x86_cpu_to_logical_apicid, cpu); - WARN_ON(i != BAD_APICID && i != logical_smp_processor_id()); - /* always use the value from LDR */ - early_per_cpu(x86_cpu_to_logical_apicid, cpu) = - logical_smp_processor_id(); + 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
/*
On Fri, Dec 06, 2019 at 05:40:10AM -0800, Richard Narron wrote:
This patch fixes my bug in 4.4.206:
https://bugzilla.kernel.org/show_bug.cgi?id=205729
It could use testing by someone who exercises the code in a virtual machine environment...
Now queued up, thanks.
greg k-h
linux-stable-mirror@lists.linaro.org