diff options
author | Mike Belopuhov <mikeb@cvs.openbsd.org> | 2018-01-21 18:54:47 +0000 |
---|---|---|
committer | Mike Belopuhov <mikeb@cvs.openbsd.org> | 2018-01-21 18:54:47 +0000 |
commit | 41e07dcccfba5f010784d152760d4f90b89483bd (patch) | |
tree | 8e7efbe9119e3929d7961f7fd81b2216c8d5b53d /sys/dev/pv | |
parent | 059df3f29c4e28d06a8c77722e41eda688b888cf (diff) |
Release interrupt source if the interrupt task is already scheduled
Tested by Imre Oolberg, thanks!
Diffstat (limited to 'sys/dev/pv')
-rw-r--r-- | sys/dev/pv/xen.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/dev/pv/xen.c b/sys/dev/pv/xen.c index 3555f83a313..a2a63537378 100644 --- a/sys/dev/pv/xen.c +++ b/sys/dev/pv/xen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xen.c,v 1.92 2018/01/21 18:51:19 mikeb Exp $ */ +/* $OpenBSD: xen.c,v 1.93 2018/01/21 18:54:46 mikeb Exp $ */ /* * Copyright (c) 2015, 2016, 2017 Mike Belopuhov @@ -600,7 +600,7 @@ xen_intsrc_add(struct xen_softc *sc, struct xen_intsrc *xi) static inline struct xen_intsrc * xen_intsrc_acquire(struct xen_softc *sc, evtchn_port_t port) { - struct xen_intsrc *xi; + struct xen_intsrc *xi = NULL; mtx_enter(&sc->sc_islck); SLIST_FOREACH(xi, &sc->sc_intrs, xi_entry) { @@ -713,8 +713,10 @@ xen_intr_schedule(xen_intr_handle_t xih) struct xen_softc *sc = xen_sc; struct xen_intsrc *xi; - if ((xi = xen_intsrc_acquire(sc, (evtchn_port_t)xih)) != NULL) - task_add(xi->xi_taskq, &xi->xi_task); + if ((xi = xen_intsrc_acquire(sc, (evtchn_port_t)xih)) != NULL) { + if (!task_add(xi->xi_taskq, &xi->xi_task)) + xen_intsrc_release(sc, xi); + } } /* |