qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2] atomics: add explicit compiler fence in __at


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH v2] atomics: add explicit compiler fence in __atomic memory barriers
Date: Fri, 5 Jun 2015 14:18:17 +0100
User-agent: Mutt/1.5.23 (2014-03-12)

On Wed, Jun 03, 2015 at 02:34:51PM +0200, Paolo Bonzini wrote:
> __atomic_thread_fence does not include a compiler barrier; in the
> C++11 memory model, fences take effect in combination with other
> atomic operations.  GCC implements this by making __atomic_load and
> __atomic_store access memory as if the pointer was volatile, and
> leaves no trace whatsoever of acquire and release fences in the
> compiler's intermediate representation.
> 
> In QEMU, we want memory barriers to act on all memory, but at the same
> time we would like to use __atomic_thread_fence for portability reasons.
> Add compiler barriers manually around the __atomic_thread_fence.
> 
> Thanks to Kevin Wolf for the analysis.
> 
> Signed-off-by: Paolo Bonzini <address@hidden>
> ---
>         v1->v2: improved comment [Peter]
> ---
>  include/qemu/atomic.h | 14 +++++++++++---
>  1 file changed, 11 insertions(+), 3 deletions(-)

Reviewed-by: Stefan Hajnoczi <address@hidden>

Attachment: pgp6As_xMS2WY.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]