]> git.baikalelectronics.ru Git - kernel.git/commitdiff
locking/barriers: Add implicit smp_read_barrier_depends() to READ_ONCE()
authorWill Deacon <will.deacon@arm.com>
Tue, 24 Oct 2017 10:22:47 +0000 (11:22 +0100)
committerIngo Molnar <mingo@kernel.org>
Tue, 24 Oct 2017 11:17:32 +0000 (13:17 +0200)
In preparation for the removal of lockless_dereference(), which is the
same as READ_ONCE() on all architectures other than Alpha, add an
implicit smp_read_barrier_depends() to READ_ONCE() so that it can be
used to head dependency chains on all architectures.

Signed-off-by: Will Deacon <will.deacon@arm.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1508840570-22169-3-git-send-email-will.deacon@arm.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
include/linux/compiler.h

index 08083186e54f5d75f594b0d0d749fc891c100da5..7d7b77da9716fb46df6d4e6aa190ed6f12d12c6e 100644 (file)
@@ -242,6 +242,7 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s
                __read_once_size(&(x), __u.__c, sizeof(x));             \
        else                                                            \
                __read_once_size_nocheck(&(x), __u.__c, sizeof(x));     \
+       smp_read_barrier_depends(); /* Enforce dependency ordering from x */ \
        __u.__val;                                                      \
 })
 #define READ_ONCE(x) __READ_ONCE(x, 1)