Skip to content

Commit 15aa25c

Browse files
AlanSternPaul E. McKenney
authored andcommitted
tools/memory-model: Change definition of rcu-fence
The rcu-fence relation in the Linux Kernel Memory Model is not well named. It doesn't act like any other fence relation, in that it does not relate events before a fence to events after that fence. All it does is relate certain RCU events to one another (those that are ordered by the RCU Guarantee); this induces an actual strong-fence-like relation linking events preceding the first RCU event to those following the second. This patch renames rcu-fence, now called rcu-order. It adds a new definition of rcu-fence, something which should have been present all along because it is used in the rb relation. And it modifies the fence and strong-fence relations by making them incorporate the new rcu-fence. As a result of this change, there is no longer any need to define full-fence in the section for detecting data races. It can simply be replaced by the updated strong-fence relation. This change should have no effect on the operation of the memory model. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Acked-by: Andrea Parri <andrea.parri@amarulasolutions.com> Signed-off-by: Paul E. McKenney <paulmck@linux.ibm.com>
1 parent f9de417 commit 15aa25c

1 file changed

Lines changed: 13 additions & 10 deletions

File tree

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

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -122,24 +122,28 @@ let rcu-link = po? ; hb* ; pb* ; prop ; po
122122

123123
(*
124124
* Any sequence containing at least as many grace periods as RCU read-side
125-
* critical sections (joined by rcu-link) acts as a generalized strong fence.
125+
* critical sections (joined by rcu-link) induces order like a generalized
126+
* inter-CPU strong fence.
126127
* Likewise for SRCU grace periods and read-side critical sections, provided
127128
* the synchronize_srcu() and srcu_read_[un]lock() calls refer to the same
128129
* struct srcu_struct location.
129130
*)
130-
let rec rcu-fence = rcu-gp | srcu-gp |
131+
let rec rcu-order = rcu-gp | srcu-gp |
131132
(rcu-gp ; rcu-link ; rcu-rscsi) |
132133
((srcu-gp ; rcu-link ; srcu-rscsi) & loc) |
133134
(rcu-rscsi ; rcu-link ; rcu-gp) |
134135
((srcu-rscsi ; rcu-link ; srcu-gp) & loc) |
135-
(rcu-gp ; rcu-link ; rcu-fence ; rcu-link ; rcu-rscsi) |
136-
((srcu-gp ; rcu-link ; rcu-fence ; rcu-link ; srcu-rscsi) & loc) |
137-
(rcu-rscsi ; rcu-link ; rcu-fence ; rcu-link ; rcu-gp) |
138-
((srcu-rscsi ; rcu-link ; rcu-fence ; rcu-link ; srcu-gp) & loc) |
139-
(rcu-fence ; rcu-link ; rcu-fence)
136+
(rcu-gp ; rcu-link ; rcu-order ; rcu-link ; rcu-rscsi) |
137+
((srcu-gp ; rcu-link ; rcu-order ; rcu-link ; srcu-rscsi) & loc) |
138+
(rcu-rscsi ; rcu-link ; rcu-order ; rcu-link ; rcu-gp) |
139+
((srcu-rscsi ; rcu-link ; rcu-order ; rcu-link ; srcu-gp) & loc) |
140+
(rcu-order ; rcu-link ; rcu-order)
141+
let rcu-fence = po ; rcu-order ; po?
142+
let fence = fence | rcu-fence
143+
let strong-fence = strong-fence | rcu-fence
140144

141145
(* rb orders instructions just as pb does *)
142-
let rb = prop ; po ; rcu-fence ; po? ; hb* ; pb* ; [Marked]
146+
let rb = prop ; rcu-fence ; hb* ; pb* ; [Marked]
143147

144148
irreflexive rb as rcu
145149

@@ -163,9 +167,8 @@ flag ~empty mixed-accesses as mixed-accesses
163167

164168
(* Executes-before and visibility *)
165169
let xbstar = (hb | pb | rb)*
166-
let full-fence = strong-fence | (po ; rcu-fence ; po?)
167170
let vis = cumul-fence* ; rfe? ; [Marked] ;
168-
((full-fence ; [Marked] ; xbstar) | (xbstar & int))
171+
((strong-fence ; [Marked] ; xbstar) | (xbstar & int))
169172

170173
(* Boundaries for lifetimes of plain accesses *)
171174
let w-pre-bounded = [Marked] ; (addr | fence)?

0 commit comments

Comments
 (0)