summaryrefslogtreecommitdiffstats
path: root/tools/memory-model
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2018-05-14 19:33:52 -0400
committerIngo Molnar <mingo@kernel.org>2018-05-15 02:11:18 -0400
commit30b795df11a1a9dd7fc50c1ff4677343b67cb379 (patch)
tree1af04c90d7f31ad1db68969070f71084f5d50677 /tools/memory-model
parentfd0359dbac3df00d1c6c22769e7d647b16b920cc (diff)
tools/memory-model: Improve mixed-access checking in lock.cat
The code in lock.cat which checks for normal read/write accesses to spinlock variables doesn't take into account the newly added RL and RU events. Add them into the test, and move the resulting code up near the start of the file, since a violation would indicate a pretty severe conceptual error in a litmus test. Tested-by: Andrea Parri <andrea.parri@amarulasolutions.com> Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Akira Yokosawa <akiyks@gmail.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Boqun Feng <boqun.feng@gmail.com> Cc: David Howells <dhowells@redhat.com> Cc: Jade Alglave <j.alglave@ucl.ac.uk> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Luc Maranget <luc.maranget@inria.fr> Cc: Nicholas Piggin <npiggin@gmail.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Will Deacon <will.deacon@arm.com> Cc: linux-arch@vger.kernel.org Cc: parri.andrea@gmail.com Link: http://lkml.kernel.org/r/1526340837-12222-14-git-send-email-paulmck@linux.vnet.ibm.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/memory-model')
-rw-r--r--tools/memory-model/lock.cat22
1 files changed, 11 insertions, 11 deletions
diff --git a/tools/memory-model/lock.cat b/tools/memory-model/lock.cat
index df74de2148f6..7217cd4941a4 100644
--- a/tools/memory-model/lock.cat
+++ b/tools/memory-model/lock.cat
@@ -32,6 +32,17 @@ include "cross.cat"
32 * LKW, LF, RL, and RU have no ordering properties. 32 * LKW, LF, RL, and RU have no ordering properties.
33 *) 33 *)
34 34
35(* Backward compatibility *)
36let RL = try RL with emptyset
37let RU = try RU with emptyset
38
39(* Treat RL as a kind of LF: a read with no ordering properties *)
40let LF = LF | RL
41
42(* There should be no ordinary R or W accesses to spinlocks *)
43let ALL-LOCKS = LKR | LKW | UL | LF | RU
44flag ~empty [M \ IW] ; loc ; [ALL-LOCKS] as mixed-lock-accesses
45
35(* Link Lock-Reads to their RMW-partner Lock-Writes *) 46(* Link Lock-Reads to their RMW-partner Lock-Writes *)
36let lk-rmw = ([LKR] ; po-loc ; [LKW]) \ (po ; po) 47let lk-rmw = ([LKR] ; po-loc ; [LKW]) \ (po ; po)
37let rmw = rmw | lk-rmw 48let rmw = rmw | lk-rmw
@@ -49,20 +60,9 @@ flag ~empty LKW \ range(lk-rmw) as unpaired-LKW
49(* This will be allowed if we implement spin_is_locked() *) 60(* This will be allowed if we implement spin_is_locked() *)
50flag ~empty LKR \ domain(lk-rmw) as unpaired-LKR 61flag ~empty LKR \ domain(lk-rmw) as unpaired-LKR
51 62
52(* There should be no ordinary R or W accesses to spinlocks *)
53let ALL-LOCKS = LKR | LKW | UL | LF
54flag ~empty [M \ IW] ; loc ; [ALL-LOCKS] as mixed-lock-accesses
55
56(* The final value of a spinlock should not be tested *) 63(* The final value of a spinlock should not be tested *)
57flag ~empty [FW] ; loc ; [ALL-LOCKS] as lock-final 64flag ~empty [FW] ; loc ; [ALL-LOCKS] as lock-final
58 65
59(* Backward compatibility *)
60let RL = try RL with emptyset
61let RU = try RU with emptyset
62
63(* Treat RL as a kind of LF: a read with no ordering properties *)
64let LF = LF | RL
65
66(* 66(*
67 * Put lock operations in their appropriate classes, but leave UL out of W 67 * Put lock operations in their appropriate classes, but leave UL out of W
68 * until after the co relation has been generated. 68 * until after the co relation has been generated.