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 <[email protected]> > --- > v1->v2: improved comment [Peter] > --- > include/qemu/atomic.h | 14 +++++++++++--- > 1 file changed, 11 insertions(+), 3 deletions(-)
Reviewed-by: Stefan Hajnoczi <[email protected]>
pgpej5M9WFVbm.pgp
Description: PGP signature
