Author: sephe
Date: Thu Jul 28 06:30:29 2016
New Revision: 303421
URL: https://svnweb.freebsd.org/changeset/base/303421

Log:
  hyperv/vmbus: Avoid unnecessary mb()
  
  MFC after:    1 week
  Sponsored by: Microsoft
  Differential Revision:        https://reviews.freebsd.org/D7333

Modified:
  head/sys/dev/hyperv/vmbus/vmbus_br.c

Modified: head/sys/dev/hyperv/vmbus/vmbus_br.c
==============================================================================
--- head/sys/dev/hyperv/vmbus/vmbus_br.c        Thu Jul 28 05:59:56 2016        
(r303420)
+++ head/sys/dev/hyperv/vmbus/vmbus_br.c        Thu Jul 28 06:30:29 2016        
(r303421)
@@ -209,9 +209,7 @@ vmbus_txbr_need_signal(const struct vmbu
        if (tbr->txbr_imask)
                return (FALSE);
 
-       /* XXX only compiler fence is needed */
-       /* Read memory barrier */
-       rmb();
+       __compiler_membar();
 
        /*
         * This is the only case we need to signal when the
@@ -308,15 +306,10 @@ vmbus_txbr_write(struct vmbus_txbr *tbr,
            sizeof(save_windex));
 
        /*
-        * XXX only compiler fence is needed.
-        * Full memory barrier before upding the write index. 
-        */
-       mb();
-
-       /*
         * Update the write index _after_ the channel packet
         * is copied.
         */
+       __compiler_membar();
        tbr->txbr_windex = windex;
 
        mtx_unlock_spin(&tbr->txbr_lock);
@@ -396,16 +389,9 @@ vmbus_rxbr_read(struct vmbus_rxbr *rbr, 
        rindex = VMBUS_BR_IDXINC(rindex, sizeof(uint64_t), br_dsize);
 
        /*
-        * XXX only compiler fence is needed.
-        * Make sure all reads are done before we update the read index since
-        * the writer may start writing to the read area once the read index
-        * is updated.
-        */
-       wmb();
-
-       /*
         * Update the read index _after_ the channel packet is fetched.
         */
+       __compiler_membar();
        rbr->rxbr_rindex = rindex;
 
        mtx_unlock_spin(&rbr->rxbr_lock);
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to