atomics: emit an smp_read_barrier_depends() barrier only for Alpha and Thread Sanitizer
commitc983895258a771f8a5e4a53950bfb7fd2216651c
authorEmilio G. Cota <cota@braap.org>
Tue, 24 May 2016 20:06:13 +0000 (24 16:06 -0400)
committerPaolo Bonzini <pbonzini@redhat.com>
Sun, 29 May 2016 07:11:11 +0000 (29 09:11 +0200)
treeb383a83403d84c2d8247143783f3f700772dcaf8
parent56ebe02203f033a8399f7f6ea6972225ed87101c
atomics: emit an smp_read_barrier_depends() barrier only for Alpha and Thread Sanitizer

For correctness, smp_read_barrier_depends() is only required to
emit a barrier on Alpha hosts. However, we are currently emitting
a consume fence unconditionally, and most compilers currently treat
consume and acquire fences as equivalent.

Fix it by keeping the consume fence if we're compiling with Thread
Sanitizer, since this might help prevent false warnings. Otherwise,
only emit the barrier for Alpha hosts. Note that we still guarantee
that smp_read_barrier_depends() is a compiler barrier.

Signed-off-by: Emilio G. Cota <cota@braap.org>
Message-Id: <1464120374-8950-3-git-send-email-cota@braap.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
include/qemu/atomic.h