aboutsummaryrefslogtreecommitdiffstats
path: root/tools/memory-model
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2019-04-22 12:17:45 -0400
committerPaul E. McKenney <paulmck@linux.ibm.com>2019-05-28 08:18:21 -0700
commit4494dd58fbb477e54c129c1d8ef477aad433eba0 (patch)
tree504b50ab6202c69f01cc029976a290af9d9a6bf4 /tools/memory-model
parentLinux 5.2-rc1 (diff)
downloadlinux-dev-4494dd58fbb477e54c129c1d8ef477aad433eba0.tar.xz
linux-dev-4494dd58fbb477e54c129c1d8ef477aad433eba0.zip
tools/memory-model: Prepare for data-race detection
This patch makes some slight alterations to linux-kernel.cat in preparation for adding support for data-race detection to the Linux-Kernel Memory Model. The definitions of relations involved in Acquire, Release, and unlock-lock ordering are moved up earlier in the source file. The rmb relation is factored through the new R4rmb class: the class of reads to which rmb will apply. The definition of the fence relation is moved earlier, and it is split up into read- and write-fences (rmb and wmb) and all the others. This should not make any functional changes. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Reviewed-by: Andrea Parri <andrea.parri@amarulasolutions.com> Signed-off-by: Paul E. McKenney <paulmck@linux.ibm.com>
Diffstat (limited to 'tools/memory-model')
-rw-r--r--tools/memory-model/linux-kernel.cat16
1 files changed, 9 insertions, 7 deletions
diff --git a/tools/memory-model/linux-kernel.cat b/tools/memory-model/linux-kernel.cat
index 8dcb37835b61..834107022c50 100644
--- a/tools/memory-model/linux-kernel.cat
+++ b/tools/memory-model/linux-kernel.cat
@@ -24,8 +24,14 @@ include "lock.cat"
(* Basic relations *)
(*******************)
+(* Release Acquire *)
+let acq-po = [Acquire] ; po ; [M]
+let po-rel = [M] ; po ; [Release]
+let po-unlock-rf-lock-po = po ; [UL] ; rf ; [LKR] ; po
+
(* Fences *)
-let rmb = [R \ Noreturn] ; fencerel(Rmb) ; [R \ Noreturn]
+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]) |
([M] ; fencerel(Before-atomic) ; [RMW] ; po? ; [M]) |
@@ -34,13 +40,10 @@ let mb = ([M] ; fencerel(Mb) ; [M]) |
([M] ; po ; [UL] ; (co | po) ; [LKW] ;
fencerel(After-unlock-lock) ; [M])
let gp = po ; [Sync-rcu | Sync-srcu] ; po?
-
let strong-fence = mb | gp
-(* Release Acquire *)
-let acq-po = [Acquire] ; po ; [M]
-let po-rel = [M] ; po ; [Release]
-let po-unlock-rf-lock-po = po ; [UL] ; rf ; [LKR] ; po
+let nonrw-fence = strong-fence | po-rel | acq-po
+let fence = nonrw-fence | wmb | rmb
(**********************************)
(* Fundamental coherence ordering *)
@@ -63,7 +66,6 @@ let rwdep = (dep | ctrl) ; [W]
let overwrite = co | fr
let to-w = rwdep | (overwrite & int)
let to-r = addr | (dep ; rfi)
-let fence = strong-fence | wmb | po-rel | rmb | acq-po
let ppo = to-r | to-w | fence | (po-unlock-rf-lock-po & int)
(* Propagation: Ordering from release operations and strong fences. *)