barriers: introduce smp_mb__release_acquire and update documentation
Subsystems (7)
PATCH v3 1/1 barriers: introduce smp_mb__release_acquire and update documentation
As much as we'd like to live in a world where RELEASE -> ACQUIRE is always cheaply ordered and can be used to construct UNLOCK -> LOCK definitions with similar guarantees, the grim reality is that this isn't even possible on x86 (thanks to Paul for bringing us crashing down to Earth).
This patch handles the issue by introducing a new barrier macro, smp_mb__after_release_acquire, that can be placed after an ACQUIRE that either reads from a RELEASE or is in program-order after a RELEASE. The barrier upgrades the RELEASE-ACQUIRE pair to a full memory barrier, implying global transitivity. At the moment, it doesn't have any users, so its existence serves mainly as a documentation aid and a potential stepping stone to the reintroduction of smp_mb__after_unlock_lock() used by RCU.
Documentation/memory-barriers.txt is updated to describe more clearly the ACQUIRE and RELEASE ordering in this area and to show some examples of the new barrier in action.
---
Based on Paul's patch to describe local vs global transitivity:
http://lkml.kernel.org/r/[email protected]
Documentation/memory-barriers.txt | 63 +++++++++++++++++++++++++++++++++---- arch/ia64/include/asm/barrier.h | 2 ++ arch/powerpc/include/asm/barrier.h | 3 +- arch/s390/include/asm/barrier.h | 1 + arch/sparc/include/asm/barrier_64.h | 5 +-- arch/x86/include/asm/barrier.h | 2 ++ include/asm-generic/barrier.h | 13 ++++++++ 7 files changed, 80 insertions(+), 9 deletions(-)
Documentation/memory-barriers.txt +57 -6
@@ -454,16 +454,22 @@ And a couple of implicit varieties: The use of ACQUIRE and RELEASE operations generally precludes the need for other sorts of memory barrier (but note the exceptions mentioned in the subsection "MMIO write barrier"). In addition, a RELEASE+ACQUIRE - pair is -not- guaranteed to act as a full memory barrier. However, after + pair is -not- guaranteed to act as a full memory barrier without an + explicit smp_mb__after_release_acquire() barrier. However, after an ACQUIRE on a given variable, all memory accesses preceding any prior RELEASE on that same variable are guaranteed to be visible. In other - words, within a given variable's critical section, all accesses of all - previous critical sections for that variable are guaranteed to have - completed. + words, for a CPU executing within a given variable's critical section, + all accesses of all previous critical sections for that variable are + guaranteed to be visible to that CPU. This means that ACQUIRE acts as a minimal "acquire" operation and RELEASE acts as a minimal "release" operation. +A subset of the atomic operations described in atomic_ops.txt have ACQUIRE +and RELEASE variants in addition to fully-ordered and relaxed (no barrier +semantics) definitions. For compound atomics performing both a load and +a store, ACQUIRE semantics apply only to the load and RELEASE semantics +apply only to the store portion of the operation. Memory barriers are only required where there's a possibility of interaction between two CPUs or between a CPU and a device. If it can be guaranteed that
@@ -1357,7 +1363,7 @@ However, the transitivity of release-acquire is local to the participating CPUs and does not apply to cpu3(). Therefore, the following outcome is possible: - r0 == 0 && r1 == 1 && r2 == 1 && r3 == 0 && r4 == 0 + r0 == 0 && r1 == 1 && r2 == 1 && r3 == 0 && r4 == 0 && r5 == 1 Although cpu0(), cpu1(), and cpu2() will see their respective reads and writes in order, CPUs not involved in the release-acquire chain might
@@ -1369,10 +1375,27 @@ store to u as happening -after- cpu1()'s load from v, even though both cpu0() and cpu1() agree that these two operations occurred in the intended order. +This can be forbidden by upgrading the release-acquire relationship +between cpu0() and cpu1() to a full barrier using +smp_mb__after_release_acquire() to enforce global transitivity: + + void cpu1(void) + { + r1 = smp_load_acquire(&y); + smp_mb__after_release_acquire(); + r4 = READ_ONCE(v); + r5 = READ_ONCE(u); + smp_store_release(&z, 1); + } + +With this addition, the previous result is forbidden and, as long as +r1 == 1, all CPUs must agree that cpu0()'s store to u happened before +cpu1()'s read from v. + However, please keep in mind that smp_load_acquire() is not magic. In particular, it simply reads from its argument with ordering. It does -not- ensure that any particular value will be read. Therefore, the -following outcome is possible: +following outcome is possible irrespective of any additional barriers: r0 == 0 && r1 == 0 && r2 == 0 && r5 == 0
@@ -1971,6 +1994,34 @@ the RELEASE would simply complete, thereby avoiding the deadlock. a sleep-unlock race, but the locking primitive needs to resolve such races properly in any case. +Where the RELEASE and ACQUIRE operations are performed by the same CPU +to different addresses, ordering can be enforced by an +smp_mb__after_release_acquire() barrier: + + *A = a; + RELEASE M + ACQUIRE N + smp_mb__after_release_acquire(); + *B = b; + +in which case, the only permitted orderings are: + + STORE *A, RELEASE M, ACQUIRE N, STORE *B + STORE *A, ACQUIRE N, RELEASE M, STORE *B + +Similarly, smp_mb__after_release_acquire() enforces full, +globally-transitive ordering in the case that an ACQUIRE operation on +one CPU reads from a RELEASE operation on another: + + CPU 1 CPU 2 CPU 3 + ======================= ======================= =============== + { X = 0, Y = 0, M = 0 } + STORE X=1 ACQUIRE M==1 STORE Y=1 + RELEASE M=1 smp_mb__after_release_acquire() smp_mb(); + LOAD Y==0 LOAD X=0 + +This outcome is forbidden (i.e. CPU 3 must read X == 1). + Locks and semaphores may not provide any guarantee of ordering on UP compiled systems, and so cannot be counted on in such a situation to actually achieve anything at all - especially with respect to I/O accesses - unless combined
arch/ia64/include/asm/barrier.h +2 -0
@@ -67,6 +67,8 @@ do { \ ___p1; \ }) +#define __smp_mb__after_release_acquire () __smp_mb() +/* * The group barrier in front of the rsm & ssm are necessary to ensure * that none of the previous instructions in the same group are
arch/powerpc/include/asm/barrier.h +2 -1
@@ -74,7 +74,8 @@ do { \ ___p1; \ }) -#define smp_mb__before_spinlock () smp_mb() +#define smp_mb__after_release_acquire () __smp_mb() +#define smp_mb__before_spinlock () smp_mb()#include <asm-generic/barrier.h>
arch/s390/include/asm/barrier.h +1 -0
@@ -45,6 +45,7 @@ do { \ ___p1; \ }) +#define __smp_mb__release_acquire () __smp_mb()#define __smp_mb__before_atomic () barrier()#define __smp_mb__after_atomic () barrier()
arch/sparc/include/asm/barrier_64.h +3 -2
@@ -52,8 +52,9 @@ do { \ ___p1; \ }) -#define __smp_mb__before_atomic () barrier() -#define __smp_mb__after_atomic () barrier() +#define __smp_mb__after_release_acquire () __smp_mb() +#define __smp_mb__before_atomic () barrier() +#define __smp_mb__after_atomic () barrier()#include <asm-generic/barrier.h>
arch/x86/include/asm/barrier.h +2 -0
@@ -77,6 +77,8 @@ do { \#endif +#define __smp_mb__after_release_acquire () __smp_mb() +/* Atomic operations are already serializing on x86 */ #define __smp_mb__before_atomic () barrier()#define __smp_mb__after_atomic () barrier()
include/asm-generic/barrier.h +13 -0
@@ -139,6 +139,10 @@ do { \ })#endif +#ifndef __smp_mb__after_release_acquire +#define __smp_mb__after_release_acquire () do { } while (0) +#endif +#ifdef CONFIG_SMP #ifndef smp_store_mb
@@ -161,6 +165,10 @@ do { \#define smp_load_acquire (p) __smp_load_acquire(p)#endif +#ifndef smp_mb__after_release_acquire +#define smp_mb__after_release_acquire () __smp_mb__after_release_acquire() +#endif +#else /* !CONFIG_SMP */ #ifndef smp_store_mb
@@ -194,6 +202,10 @@ do { \ })#endif +#ifndef smp_mb__after_release_acquire +#define smp_mb__after_release_acquire () do { } while (0) +#endif +#endif /* Barriers for virtual machine guests when talking to an SMP host */
@@ -206,6 +218,7 @@ do { \#define virt_mb__after_atomic () __smp_mb__after_atomic()#define virt_store_release (p, v) __smp_store_release(p, v)#define virt_load_acquire (p) __smp_load_acquire(p) +#define virt_mb__after_release_acquire () __smp_mb__after_release_acquire()#endif /* !__ASSEMBLY__ */ #endif /* __ASM_GENERIC_BARRIER_H */
Signature · 1 line
2.1.4
Peter Zijlstra
maintainerQuoted 15 lines · Will Deacon
As much as we'd like to live in a world where RELEASE -> ACQUIRE is always cheaply ordered and can be used to construct UNLOCK -> LOCK definitions with similar guarantees, the grim reality is that this isn't even possible on x86 (thanks to Paul for bringing us crashing down to Earth).
This patch handles the issue by introducing a new barrier macro,
smp_mb__after_release_acquire, that can be placed after an ACQUIRE that either reads from a RELEASE or is in program-order after a RELEASE. The barrier upgrades the RELEASE-ACQUIRE pair to a full memory barrier, implying global transitivity. At the moment, it doesn't have any users, so its existence serves mainly as a documentation aid and a potential stepping stone to the reintroduction ofsmp_mb__after_unlock_lock()used by RCU.
Quoted 3 lines
Documentation/memory-barriers.txtis updated to describe more clearly the ACQUIRE and RELEASE ordering in this area and to show some examples of the new barrier in action.
So the obvious question is: do we have a use-case?
Quoted 16 lines · Peter Zijlstra
Quoted 15 lines · Will Deacon
As much as we'd like to live in a world where RELEASE -> ACQUIRE is always cheaply ordered and can be used to construct UNLOCK -> LOCK definitions with similar guarantees, the grim reality is that this isn't even possible on x86 (thanks to Paul for bringing us crashing down to Earth).
This patch handles the issue by introducing a new barrier macro,
smp_mb__after_release_acquire, that can be placed after an ACQUIRE that either reads from a RELEASE or is in program-order after a RELEASE. The barrier upgrades the RELEASE-ACQUIRE pair to a full memory barrier, implying global transitivity. At the moment, it doesn't have any users, so its existence serves mainly as a documentation aid and a potential stepping stone to the reintroduction ofsmp_mb__after_unlock_lock()used by RCU.
Quoted 5 lines
Quoted 3 lines
Documentation/memory-barriers.txtis updated to describe more clearly the ACQUIRE and RELEASE ordering in this area and to show some examples of the new barrier in action.So the obvious question is: do we have a use-case?
We have a use-case for smp_mb__after_unlock_lock, so I think we should either strengthen our locking guarantees so that smp_mb__after_unlock_lock isn't needed or introduce smp_mb__after_release_acquire to close the gap. As it stands, we've got an inconsistency (despite it being hidden inside RCU).
The main advantage of this patch is a documentation aid, in my opinion (hell, we talk about smp_mb__after_unlock_lock already when reasoning about this stuff).
Will
Quoted 29 lines · Will Deacon
Quoted 16 lines · Peter Zijlstra
Quoted 15 lines · Will Deacon
As much as we'd like to live in a world where RELEASE -> ACQUIRE is always cheaply ordered and can be used to construct UNLOCK -> LOCK definitions with similar guarantees, the grim reality is that this isn't even possible on x86 (thanks to Paul for bringing us crashing down to Earth).
This patch handles the issue by introducing a new barrier macro,
smp_mb__after_release_acquire, that can be placed after an ACQUIRE that either reads from a RELEASE or is in program-order after a RELEASE. The barrier upgrades the RELEASE-ACQUIRE pair to a full memory barrier, implying global transitivity. At the moment, it doesn't have any users, so its existence serves mainly as a documentation aid and a potential stepping stone to the reintroduction ofsmp_mb__after_unlock_lock()used by RCU.Quoted 5 lines
Quoted 3 lines
Documentation/memory-barriers.txtis updated to describe more clearly the ACQUIRE and RELEASE ordering in this area and to show some examples of the new barrier in action.So the obvious question is: do we have a use-case?
We have a use-case for
smp_mb__after_unlock_lock, so I think we should either strengthen our locking guarantees so thatsmp_mb__after_unlock_lockisn't needed or introducesmp_mb__after_release_acquireto close the gap. As it stands, we've got an inconsistency (despite it being hidden inside RCU).
Quoted 3 lines
The main advantage of this patch is a documentation aid, in my opinion (hell, we talk about
smp_mb__after_unlock_lockalready when reasoning about this stuff).
But wasn't there an x86 potential use case that required placing the strengthening macro after the release and before the acquire? Or is this a case of old age striking again?
Thanx, Paul
Quoted 30 lines · Paul E. McKenney
Quoted 29 lines · Will Deacon
Quoted 16 lines · Peter Zijlstra
Quoted 15 lines · Will Deacon
As much as we'd like to live in a world where RELEASE -> ACQUIRE is always cheaply ordered and can be used to construct UNLOCK -> LOCK definitions with similar guarantees, the grim reality is that this isn't even possible on x86 (thanks to Paul for bringing us crashing down to Earth).
This patch handles the issue by introducing a new barrier macro,
smp_mb__after_release_acquire, that can be placed after an ACQUIRE that either reads from a RELEASE or is in program-order after a RELEASE. The barrier upgrades the RELEASE-ACQUIRE pair to a full memory barrier, implying global transitivity. At the moment, it doesn't have any users, so its existence serves mainly as a documentation aid and a potential stepping stone to the reintroduction ofsmp_mb__after_unlock_lock()used by RCU.Quoted 5 lines
Quoted 3 lines
Documentation/memory-barriers.txtis updated to describe more clearly the ACQUIRE and RELEASE ordering in this area and to show some examples of the new barrier in action.So the obvious question is: do we have a use-case?
We have a use-case for
smp_mb__after_unlock_lock, so I think we should either strengthen our locking guarantees so thatsmp_mb__after_unlock_lockisn't needed or introducesmp_mb__after_release_acquireto close the gap. As it stands, we've got an inconsistency (despite it being hidden inside RCU).
Quoted 7 lines
Quoted 3 lines
The main advantage of this patch is a documentation aid, in my opinion (hell, we talk about
smp_mb__after_unlock_lockalready when reasoning about this stuff).But wasn't there an x86 potential use case that required placing the strengthening macro after the release and before the acquire? Or is this a case of old age striking again?
The proposal here doesn't order the release/acquire operations with each other -- it just says that they combine with smp_mb__after_release_acquire() to make a full barrier, so I don't think it should matter for the intra-thread case, which is the one that x86 cares out iiuc.
Will
Quoted 15 lines · Will Deacon
As much as we'd like to live in a world where RELEASE -> ACQUIRE is always cheaply ordered and can be used to construct UNLOCK -> LOCK definitions with similar guarantees, the grim reality is that this isn't even possible on x86 (thanks to Paul for bringing us crashing down to Earth).
This patch handles the issue by introducing a new barrier macro,
smp_mb__after_release_acquire, that can be placed after an ACQUIRE that either reads from a RELEASE or is in program-order after a RELEASE. The barrier upgrades the RELEASE-ACQUIRE pair to a full memory barrier, implying global transitivity. At the moment, it doesn't have any users, so its existence serves mainly as a documentation aid and a potential stepping stone to the reintroduction ofsmp_mb__after_unlock_lock()used by RCU.
Quoted 4 lines
Documentation/memory-barriers.txtis updated to describe more clearly the ACQUIRE and RELEASE ordering in this area and to show some examples of the new barrier in action.
Maybe also add an entry in "CPU MEMORY BARRIERS" section of memory-barriers.txt? Something like (copy and paste from you commit log ;-)):
(*) smp_mb__after_release_acquire();
Placed after an ACQUIRE that either reads from a RELEASE or is in program-order after a RELEASE. The barrier upgrades the RELEASE-ACQUIRE pair to a full memory barrier, implying global transitivity.
This could give the readers an overview of the usage of this barrier.
Quoted 155 lines
Cc Boqun Feng <[email protected]>Cc Paul E. McKenney <[email protected]>Cc Peter Zijlstra <[email protected]>Signed-off-by Will Deacon <[email protected]>---
Based on Paul's patch to describe local vs global transitivity:
http://lkml.kernel.org/r/[email protected]
Documentation/memory-barriers.txt | 63 +++++++++++++++++++++++++++++++++---- arch/ia64/include/asm/barrier.h | 2 ++ arch/powerpc/include/asm/barrier.h | 3 +- arch/s390/include/asm/barrier.h | 1 + arch/sparc/include/asm/barrier_64.h | 5 +-- arch/x86/include/asm/barrier.h | 2 ++ include/asm-generic/barrier.h | 13 ++++++++ 7 files changed, 80 insertions(+), 9 deletions(-)Documentation/memory-barriers.txt +57
-6@@ -454,16 +454,22 @@ And a couple of implicit varieties: The use of ACQUIRE and RELEASE operations generally precludes the need for other sorts of memory barrier (but note the exceptions mentioned in the subsection "MMIO write barrier"). In addition, a RELEASE+ACQUIRE - pair is -not- guaranteed to act as a full memory barrier. However, after + pair is -not- guaranteed to act as a full memory barrier without an + explicit smp_mb__after_release_acquire() barrier. However, after an ACQUIRE on a given variable, all memory accesses preceding any prior RELEASE on that same variable are guaranteed to be visible. In other - words, within a given variable's critical section, all accesses of all - previous critical sections for that variable are guaranteed to have - completed. + words, for a CPU executing within a given variable's critical section, + all accesses of all previous critical sections for that variable are + guaranteed to be visible to that CPU. This means that ACQUIRE acts as a minimal "acquire" operation and RELEASE acts as a minimal "release" operation. +A subset of the atomic operations described in atomic_ops.txt have ACQUIRE +and RELEASE variants in addition to fully-ordered and relaxed (no barrier +semantics) definitions. For compound atomics performing both a load and +a store, ACQUIRE semantics apply only to the load and RELEASE semantics +apply only to the store portion of the operation. Memory barriers are only required where there's a possibility of interaction between two CPUs or between a CPU and a device. If it can be guaranteed that@@ -1357,7 +1363,7 @@ However, the transitivity of release-acquire is local to the participating CPUs and does not apply to cpu3(). Therefore, the following outcome is possible: - r0 == 0 && r1 == 1 && r2 == 1 && r3 == 0 && r4 == 0 + r0 == 0 && r1 == 1 && r2 == 1 && r3 == 0 && r4 == 0 && r5 == 1 Although cpu0(), cpu1(), and cpu2() will see their respective reads and writes in order, CPUs not involved in the release-acquire chain might@@ -1369,10 +1375,27 @@ store to u as happening -after- cpu1()'s load from v, even though both cpu0() and cpu1() agree that these two operations occurred in the intended order. +This can be forbidden by upgrading the release-acquire relationship +between cpu0() and cpu1() to a full barrier using +smp_mb__after_release_acquire() to enforce global transitivity: + + void cpu1(void) + { + r1 = smp_load_acquire(&y); + smp_mb__after_release_acquire(); + r4 = READ_ONCE(v); + r5 = READ_ONCE(u); + smp_store_release(&z, 1); + } + +With this addition, the previous result is forbidden and, as long as +r1 == 1, all CPUs must agree that cpu0()'s store to u happened before +cpu1()'s read from v. + However, please keep in mind that smp_load_acquire() is not magic. In particular, it simply reads from its argument with ordering. It does -not- ensure that any particular value will be read. Therefore, the -following outcome is possible: +following outcome is possible irrespective of any additional barriers: r0 == 0 && r1 == 0 && r2 == 0 && r5 == 0@@ -1971,6 +1994,34 @@ the RELEASE would simply complete, thereby avoiding the deadlock. a sleep-unlock race, but the locking primitive needs to resolve such races properly in any case. +Where the RELEASE and ACQUIRE operations are performed by the same CPU +to different addresses, ordering can be enforced by an +smp_mb__after_release_acquire() barrier: + + *A = a; + RELEASE M + ACQUIRE N + smp_mb__after_release_acquire(); + *B = b; + +in which case, the only permitted orderings are: + + STORE *A, RELEASE M, ACQUIRE N, STORE *B + STORE *A, ACQUIRE N, RELEASE M, STORE *B + +Similarly, smp_mb__after_release_acquire() enforces full, +globally-transitive ordering in the case that an ACQUIRE operation on +one CPU reads from a RELEASE operation on another: + + CPU 1 CPU 2 CPU 3 + ======================= ======================= =============== + { X = 0, Y = 0, M = 0 } + STORE X=1 ACQUIRE M==1 STORE Y=1 + RELEASE M=1 smp_mb__after_release_acquire() smp_mb(); + LOAD Y==0 LOAD X=0 + +This outcome is forbidden (i.e. CPU 3 must read X == 1). + Locks and semaphores may not provide any guarantee of ordering on UP compiled systems, and so cannot be counted on in such a situation to actually achieve anything at all - especially with respect to I/O accesses - unless combinedarch/ia64/include/asm/barrier.h +2
-0@@ -67,6 +67,8 @@ do { \ ___p1; \ }) +#define __smp_mb__after_release_acquire () __smp_mb() +/* * The group barrier in front of the rsm & ssm are necessary to ensure * that none of the previous instructions in the same group are arch/powerpc/include/asm/barrier.h +2
-1@@ -74,7 +74,8 @@ do { \ ___p1; \ }) -#define smp_mb__before_spinlock () smp_mb() +#define smp_mb__after_release_acquire () __smp_mb() +#define smp_mb__before_spinlock () smp_mb()#include <asm-generic/barrier.h> arch/s390/include/asm/barrier.h +0
-0
arch/s390/include/asm/barrier.h do { \ · line 48
Quoted 4 lines
arch/s390/include/asm/barrier.h +1
-0@@ -45,6 +45,7 @@ do { \ ___p1; \ }) +#define __smp_mb__release_acquire () __smp_mb()
Should be __smp_mb__after_release_acquire(), so is the title of this patch ;-)
Regards,
Boqun
Quoted 80 lines
arch/s390/include/asm/barrier.h +0
-0#define __smp_mb__before_atomic () barrier()#define __smp_mb__after_atomic () barrier()arch/sparc/include/asm/barrier_64.h +3
-2@@ -52,8 +52,9 @@ do { \ ___p1; \ }) -#define __smp_mb__before_atomic () barrier() -#define __smp_mb__after_atomic () barrier() +#define __smp_mb__after_release_acquire () __smp_mb() +#define __smp_mb__before_atomic () barrier() +#define __smp_mb__after_atomic () barrier()#include <asm-generic/barrier.h> arch/x86/include/asm/barrier.h +2
-0@@ -77,6 +77,8 @@ do { \#endif +#define __smp_mb__after_release_acquire () __smp_mb() +/* Atomic operations are already serializing on x86 */ #define __smp_mb__before_atomic () barrier()#define __smp_mb__after_atomic () barrier()include/asm-generic/barrier.h +13
-0@@ -139,6 +139,10 @@ do { \ })#endif +#ifndef __smp_mb__after_release_acquire +#define __smp_mb__after_release_acquire () do { } while (0) +#endif +#ifdef CONFIG_SMP #ifndef smp_store_mb@@ -161,6 +165,10 @@ do { \#define smp_load_acquire (p) __smp_load_acquire(p)#endif +#ifndef smp_mb__after_release_acquire +#define smp_mb__after_release_acquire () __smp_mb__after_release_acquire() +#endif +#else /* !CONFIG_SMP */ #ifndef smp_store_mb@@ -194,6 +202,10 @@ do { \ })#endif +#ifndef smp_mb__after_release_acquire +#define smp_mb__after_release_acquire () do { } while (0) +#endif +#endif /* Barriers for virtual machine guests when talking to an SMP host */ @@ -206,6 +218,7 @@ do { \#define virt_mb__after_atomic () __smp_mb__after_atomic()#define virt_store_release (p, v) __smp_store_release(p, v)#define virt_load_acquire (p) __smp_load_acquire(p) +#define virt_mb__after_release_acquire () __smp_mb__after_release_acquire()#endif /* !__ASSEMBLY__ */ #endif /* __ASM_GENERIC_BARRIER_H */ Signature · 1 line
2.1.4
Quoted 25 lines · Boqun Feng
Quoted 15 lines · Will Deacon
As much as we'd like to live in a world where RELEASE -> ACQUIRE is always cheaply ordered and can be used to construct UNLOCK -> LOCK definitions with similar guarantees, the grim reality is that this isn't even possible on x86 (thanks to Paul for bringing us crashing down to Earth).
This patch handles the issue by introducing a new barrier macro,
smp_mb__after_release_acquire, that can be placed after an ACQUIRE that either reads from a RELEASE or is in program-order after a RELEASE. The barrier upgrades the RELEASE-ACQUIRE pair to a full memory barrier, implying global transitivity. At the moment, it doesn't have any users, so its existence serves mainly as a documentation aid and a potential stepping stone to the reintroduction ofsmp_mb__after_unlock_lock()used by RCU.Quoted 4 lines
Documentation/memory-barriers.txtis updated to describe more clearly the ACQUIRE and RELEASE ordering in this area and to show some examples of the new barrier in action.Maybe also add an entry in "CPU MEMORY BARRIERS" section of memory-barriers.txt? Something like (copy and paste from you commit log ;-)):
Quoted 8 lines
(*)
smp_mb__after_release_acquire();Placed after an ACQUIRE that either reads from a RELEASE or is in program-order after a RELEASE. The barrier upgrades the RELEASE-ACQUIRE pair to a full memory barrier, implying global transitivity.
This could give the readers an overview of the usage of this barrier.
Thanks, I'll add that.
Quoted 8 lines
Quoted 8 lines
arch/s390/include/asm/barrier.h +0
-0@@ -45,6 +45,7 @@ do { \ ___p1; \ })
Quoted 4 lines
arch/s390/include/asm/barrier.h do { \ · line 48
Quoted 1 line
arch/s390/include/asm/barrier.h +1
-0+#define __smp_mb__release_acquire () __smp_mb()Should be
__smp_mb__after_release_acquire(), so is the title of this patch ;-)
Well spotted. That's a hangover from v2, which I'll fix.
Cheers,
Will