Commit 29279349 authored by Jonas Oberhauser's avatar Jonas Oberhauser Committed by Paul E. McKenney
Browse files

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: default avatarViktor Vafeiadis <viktor@mpi-sws.org>
Suggested-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarJonas Oberhauser <jonas.oberhauser@huaweicloud.com>
Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
Reviewed-by: default avatarBoqun Feng <boqun.feng@gmail.com>
Tested-by: default avatarBoqun Feng <boqun.feng@gmail.com>
parent 723177d7
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -34,6 +34,16 @@ let R4rmb = R \ Noreturn (* Reads for which rmb works *)
let rmb = [R4rmb] ; fencerel(Rmb) ; [R4rmb]
let wmb = [W] ; fencerel(Wmb) ; [W]
let mb = ([M] ; fencerel(Mb) ; [M]) |
	(*
	 * full-barrier RMWs (successful cmpxchg(), xchg(), etc.) act as
	 * though there were enclosed by smp_mb().
	 * The effect of these virtual smp_mb() is formalized by adding
	 * Mb tags to the read and write of the operation, and providing
	 * the same ordering as though there were additional po edges
	 * between the Mb tag and the read resp. write.
	 *)
	([M] ; po ; [Mb & R]) |
	([Mb & W] ; po ; [M]) |
	([M] ; fencerel(Before-atomic) ; [RMW] ; po? ; [M]) |
	([M] ; po? ; [RMW] ; fencerel(After-atomic) ; [M]) |
	([M] ; po? ; [LKW] ; fencerel(After-spinlock) ; [M]) |