mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 07:12:09 +00:00
powerpc: Fix atomic_xxx_return barrier semantics
The Documentation/memory-barriers.txt document requires that atomic operations that return a value act as a memory barrier both before and after the actual atomic operation. Our current implementation doesn't guarantee this. More specifically, while a load following the isync can not be issued before stwcx. has completed, that completion doesn't architecturally means that the result of stwcx. is visible to other processors (or any previous stores for that matter) (typically, the other processors L1 caches can still hold the old value). This has caused an actual crash in RCU torture testing on Power 7 This fixes it by changing those atomic ops to use new macros instead of RELEASE/ACQUIRE barriers, called ATOMIC_ENTRY and ATMOIC_EXIT barriers, which are then defined respectively to lwsync and sync. I haven't had a chance to measure the performance impact (or rather what I measured with kernel compiles is in the noise, I yet have to find a more precise benchmark) Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
This commit is contained in:
parent
a9a8f77ac7
commit
b97021f855
4 changed files with 40 additions and 35 deletions
|
@ -124,14 +124,14 @@ static __inline__ unsigned long fn( \
|
|||
return (old & mask); \
|
||||
}
|
||||
|
||||
DEFINE_TESTOP(test_and_set_bits, or, PPC_RELEASE_BARRIER,
|
||||
PPC_ACQUIRE_BARRIER, 0)
|
||||
DEFINE_TESTOP(test_and_set_bits, or, PPC_ATOMIC_ENTRY_BARRIER,
|
||||
PPC_ATOMIC_EXIT_BARRIER, 0)
|
||||
DEFINE_TESTOP(test_and_set_bits_lock, or, "",
|
||||
PPC_ACQUIRE_BARRIER, 1)
|
||||
DEFINE_TESTOP(test_and_clear_bits, andc, PPC_RELEASE_BARRIER,
|
||||
PPC_ACQUIRE_BARRIER, 0)
|
||||
DEFINE_TESTOP(test_and_change_bits, xor, PPC_RELEASE_BARRIER,
|
||||
PPC_ACQUIRE_BARRIER, 0)
|
||||
DEFINE_TESTOP(test_and_clear_bits, andc, PPC_ATOMIC_ENTRY_BARRIER,
|
||||
PPC_ATOMIC_EXIT_BARRIER, 0)
|
||||
DEFINE_TESTOP(test_and_change_bits, xor, PPC_ATOMIC_ENTRY_BARRIER,
|
||||
PPC_ATOMIC_EXIT_BARRIER, 0)
|
||||
|
||||
static __inline__ int test_and_set_bit(unsigned long nr,
|
||||
volatile unsigned long *addr)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue