Remove volatile, use READ/WRITE ONCE
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 28 May 2019 12:56:12 +0000 (08:56 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 28 May 2019 12:56:12 +0000 (08:56 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
include/rseq/rseq.h
src/rseq.c

index a365ac8c78b61fc67ba441dd78253867ebeb5a19..5aa206346f72d6d255dedab77c0821a3bcab48f5 100644 (file)
@@ -44,7 +44,7 @@
 #define RSEQ_INJECT_FAILED
 #endif
 
-extern __thread volatile struct rseq __rseq_abi;
+extern __thread struct rseq __rseq_abi;
 extern int __rseq_handled;
 
 #define rseq_likely(x)         __builtin_expect(!!(x), 1)
@@ -111,7 +111,7 @@ int rseq_available(void);
  */
 static inline int32_t rseq_current_cpu_raw(void)
 {
-       return RSEQ_ACCESS_ONCE(__rseq_abi.cpu_id);
+       return RSEQ_READ_ONCE(__rseq_abi.cpu_id);
 }
 
 /*
@@ -127,7 +127,7 @@ static inline int32_t rseq_current_cpu_raw(void)
  */
 static inline uint32_t rseq_cpu_start(void)
 {
-       return RSEQ_ACCESS_ONCE(__rseq_abi.cpu_id_start);
+       return RSEQ_READ_ONCE(__rseq_abi.cpu_id_start);
 }
 
 static inline uint32_t rseq_current_cpu(void)
@@ -143,9 +143,9 @@ static inline uint32_t rseq_current_cpu(void)
 static inline void rseq_clear_rseq_cs(void)
 {
 #ifdef __LP64__
-       __rseq_abi.rseq_cs.ptr = 0;
+       RSEQ_WRITE_ONCE(__rseq_abi.rseq_cs.ptr, 0);
 #else
-       __rseq_abi.rseq_cs.ptr.ptr32 = 0;
+       RSEQ_WRITE_ONCE(__rseq_abi.rseq_cs.ptr.ptr32, 0);
 #endif
 }
 
index 033cbab36f6049eee7ecb83c2d42e1e79a3c1d70..6f39f092255cd5a901d9603d5493f05dcb7810dd 100644 (file)
@@ -32,7 +32,7 @@
 
 #define ARRAY_SIZE(arr)        (sizeof(arr) / sizeof((arr)[0]))
 
-__thread volatile struct rseq __rseq_abi = {
+__thread struct rseq __rseq_abi = {
        .cpu_id = RSEQ_CPU_ID_UNINITIALIZED,
 };
 
@@ -46,9 +46,9 @@ int __rseq_handled;
 /* Whether this library have ownership of rseq registration. */
 static int rseq_ownership;
 
-static __thread volatile uint32_t __rseq_refcount;
+static __thread uint32_t __rseq_refcount;
 
-static int sys_rseq(volatile struct rseq *rseq_abi, uint32_t rseq_len,
+static int sys_rseq(struct rseq *rseq_abi, uint32_t rseq_len,
                    int flags, uint32_t sig)
 {
        return syscall(__NR_rseq, rseq_abi, rseq_len, flags, sig);
This page took 0.026495 seconds and 4 git commands to generate.