Skip to content

Commit 888152f

Browse files
reykmarcopeereboom
authored andcommitted
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: ----------------------------------------------------------------------
1 parent a4fa2ad commit 888152f

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

sys/dev/pv/pvbus.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: pvbus.c,v 1.9 2015/12/12 12:33:49 reyk Exp $ */
1+
/* $OpenBSD: pvbus.c,v 1.10 2015/12/12 12:47:49 reyk Exp $ */
22

33
/*
44
* Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org>
@@ -262,6 +262,13 @@ pvbus_xen(struct pvbus_hv *hv)
262262
regs[0], regs[1], regs[2], regs[3]);
263263
hv->hv_major = regs[0] >> XEN_VERSION_MAJOR_S;
264264
hv->hv_minor = regs[0] & XEN_VERSION_MINOR_M;
265+
266+
/* x2apic is broken in Xen 4.2 or older */
267+
if ((hv->hv_major < 4) ||
268+
(hv->hv_major == 4 && hv->hv_minor < 3)) {
269+
/* Remove CPU flag for x2apic */
270+
cpu_ecxfeature &= ~CPUIDECX_X2APIC;
271+
}
265272
}
266273

267274
void

0 commit comments

Comments
 (0)