summaryrefslogtreecommitdiffstats
path: root/sys/amd64/amd64/mp_machdep.c
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2015-02-28 20:37:38 +0000
committerkib <kib@FreeBSD.org>2015-02-28 20:37:38 +0000
commit59184505da6e3986b6abaa831f82cf1758e562e3 (patch)
tree4aae09332a81222208bfe151c133df848753c6bd /sys/amd64/amd64/mp_machdep.c
parent359d7dfbbb2e410c9e331d28f42af00ba8db6fef (diff)
downloadFreeBSD-src-59184505da6e3986b6abaa831f82cf1758e562e3.zip
FreeBSD-src-59184505da6e3986b6abaa831f82cf1758e562e3.tar.gz
Supposed fix for some SandyBridge mobile CPUs hang on AP startup when
x2APIC mode is detected and enabled. Current theory is that switching the APIC mode while an IPI is in flight might be the issue. Postpone switching to x2APIC mode until we are guaranteed that all starting IPIs are already send and aknowledged. Use aps_ready signal as an indication that the BSP is done with us. Tested by: adrian Sponsored by: The FreeBSD Foundation MFC after: 2 months
Diffstat (limited to 'sys/amd64/amd64/mp_machdep.c')
-rw-r--r--sys/amd64/amd64/mp_machdep.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c
index b767691..b836b0d 100644
--- a/sys/amd64/amd64/mp_machdep.c
+++ b/sys/amd64/amd64/mp_machdep.c
@@ -705,12 +705,6 @@ init_secondary(void)
wrmsr(MSR_STAR, msr);
wrmsr(MSR_SF_MASK, PSL_NT|PSL_T|PSL_I|PSL_C|PSL_D);
- /*
- * On real hardware, switch to x2apic mode if possible.
- * Disable local APIC until BSP directed APs to run.
- */
- lapic_xapic_mode();
-
/* signal our startup to the BSP. */
mp_naps++;
@@ -718,6 +712,14 @@ init_secondary(void)
while (!aps_ready)
ia32_pause();
+ /*
+ * On real hardware, switch to x2apic mode if possible. Do it
+ * after aps_ready was signalled, to avoid manipulating the
+ * mode while BSP might still want to send some IPI to us
+ * (second startup IPI is ignored on modern hardware etc).
+ */
+ lapic_xapic_mode();
+
/* Initialize the PAT MSR. */
pmap_init_pat();
OpenPOWER on IntegriCloud