Skip to content

Commit 4494dd5

Browse files
AlanSternPaul E. McKenney
authored andcommitted
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>
1 parent a188339 commit 4494dd5

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

‎tools/memory-model/linux-kernel.cat‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,14 @@ include "lock.cat"
2424
(* Basic relations *)
2525
(*******************)
2626

27+
(* Release Acquire *)
28+
let acq-po = [Acquire] ; po ; [M]
29+
let po-rel = [M] ; po ; [Release]
30+
let po-unlock-rf-lock-po = po ; [UL] ; rf ; [LKR] ; po
31+
2732
(* Fences *)
28-
let rmb = [R \ Noreturn] ; fencerel(Rmb) ; [R \ Noreturn]
33+
let R4rmb = R \ Noreturn (* Reads for which rmb works *)
34+
let rmb = [R4rmb] ; fencerel(Rmb) ; [R4rmb]
2935
let wmb = [W] ; fencerel(Wmb) ; [W]
3036
let mb = ([M] ; fencerel(Mb) ; [M]) |
3137
([M] ; fencerel(Before-atomic) ; [RMW] ; po? ; [M]) |
@@ -34,13 +40,10 @@ let mb = ([M] ; fencerel(Mb) ; [M]) |
3440
([M] ; po ; [UL] ; (co | po) ; [LKW] ;
3541
fencerel(After-unlock-lock) ; [M])
3642
let gp = po ; [Sync-rcu | Sync-srcu] ; po?
37-
3843
let strong-fence = mb | gp
3944

40-
(* Release Acquire *)
41-
let acq-po = [Acquire] ; po ; [M]
42-
let po-rel = [M] ; po ; [Release]
43-
let po-unlock-rf-lock-po = po ; [UL] ; rf ; [LKR] ; po
45+
let nonrw-fence = strong-fence | po-rel | acq-po
46+
let fence = nonrw-fence | wmb | rmb
4447

4548
(**********************************)
4649
(* Fundamental coherence ordering *)
@@ -63,7 +66,6 @@ let rwdep = (dep | ctrl) ; [W]
6366
let overwrite = co | fr
6467
let to-w = rwdep | (overwrite & int)
6568
let to-r = addr | (dep ; rfi)
66-
let fence = strong-fence | wmb | po-rel | rmb | acq-po
6769
let ppo = to-r | to-w | fence | (po-unlock-rf-lock-po & int)
6870

6971
(* Propagation: Ordering from release operations and strong fences. *)

0 commit comments

Comments
 (0)