[firefly] [PATCH] lguest: remove additional compiler memory barrier.

Cosmin Paraschiv csmnprschv at gmail.com
Sun Apr 21 22:58:12 EEST 2013


Using two compiler memory barriers is unnecessary. As the wmb variant
tends to suggest a CPU memory barrier, remove that one.

Signed-off-by: Cosmin Paraschiv <csmnprschv at gmail.com>
---
 tools/lguest/lguest.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/tools/lguest/lguest.c b/tools/lguest/lguest.c
index 07a0345..5897669 100644
--- a/tools/lguest/lguest.c
+++ b/tools/lguest/lguest.c
@@ -176,7 +176,6 @@ static struct termios orig_term;
  * threads and so we need to make sure that changes visible to the Guest happen
  * in precise order.
  */
-#define wmb() __asm__ __volatile__("" : : : "memory")
 #define mb() __asm__ __volatile__("" : : : "memory")
 
 /* Wrapper for the last available index.  Makes it easier to change. */
@@ -593,7 +592,7 @@ static unsigned next_desc(struct vring_desc *desc,
 	/* Check they're not leading us off end of descriptors. */
 	next = desc[i].next;
 	/* Make sure compiler knows to grab that: we don't want it changing! */
-	wmb();
+	mb();
 
 	if (next >= max)
 		errx(1, "Desc next is %u", next);
@@ -750,7 +749,7 @@ static void add_used(struct virtqueue *vq, unsigned int head, int len)
 	used->id = head;
 	used->len = len;
 	/* Make sure buffer is written before we update index. */
-	wmb();
+	mb();
 	vq->vring.used->idx++;
 	vq->pending_used++;
 }
-- 
1.7.9.5



More information about the firefly mailing list