summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2015-12-12 12:47:50 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2015-12-12 12:47:50 +0000
commitf6dd223cb3bc982c1367d5144925095738b7af20 (patch)
treedba7cb4261439d392cfb7b47ddac02d5666102e7
parent00f7eb5513438c98e895cb5011ff61ca05ece336 (diff)
x2APIC is currently enabled on HV guests only, not on bare metal, to
speedup interrupt handling on virtual machines. Unfortunately it is broken on Xen 4.2 or older, so use the early pvbus detection to drop the advertised x2APIC CPU feature. Xen has fixed this in late 2013, but the problem still shows up in "the Cloud" (it doesn't seem to affect others as they either use legacy APIC or Xen IPIs). OK mlarkin@ mikeb@ Cvs: ----------------------------------------------------------------------
-rw-r--r--sys/dev/pv/pvbus.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/dev/pv/pvbus.c b/sys/dev/pv/pvbus.c
index 0dcd2eecded..91c7c622140 100644
--- a/sys/dev/pv/pvbus.c
+++ b/sys/dev/pv/pvbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pvbus.c,v 1.9 2015/12/12 12:33:49 reyk Exp $ */
+/* $OpenBSD: pvbus.c,v 1.10 2015/12/12 12:47:49 reyk Exp $ */
/*
* Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org>
@@ -262,6 +262,13 @@ pvbus_xen(struct pvbus_hv *hv)
regs[0], regs[1], regs[2], regs[3]);
hv->hv_major = regs[0] >> XEN_VERSION_MAJOR_S;
hv->hv_minor = regs[0] & XEN_VERSION_MINOR_M;
+
+ /* x2apic is broken in Xen 4.2 or older */
+ if ((hv->hv_major < 4) ||
+ (hv->hv_major == 4 && hv->hv_minor < 3)) {
+ /* Remove CPU flag for x2apic */
+ cpu_ecxfeature &= ~CPUIDECX_X2APIC;
+ }
}
void