asm/rwonce: Remove smp_read_barrier_depends() invocation
authorWill Deacon <will@kernel.org>
Wed, 30 Oct 2019 16:51:07 +0000 (16:51 +0000)
committerWill Deacon <will@kernel.org>
Tue, 21 Jul 2020 09:50:35 +0000 (10:50 +0100)
Alpha overrides __READ_ONCE() directly, so there's no need to use
smp_read_barrier_depends() in the core code. This also means that
__READ_ONCE() can be relied upon to provide dependency ordering.

Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Will Deacon <will@kernel.org>
include/asm-generic/rwonce.h

index 04586b55a7c2054654406b866f53378e6a3c480d..3a7f737c77bd97f94ca4663d19e5dd0b6bc92eb2 100644 (file)
 
 /*
  * Use __READ_ONCE() instead of READ_ONCE() if you do not require any
- * atomicity or dependency ordering guarantees. Note that this may result
- * in tears!
+ * atomicity. Note that this may result in tears!
  */
 #ifndef __READ_ONCE
 #define __READ_ONCE(x) (*(const volatile __unqual_scalar_typeof(x) *)&(x))
 #endif
 
-#define __READ_ONCE_SCALAR(x)                                          \
-({                                                                     \
-       __unqual_scalar_typeof(x) __x = __READ_ONCE(x);                 \
-       smp_read_barrier_depends();                                     \
-       (typeof(x))__x;                                                 \
-})
-
 #define READ_ONCE(x)                                                   \
 ({                                                                     \
        compiletime_assert_rwonce_type(x);                              \
-       __READ_ONCE_SCALAR(x);                                          \
+       __READ_ONCE(x);                                                 \
 })
 
 #define __WRITE_ONCE(x, val)                                           \
@@ -84,12 +76,9 @@ unsigned long __read_once_word_nocheck(const void *addr)
  */
 #define READ_ONCE_NOCHECK(x)                                           \
 ({                                                                     \
-       unsigned long __x;                                              \
-       compiletime_assert(sizeof(x) == sizeof(__x),                    \
+       compiletime_assert(sizeof(x) == sizeof(unsigned long),          \
                "Unsupported access size for READ_ONCE_NOCHECK().");    \
-       __x = __read_once_word_nocheck(&(x));                           \
-       smp_read_barrier_depends();                                     \
-       (typeof(x))__x;                                                 \
+       (typeof(x))__read_once_word_nocheck(&(x));                      \
 })
 
 static __no_kasan_or_inline