Skip to content

Commit fe6f85c

Browse files
jbeulichKAGA-KOKO
authored andcommitted
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: bae3a8d ("x86/apic: Do not initialize LDR and DFR for bigsmp") Signed-off-by: Jan Beulich <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Cc: [email protected] Link: https://lkml.kernel.org/r/[email protected]
1 parent 26467b0 commit fe6f85c

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

arch/x86/kernel/apic/apic.c

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1586,9 +1586,6 @@ static void setup_local_APIC(void)
15861586
{
15871587
int cpu = smp_processor_id();
15881588
unsigned int value;
1589-
#ifdef CONFIG_X86_32
1590-
int logical_apicid, ldr_apicid;
1591-
#endif
15921589

15931590
if (disable_apic) {
15941591
disable_ioapic_support();
@@ -1626,16 +1623,21 @@ static void setup_local_APIC(void)
16261623
apic->init_apic_ldr();
16271624

16281625
#ifdef CONFIG_X86_32
1629-
/*
1630-
* APIC LDR is initialized. If logical_apicid mapping was
1631-
* initialized during get_smp_config(), make sure it matches the
1632-
* actual value.
1633-
*/
1634-
logical_apicid = early_per_cpu(x86_cpu_to_logical_apicid, cpu);
1635-
ldr_apicid = GET_APIC_LOGICAL_ID(apic_read(APIC_LDR));
1636-
WARN_ON(logical_apicid != BAD_APICID && logical_apicid != ldr_apicid);
1637-
/* always use the value from LDR */
1638-
early_per_cpu(x86_cpu_to_logical_apicid, cpu) = ldr_apicid;
1626+
if (apic->dest_logical) {
1627+
int logical_apicid, ldr_apicid;
1628+
1629+
/*
1630+
* APIC LDR is initialized. If logical_apicid mapping was
1631+
* initialized during get_smp_config(), make sure it matches
1632+
* the actual value.
1633+
*/
1634+
logical_apicid = early_per_cpu(x86_cpu_to_logical_apicid, cpu);
1635+
ldr_apicid = GET_APIC_LOGICAL_ID(apic_read(APIC_LDR));
1636+
if (logical_apicid != BAD_APICID)
1637+
WARN_ON(logical_apicid != ldr_apicid);
1638+
/* Always use the value from LDR. */
1639+
early_per_cpu(x86_cpu_to_logical_apicid, cpu) = ldr_apicid;
1640+
}
16391641
#endif
16401642

16411643
/*

0 commit comments

Comments
 (0)