svn commit: r333026 - head/sys/x86/x86
Konstantin Belousov
kib at FreeBSD.org
Thu Apr 26 18:24:32 UTC 2018
Author: kib
Date: Thu Apr 26 18:24:31 2018
New Revision: 333026
URL: https://svnweb.freebsd.org/changeset/base/333026
Log:
Handle Appolo Lake errata APL31.
If the workaround is activated, always send IPI for wake up, not rely
on the write to the monitor line. This fixes Appolo Lake machines
early hang in sched_bind(), without requiring user to manually select
idle method.
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Modified:
head/sys/x86/x86/cpu_machdep.c
Modified: head/sys/x86/x86/cpu_machdep.c
==============================================================================
--- head/sys/x86/x86/cpu_machdep.c Thu Apr 26 18:12:40 2018 (r333025)
+++ head/sys/x86/x86/cpu_machdep.c Thu Apr 26 18:24:31 2018 (r333026)
@@ -575,6 +575,11 @@ out:
busy, curcpu);
}
+static int cpu_idle_apl31_workaround;
+SYSCTL_INT(_machdep, OID_AUTO, idle_apl31, CTLFLAG_RW,
+ &cpu_idle_apl31_workaround, 0,
+ "Appolo Lake APL31 MWAIT bug workaround");
+
int
cpu_idle_wakeup(int cpu)
{
@@ -586,7 +591,7 @@ cpu_idle_wakeup(int cpu)
return (0);
case STATE_MWAIT:
atomic_store_int(state, STATE_RUNNING);
- return (1);
+ return (cpu_idle_apl31_workaround ? 0 : 1);
case STATE_RUNNING:
return (1);
default:
@@ -689,6 +694,13 @@ cpu_idle_tun(void *unused __unused)
if (TUNABLE_STR_FETCH("machdep.idle", tunvar, sizeof(tunvar)))
cpu_idle_selector(tunvar);
+ if (cpu_vendor_id == CPU_VENDOR_INTEL && cpu_id == 0x506c9) {
+ /*
+ * Appolo Lake errata APL31.
+ */
+ cpu_idle_apl31_workaround = 1;
+ }
+ TUNABLE_INT_FETCH("machdep.idle_apl31", &cpu_idle_apl31_workaround);
}
SYSINIT(cpu_idle_tun, SI_SUB_CPU, SI_ORDER_MIDDLE, cpu_idle_tun, NULL);
More information about the svn-src-head
mailing list