Skip to content

Commit 1d7d256

Browse files
committed
memory-model: Prohibit nested SRCU read-side critical sections
This commit prohibits nested SRCU read-side critical sections of the same srcu_struct structure. The memory model does not currently handle these correctly because it ignores the required connection between srcu_read_lock() and srcu_read_unlock() provided by the value returned from the former and passed into the latter. Signed-off-by: Paul E. McKenney <[email protected]>
1 parent 9b812f9 commit 1d7d256

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

tools/memory-model/linux-kernel.bell

+5-11
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,11 @@ let rcu-rscs = let rec
5656
flag ~empty Rcu-lock \ domain(rcu-rscs) as unbalanced-rcu-locking
5757
flag ~empty Rcu-unlock \ range(rcu-rscs) as unbalanced-rcu-locking
5858

59-
(* Compute matching pairs of nested Srcu-lock and Srcu-unlock *)
60-
let srcu-rscs = let rec
61-
unmatched-locks = Srcu-lock \ domain(matched)
62-
and unmatched-unlocks = Srcu-unlock \ range(matched)
63-
and unmatched = unmatched-locks | unmatched-unlocks
64-
and unmatched-po = ([unmatched] ; po ; [unmatched]) & loc
65-
and unmatched-locks-to-unlocks =
66-
([unmatched-locks] ; po ; [unmatched-unlocks]) & loc
67-
and matched = matched | (unmatched-locks-to-unlocks \
68-
(unmatched-po ; unmatched-po))
69-
in matched
59+
(* Compute matching pairs of Srcu-lock and Srcu-unlock, but prohibit nesting *)
60+
let srcu-unmatched = Srcu-lock | Srcu-unlock
61+
let srcu-unmatched-po = ([srcu-unmatched] ; po ; [srcu-unmatched]) & loc
62+
let srcu-unmatched-locks-to-unlock = ([Srcu-lock] ; po ; [Srcu-unlock]) & loc
63+
let srcu-rscs = srcu-unmatched-locks-to-unlock \ (srcu-unmatched-po ; srcu-unmatched-po)
7064

7165
(* Validate nesting *)
7266
flag ~empty Srcu-lock \ domain(srcu-rscs) as unbalanced-srcu-locking

0 commit comments

Comments
 (0)