[lttng-dev] [PATCH 3/7] Use __atomic_signal_fence() for cmm_barrier()

Ondřej Surý ondrej at sury.org
Tue Mar 21 09:30:58 EDT 2023


Use __atomic_signal_fence(__ATOMIC_SEQ_CST) for cmm_barrier(), so
ThreadSanitizer can understand the memory synchronization.

Signed-off-by: Ondřej Surý <ondrej at sury.org>
---
 include/urcu/compiler.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/urcu/compiler.h b/include/urcu/compiler.h
index 2f32b38..5763378 100644
--- a/include/urcu/compiler.h
+++ b/include/urcu/compiler.h
@@ -28,7 +28,7 @@
 #define caa_likely(x)	__builtin_expect(!!(x), 1)
 #define caa_unlikely(x)	__builtin_expect(!!(x), 0)
 
-#define	cmm_barrier()	__asm__ __volatile__ ("" : : : "memory")
+#define	cmm_barrier()	__atomic_signal_fence(__ATOMIC_SEQ_CST)
 
 /*
  * Instruct the compiler to perform only a single access to a variable
-- 
2.39.2



More information about the lttng-dev mailing list