History

locking/barriers: Add implicit smp_read_barrier_depends() to READ_ONCE()

[ Note, this is a Git cherry-pick of the following commit: 76ebbe78f739 ("locking/barriers: Add implicit smp_read_barrier_depends() to READ_ONCE()") ... for easier x86 PTI code testing and back-porting. ] 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.

Will Deacon committed 9 years ago

Commit c2bc6601 parent ab954771 file · +1 −0Browse files

Showing the changes to include/linux (1 of 1 file). Show all

Unified · Split

include/linux/compiler.h+1−0
@@ -341,6 +341,7 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s · 340 unmodified lines
341 __read_once_size(&(x), __u.__c, sizeof(x)); \341 __read_once_size(&(x), __u.__c, sizeof(x)); \
342 else \342 else \
343 __read_once_size_nocheck(&(x), __u.__c, sizeof(x)); \343 __read_once_size_nocheck(&(x), __u.__c, sizeof(x)); \
344 smp_read_barrier_depends(); /* Enforce dependency ordering from x */ \
344 __u.__val; \345 __u.__val; \
345})346})
346#define READ_ONCE(x) __READ_ONCE(x, 1)347#define READ_ONCE(x) __READ_ONCE(x, 1)