atomic: Fixes to smp_mb__{before,after}_atomic() and mips.
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 Latest4 patches 8 repliesIn review
- v1 RFC5 patches 25 repliesSuperseded
Patches in v2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/4 | mips/atomic: Fix cmpxchg64 barriersarch/ | +5 | 0 replies | |
| 2/4 | mips/atomic: Fix loongson_llsc_mb() wreckagearch/ arch/ arch/ +2 more | +32 | 0 replies | |
| 3/4 | mips/atomic: Fix smp_mb__{before,after}_atomic()arch/ arch/ arch/ +1 more | +45 | 0 replies | |
| 4/4 | x86/atomic: Fix smp_mb__{before,after}_atomic()Documentation/ arch/ arch/ +1 more | +13 | 1 reply |
Reviews trailers per patch
1 of 4 patches has a Reviewed-by or Acked-by.
| Patch | Will Deacon |
|---|---|
| 1/4 | |
| 2/4 | |
| 3/4 | |
| 4/4 | A-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v2 0/4] atomic: Fixes to smp_mb__{before,after}_atomic() and mips.
Hi,
This all started when Andrea Parri found a 'surprising' behaviour for x86:
http://lkml.kernel.org/r/20190418125412.GA10817@andrea
Basically we fail for:
*x = 1; atomic_inc(u); smp_mb__after_atomic(); r0 = *y;
Because, while the atomic_inc() implies memory order, it (surprisingly) does not provide a compiler barrier. This then allows the compiler to re-order like so:
atomic_inc(u); *x = 1; smp_mb__after_atomic(); r0 = *y;
Which the CPU is then allowed to re-order (under TSO rules) like:
atomic_inc(u); r0 = *y; *x = 1;
And this very much was not intended.
This had me audit all the (strong) architectures that had weak smp_mb__{before,after}_atomic: ia64, mips, sparc, s390, x86, xtensa.
Of those, only x86 and mips were affected. Looking at MIPS to solve this, led to the other MIPS patches.
All these patches have been through 0day for quite a while.
Paul, how do you want to route the MIPS bits?