summaryrefslogtreecommitdiffstats
path: root/sys/dev/pv/xen.c
diff options
context:
space:
mode:
authormikeb <mikeb@openbsd.org>2016-08-03 14:55:57 +0000
committermikeb <mikeb@openbsd.org>2016-08-03 14:55:57 +0000
commit4ef38d8395a08772f177cd28a89917eb0fc1960d (patch)
treecaa6aa1f3fd6018dd25bc382506e06e56f63df2b /sys/dev/pv/xen.c
parentFold umass_atapi_attach() and umass_scsi_setup() into umass_scsi_attach() to (diff)
downloadwireguard-openbsd-4ef38d8395a08772f177cd28a89917eb0fc1960d.tar.xz
wireguard-openbsd-4ef38d8395a08772f177cd28a89917eb0fc1960d.zip
Use an atomic operation to clear pending event bits
Pending event bits are located in a shared memory and are potentially accessed by multiple CPUs running dom0 and the guest VM. It appears that a failure to synchronize changes to this shared memory leads to race conditions resulting in the guest missing out on notifications.
Diffstat (limited to 'sys/dev/pv/xen.c')
-rw-r--r--sys/dev/pv/xen.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/dev/pv/xen.c b/sys/dev/pv/xen.c
index c12328cd0d1..8f4be60e649 100644
--- a/sys/dev/pv/xen.c
+++ b/sys/dev/pv/xen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xen.c,v 1.58 2016/08/01 14:37:39 mikeb Exp $ */
+/* $OpenBSD: xen.c,v 1.59 2016/08/03 14:55:57 mikeb Exp $ */
/*
* Copyright (c) 2015 Mike Belopuhov
@@ -633,8 +633,8 @@ xen_intr(void)
for (bit = 0; pending > 0; pending >>= 1, bit++) {
if ((pending & 1) == 0)
continue;
- sc->sc_ipg->evtchn_pending[row] &= ~(1 << bit);
- virtio_membar_producer();
+ atomic_clearbit_ptr(&sc->sc_ipg->evtchn_pending[row],
+ bit);
port = (row * LONG_BIT) + bit;
if ((xi = xen_lookup_intsrc(sc, port)) == NULL) {
printf("%s: unhandled interrupt on port %u\n",