Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Jul 2016 06:30:29 +0000 (UTC)
From:      Sepherosa Ziehau <sephe@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r303421 - head/sys/dev/hyperv/vmbus
Message-ID:  <201607280630.u6S6UTnR008005@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201607280630.u6S6UTnR008005>