summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsephe <sephe@FreeBSD.org>2017-01-04 05:41:47 +0000
committersephe <sephe@FreeBSD.org>2017-01-04 05:41:47 +0000
commit04973180f7b0e190415ee40fce0f7754aa86f2f3 (patch)
tree96878184591a91f8527edaffb588b7a542004288
parent51d962a914e0ee835921fb0c15f2d9f4635b3afb (diff)
downloadFreeBSD-src-04973180f7b0e190415ee40fce0f7754aa86f2f3.zip
FreeBSD-src-04973180f7b0e190415ee40fce0f7754aa86f2f3.tar.gz
MFC 310651
hyperv/vmbus: Nuke unnecessary critical sections. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8906
-rw-r--r--sys/dev/hyperv/vmbus/vmbus.c4
-rw-r--r--sys/dev/hyperv/vmbus/vmbus_chan.c20
-rw-r--r--sys/dev/hyperv/vmbus/vmbus_var.h2
3 files changed, 12 insertions, 14 deletions
diff --git a/sys/dev/hyperv/vmbus/vmbus.c b/sys/dev/hyperv/vmbus/vmbus.c
index 2c824f7..ec33dd8 100644
--- a/sys/dev/hyperv/vmbus/vmbus.c
+++ b/sys/dev/hyperv/vmbus/vmbus.c
@@ -1472,7 +1472,7 @@ cleanup:
vmbus_xact_ctx_destroy(sc->vmbus_xc);
sc->vmbus_xc = NULL;
}
- free(sc->vmbus_chmap, M_DEVBUF);
+ free(__DEVOLATILE(void *, sc->vmbus_chmap), M_DEVBUF);
mtx_destroy(&sc->vmbus_prichan_lock);
mtx_destroy(&sc->vmbus_chan_lock);
@@ -1534,7 +1534,7 @@ vmbus_detach(device_t dev)
sc->vmbus_xc = NULL;
}
- free(sc->vmbus_chmap, M_DEVBUF);
+ free(__DEVOLATILE(void *, sc->vmbus_chmap), M_DEVBUF);
mtx_destroy(&sc->vmbus_prichan_lock);
mtx_destroy(&sc->vmbus_chan_lock);
diff --git a/sys/dev/hyperv/vmbus/vmbus_chan.c b/sys/dev/hyperv/vmbus/vmbus_chan.c
index fe37464..dc0846c 100644
--- a/sys/dev/hyperv/vmbus/vmbus_chan.c
+++ b/sys/dev/hyperv/vmbus/vmbus_chan.c
@@ -775,9 +775,7 @@ vmbus_chan_clrchmap_task(void *xchan, int pending __unused)
{
struct vmbus_channel *chan = xchan;
- critical_enter();
chan->ch_vmbus->vmbus_chmap[chan->ch_id] = NULL;
- critical_exit();
}
static void
@@ -1308,15 +1306,17 @@ vmbus_chan_pollcfg_task(void *xarg, int pending __unused)
chan->ch_poll_flags = poll_flags;
/*
- * Disable interrupt from the RX bufring (TX bufring does not
- * generate interrupt to VM), and disconnect this channel from
- * the channel map to make sure that ISR can not enqueue this
- * channel task anymore.
+ * Disconnect this channel from the channel map to make sure that
+ * the RX bufring interrupt enabling bit can not be touched, and
+ * ISR can not enqueue this channel task anymore. THEN, disable
+ * interrupt from the RX bufring (TX bufring does not generate
+ * interrupt to VM).
+ *
+ * NOTE: order is critical.
*/
- critical_enter();
- vmbus_rxbr_intr_mask(&chan->ch_rxbr);
chan->ch_vmbus->vmbus_chmap[chan->ch_id] = NULL;
- critical_exit();
+ __compiler_membar();
+ vmbus_rxbr_intr_mask(&chan->ch_rxbr);
/*
* NOTE:
@@ -1380,11 +1380,9 @@ vmbus_chan_polldis_task(void *xchan, int pending __unused)
* Plug this channel back to the channel map and unmask
* the RX bufring interrupt.
*/
- critical_enter();
chan->ch_vmbus->vmbus_chmap[chan->ch_id] = chan;
__compiler_membar();
vmbus_rxbr_intr_unmask(&chan->ch_rxbr);
- critical_exit();
/*
* Kick start the interrupt task, just in case unmasking
diff --git a/sys/dev/hyperv/vmbus/vmbus_var.h b/sys/dev/hyperv/vmbus/vmbus_var.h
index cd9fb33..530883d 100644
--- a/sys/dev/hyperv/vmbus/vmbus_var.h
+++ b/sys/dev/hyperv/vmbus/vmbus_var.h
@@ -92,7 +92,7 @@ struct vmbus_softc {
u_long *vmbus_rx_evtflags;
/* compat evtflgs from host */
- struct vmbus_channel **vmbus_chmap;
+ struct vmbus_channel *volatile *vmbus_chmap;
struct vmbus_xact_ctx *vmbus_xc;
struct vmbus_pcpu_data vmbus_pcpu[MAXCPU];
OpenPOWER on IntegriCloud