Skip to content

Commit 2927934

Browse files
Jonas Oberhauserpaulmckrcu
authored andcommitted
tools/memory-model: Define effect of Mb tags on RMWs in tools/...
Herd7 transforms successful RMW with Mb tags by inserting smp_mb() fences around them. We emulate this by considering imaginary po-edges before the RMW read and before the RMW write, and extending the smp_mb() ordering rule, which currently only applies to real po edges that would be found around a really inserted smp_mb(), also to cases of the only imagined po edges. Reported-by: Viktor Vafeiadis <[email protected]> Suggested-by: Alan Stern <[email protected]> Signed-off-by: Jonas Oberhauser <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]> Reviewed-by: Boqun Feng <[email protected]> Tested-by: Boqun Feng <[email protected]>
1 parent 723177d commit 2927934

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tools/memory-model/linux-kernel.cat

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,16 @@ let R4rmb = R \ Noreturn (* Reads for which rmb works *)
3434
let rmb = [R4rmb] ; fencerel(Rmb) ; [R4rmb]
3535
let wmb = [W] ; fencerel(Wmb) ; [W]
3636
let mb = ([M] ; fencerel(Mb) ; [M]) |
37+
(*
38+
* full-barrier RMWs (successful cmpxchg(), xchg(), etc.) act as
39+
* though there were enclosed by smp_mb().
40+
* The effect of these virtual smp_mb() is formalized by adding
41+
* Mb tags to the read and write of the operation, and providing
42+
* the same ordering as though there were additional po edges
43+
* between the Mb tag and the read resp. write.
44+
*)
45+
([M] ; po ; [Mb & R]) |
46+
([Mb & W] ; po ; [M]) |
3747
([M] ; fencerel(Before-atomic) ; [RMW] ; po? ; [M]) |
3848
([M] ; po? ; [RMW] ; fencerel(After-atomic) ; [M]) |
3949
([M] ; po? ; [LKW] ; fencerel(After-spinlock) ; [M]) |

0 commit comments

Comments
 (0)