[ 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.
Showing the changes to include/linux (1 of 1 file). Show all
Unified · Split
| @@ -341,6 +341,7 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s · 340 unmodified lines | ||
| 341 | 341 | __read_once_size(&(x), __u.__c, sizeof(x)); \ |
| 342 | 342 | else \ |
| 343 | 343 | __read_once_size_nocheck(&(x), __u.__c, sizeof(x)); \ |
| 344 | + smp_read_barrier_depends(); /* Enforce dependency ordering from x */ \ | |
| 344 | 345 | __u.__val; \ |
| 345 | 346 | }) |
| 346 | 347 | #define READ_ONCE(x) __READ_ONCE(x, 1) |