[Spice-commits] spice/barrier.h

Christophe Fergau teuf at kemper.freedesktop.org
Fri Jan 8 06:31:52 PST 2016


 spice/barrier.h |    7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

New commits:
commit 6b86c1a510f333f53a6955cd09da16fd98731d02
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Wed Apr 10 13:59:34 2013 +0200

    Use gcc builtin rather than asm for memory barriers
    
    This should make things more portable.
    
    On my machine, __sync_synchronize() uses mfence rather than lock; addl;
    Looking at the kernel memory barriers, this should be fine:
    http://lxr.free-electrons.com/source/arch/x86/um/asm/barrier.h
    
    The kernel favours using mfence, but falls back to lock; addl; when it's
    not available (32 bit non-SSE machines).
    
    https://bugs.freedesktop.org/show_bug.cgi?id=86997

diff --git a/spice/barrier.h b/spice/barrier.h
index 710da09..7d63721 100644
--- a/spice/barrier.h
+++ b/spice/barrier.h
@@ -34,12 +34,7 @@
 
 #ifdef __GNUC__
 
-#ifdef __i386__
-#define spice_mb() __asm__ __volatile__ ("lock; addl $0,0(%%esp)": : :"memory")
-#else
-//mfence
-#define spice_mb() __asm__ __volatile__ ("lock; addl $0,0(%%rsp)": : :"memory")
-#endif
+#define spice_mb() __sync_synchronize ()
 
 #else
 


More information about the Spice-commits mailing list