Skip to content

Commit 384d9fe

Browse files
PandaWeiIngo Molnar
authored andcommitted
x86/smpboot: Check APIC ID before setting up default routing
This is not a bugfix, but code optimization. If the BSP's APIC ID in local APIC is unexpected, a kernel panic will occur and the system will halt. That means no need to enable APIC mode, and no reason to set up the default routing for APIC. The combination of default_setup_apic_routing() and apic_bsp_setup() are used to enable APIC mode. They two should be kept together, rather than being separated by the codes of checking APIC ID. Just like their usage in APIC_init_uniprocessor(). Signed-off-by: Wei Jiangang <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: [email protected] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent 624cad9 commit 384d9fe

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

arch/x86/kernel/smpboot.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1316,14 +1316,13 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus)
13161316
break;
13171317
}
13181318

1319-
default_setup_apic_routing();
1320-
13211319
if (read_apic_id() != boot_cpu_physical_apicid) {
13221320
panic("Boot APIC ID in local APIC unexpected (%d vs %d)",
13231321
read_apic_id(), boot_cpu_physical_apicid);
13241322
/* Or can we switch back to PIC here? */
13251323
}
13261324

1325+
default_setup_apic_routing();
13271326
cpu0_logical_apicid = apic_bsp_setup(false);
13281327

13291328
pr_info("CPU%d: ", 0);

0 commit comments

Comments
 (0)