diff options
author | 2016-08-03 14:55:57 +0000 | |
---|---|---|
committer | 2016-08-03 14:55:57 +0000 | |
commit | 4ef38d8395a08772f177cd28a89917eb0fc1960d (patch) | |
tree | caa6aa1f3fd6018dd25bc382506e06e56f63df2b /sys/dev/pv/xen.c | |
parent | Fold umass_atapi_attach() and umass_scsi_setup() into umass_scsi_attach() to (diff) | |
download | wireguard-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.c | 6 |
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", |