[lttng-dev] [PATCH v2 02/12] urcu/compiler: Use atomic builtins if configured
Olivier Dion via lttng-dev <[email protected]>
| Newsgroups | org.lttng.lists.lttng-dev |
|---|---|
| Message-ID | <[email protected]> |
Use __atomic_signal_fence(__ATOMIC_SEQ_CST) for cmm_barrier() if configured to use atomic builtins. Change-Id: Ib168b50f1e97a8da861b92d6882c56db230ebb2c Co-authored-by: Mathieu Desnoyers <[email protected]> Signed-off-by: Olivier Dion <[email protected]> --- include/urcu/compiler.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/include/urcu/compiler.h b/include/urcu/compiler.h index 2f32b38..3604488 100644 --- a/include/urcu/compiler.h +++ b/include/urcu/compiler.h @@ -25,10 +25,16 @@ # include <type_traits> /* for std::remove_cv */ #endif +#include <urcu/config.h> + #define caa_likely(x) __builtin_expect(!!(x), 1) #define caa_unlikely(x) __builtin_expect(!!(x), 0) -#define cmm_barrier() __asm__ __volatile__ ("" : : : "memory") +#ifdef CONFIG_RCU_USE_ATOMIC_BUILTINS +# define cmm_barrier() __atomic_signal_fence(__ATOMIC_SEQ_CST) +#else +# define cmm_barrier() asm volatile ("" : : : "memory") +#endif /* * Instruct the compiler to perform only a single access to a variable -- 2.40.1 _______________________________________________ lttng-dev mailing list [email protected] https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev