summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMike Belopuhov <mikeb@cvs.openbsd.org>2017-02-08 16:51:27 +0000
committerMike Belopuhov <mikeb@cvs.openbsd.org>2017-02-08 16:51:27 +0000
commita95c6d32016c03f7fa69d772bfd48f3744ac914c (patch)
treecd8995c9cc4f6c9b40d044a2e707807193f0358c /sys
parentc89ffd9b8d1043bd3bf124090eb45f06a66d976a (diff)
Switch to Xen interrupt barrier and improve state transitions
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pv/xbf.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/sys/dev/pv/xbf.c b/sys/dev/pv/xbf.c
index 08c5350d121..3d43f95165c 100644
--- a/sys/dev/pv/xbf.c
+++ b/sys/dev/pv/xbf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xbf.c,v 1.19 2017/02/08 16:29:00 mikeb Exp $ */
+/* $OpenBSD: xbf.c,v 1.20 2017/02/08 16:51:26 mikeb Exp $ */
/*
* Copyright (c) 2016 Mike Belopuhov
@@ -309,12 +309,14 @@ int
xbf_detach(struct device *self, int flags)
{
struct xbf_softc *sc = (struct xbf_softc *)self;
+ int ostate = sc->sc_state;
- xen_intr_mask(sc->sc_xih);
+ sc->sc_state = XBF_CLOSING;
- intr_barrier(&sc->sc_xih);
+ xen_intr_mask(sc->sc_xih);
+ xen_intr_barrier(sc->sc_xih);
- if (sc->sc_state == XBF_CONNECTED) {
+ if (ostate == XBF_CONNECTED) {
xen_intr_disestablish(sc->sc_xih);
xbf_stop(sc);
}
@@ -974,8 +976,6 @@ xbf_init(struct xbf_softc *sc)
return (-1);
}
- sc->sc_state = XBF_CONNECTED;
-
action = "read";
prop = "sectors";
@@ -1020,6 +1020,8 @@ xbf_init(struct xbf_softc *sc)
return (-1);
}
+ sc->sc_state = XBF_CONNECTED;
+
return (0);
errout:
@@ -1244,8 +1246,6 @@ xbf_stop(struct xbf_softc *sc)
sc->sc_xs[desc] = NULL;
}
- sc->sc_state = XBF_CLOSING;
-
/* Give other processes a chance to run */
yield();