mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-27 17:11:46 +00:00
tools/memory-model: Add SRCU support
Add support for SRCU. Herd creates srcu events and linux-kernel.def associates them with three possible annotations (srcu-lock, srcu-unlock, and sync-srcu) corresponding to the API routines srcu_read_lock(), srcu_read_unlock(), and synchronize_srcu(). The linux-kernel.bell file now declares the annotations and determines matching lock/unlock pairs delimiting SRCU read-side critical sections, and it also checks for synchronize_srcu() calls inside an RCU critical section (which would generate a "sleeping in atomic context" error in real kernel code). The linux-kernel.cat file now adds SRCU-induced ordering, analogous to the existing RCU-induced ordering, to the gp and rcu-fence relations. Curiously enough, these small changes to the model's .cat code are all that is needed to describe SRCU. Portions of this patch (linux-kernel.def and the first hunk in linux-kernel.bell) were written by Luc Maranget. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> CC: Luc Maranget <luc.maranget@inria.fr> Signed-off-by: Paul E. McKenney <paulmck@linux.ibm.com> Tested-by: Andrea Parri <andrea.parri@amarulasolutions.com>
This commit is contained in:
parent
284749b0ae
commit
a3f600d92d
3 changed files with 44 additions and 4 deletions
|
@ -33,6 +33,12 @@ enum Barriers = 'wmb (*smp_wmb*) ||
|
|||
'after-unlock-lock (*smp_mb__after_unlock_lock*)
|
||||
instructions F[Barriers]
|
||||
|
||||
(* SRCU *)
|
||||
enum SRCU = 'srcu-lock || 'srcu-unlock || 'sync-srcu
|
||||
instructions SRCU[SRCU]
|
||||
(* All srcu events *)
|
||||
let Srcu = Srcu-lock | Srcu-unlock | Sync-srcu
|
||||
|
||||
(* Compute matching pairs of nested Rcu-lock and Rcu-unlock *)
|
||||
let rcu-rscs = let rec
|
||||
unmatched-locks = Rcu-lock \ domain(matched)
|
||||
|
@ -48,3 +54,22 @@ let rcu-rscs = let rec
|
|||
(* Validate nesting *)
|
||||
flag ~empty Rcu-lock \ domain(rcu-rscs) as unbalanced-rcu-locking
|
||||
flag ~empty Rcu-unlock \ range(rcu-rscs) as unbalanced-rcu-locking
|
||||
|
||||
(* Compute matching pairs of nested Srcu-lock and Srcu-unlock *)
|
||||
let srcu-rscs = let rec
|
||||
unmatched-locks = Srcu-lock \ domain(matched)
|
||||
and unmatched-unlocks = Srcu-unlock \ range(matched)
|
||||
and unmatched = unmatched-locks | unmatched-unlocks
|
||||
and unmatched-po = ([unmatched] ; po ; [unmatched]) & loc
|
||||
and unmatched-locks-to-unlocks =
|
||||
([unmatched-locks] ; po ; [unmatched-unlocks]) & loc
|
||||
and matched = matched | (unmatched-locks-to-unlocks \
|
||||
(unmatched-po ; unmatched-po))
|
||||
in matched
|
||||
|
||||
(* Validate nesting *)
|
||||
flag ~empty Srcu-lock \ domain(srcu-rscs) as unbalanced-srcu-locking
|
||||
flag ~empty Srcu-unlock \ range(srcu-rscs) as unbalanced-srcu-locking
|
||||
|
||||
(* Check for use of synchronize_srcu() inside an RCU critical section *)
|
||||
flag ~empty rcu-rscs & (po ; [Sync-srcu] ; po) as invalid-sleep
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue