From: tip-bot for Alan Stern <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: mingo@kernel.org, will.deacon@arm.com,
paulmck@linux.vnet.ibm.com, dhowells@redhat.com,
andrea.parri@amarulasolutions.com, torvalds@linux-foundation.org,
boqun.feng@gmail.com, linux-kernel@vger.kernel.org,
akiyks@gmail.com, j.alglave@ucl.ac.uk, luc.maranget@inria.fr,
stern@rowland.harvard.edu, akpm@linux-foundation.org,
tglx@linutronix.de, peterz@infradead.org, npiggin@gmail.com,
hpa@zytor.com
Subject: [tip:locking/core] tools/memory-model: Remove duplicated code from lock.cat
Date: Mon, 14 May 2018 23:32:46 -0700 [thread overview]
Message-ID: <tip-8559183ccaec97454b2515ac426f113967256cf9@git.kernel.org> (raw)
In-Reply-To: <1526340837-12222-12-git-send-email-paulmck@linux.vnet.ibm.com>
Commit-ID: 8559183ccaec97454b2515ac426f113967256cf9
Gitweb: https://git.kernel.org/tip/8559183ccaec97454b2515ac426f113967256cf9
Author: Alan Stern <stern@rowland.harvard.edu>
AuthorDate: Mon, 14 May 2018 16:33:50 -0700
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 15 May 2018 08:11:17 +0200
tools/memory-model: Remove duplicated code from lock.cat
This patch simplifies the implementation of spin_is_locked in the
LKMM. It capitalizes on the fact that a failed spin_trylock() and a
spin_is_locked() which returns True have exactly the same semantics
(those of READ_ONCE) and ordering properties (none). Therefore the
two kinds of events can be combined and handled by the same code,
instead of treated separately as they are currently.
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-12-git-send-email-paulmck@linux.vnet.ibm.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
tools/memory-model/lock.cat | 28 ++++++----------------------
1 file changed, 6 insertions(+), 22 deletions(-)
diff --git a/tools/memory-model/lock.cat b/tools/memory-model/lock.cat
index 3b1439edc818..1f6d67e79065 100644
--- a/tools/memory-model/lock.cat
+++ b/tools/memory-model/lock.cat
@@ -41,11 +41,15 @@ flag ~empty [FW] ; loc ; [ALL-LOCKS] as lock-final
*)
let RL = try RL with emptyset (* defined herd7 >= 7.49 *)
let RU = try RU with emptyset (* defined herd7 >= 7.49 *)
+
+(* Treat RL as a kind of LF: a read with no ordering properties *)
+let LF = LF | RL
+
(*
* Put lock operations in their appropriate classes, but leave UL out of W
* until after the co relation has been generated.
*)
-let R = R | LKR | LF | RL | RU
+let R = R | LKR | LF | RU
let W = W | LKW
let Release = Release | UL
@@ -80,28 +84,8 @@ let all-possible-rfe-lf =
(* Generate all rf relations for LF events *)
with rfe-lf from cross(all-possible-rfe-lf)
-
let rf-lf = rfe-lf | rfi-lf
-(* rf for RL events, ie islocked returning true, similar to LF above *)
-
-(* islocked returning true inside a critical section
- * must read from the opening lock
- *)
-let rfi-rl = ([LKW] ; po-loc ; [RL]) \ ([LKW] ; po-loc ; [UL] ; po-loc)
-
-(* islocked returning true outside critical sections can match any
- * external lock.
- *)
-let all-possible-rfe-rl =
- let possible-rfe-lf r =
- let pair-to-relation p = p ++ 0
- in map pair-to-relation ((LKW * {r}) & loc & ext)
- in map possible-rfe-lf (RL \ range(rfi-rl))
-
-with rfe-rl from cross(all-possible-rfe-rl)
-let rf-rl = rfe-rl | rfi-rl
-
(* Read from unlock, ie islocked returning false, slightly different *)
(* islocked returning false can read from the last po-previous unlock *)
@@ -118,7 +102,7 @@ with rfe-ru from cross(all-possible-rfe-ru)
let rf-ru = rfe-ru | rfi-ru
(* Final rf relation *)
-let rf = rf | rf-lf | rf-rl | rf-ru
+let rf = rf | rf-lf | rf-ru
(* Generate all co relations, including LKW events but not UL *)
let co0 = co0 | ([IW] ; loc ; [LKW]) |
next prev parent reply other threads:[~2018-05-15 6:33 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-14 23:33 [PATCH memory-model 0/19] Updates to the formal memory model Paul E. McKenney
2018-05-14 23:33 ` [PATCH memory-model 01/19] tools/memory-model: Rename link and rcu-path to rcu-link and rb Paul E. McKenney
2018-05-15 6:27 ` [tip:locking/core] " tip-bot for Alan Stern
2018-05-14 23:33 ` [PATCH memory-model 02/19] tools/memory-model: Redefine rb in terms of rcu-fence Paul E. McKenney
2018-05-15 6:27 ` [tip:locking/core] " tip-bot for Alan Stern
2018-05-14 23:33 ` [PATCH memory-model 03/19] tools/memory-model: Update required version of herdtools7 Paul E. McKenney
2018-05-15 6:28 ` [tip:locking/core] " tip-bot for Akira Yokosawa
2018-05-14 23:33 ` [PATCH memory-model 04/19] tools/memory-model: Fix cheat sheet typo Paul E. McKenney
2018-05-15 6:28 ` [tip:locking/core] " tip-bot for Paolo Bonzini
2018-05-14 23:33 ` [PATCH memory-model 05/19] tools/memory-order: Improve key for SELF and SV Paul E. McKenney
2018-05-15 6:29 ` [tip:locking/core] " tip-bot for Paul E. McKenney
2018-05-14 23:33 ` [PATCH memory-model 06/19] tools/memory-order: smp_mb__after_atomic() orders later RMW operations Paul E. McKenney
2018-05-15 6:29 ` [tip:locking/core] tools/memory-order: Update the cheat-sheet to show that " tip-bot for Paul E. McKenney
2018-05-14 23:33 ` [PATCH memory-model 07/19] tools/memory-model: Model 'smp_store_mb()' Paul E. McKenney
2018-05-15 6:30 ` [tip:locking/core] " tip-bot for Andrea Parri
2018-05-14 23:33 ` [PATCH memory-model 08/19] tools/memory-model: Fix coding style in 'linux-kernel.def' Paul E. McKenney
2018-05-15 6:30 ` [tip:locking/core] " tip-bot for Andrea Parri
2018-05-14 23:33 ` [PATCH memory-model 09/19] tools/memory-model: Add scripts to test memory model Paul E. McKenney
2018-05-15 6:31 ` [tip:locking/core] " tip-bot for Paul E. McKenney
2018-05-14 23:33 ` [PATCH memory-model 10/19] tools/memory-model: Add model support for spin_is_locked Paul E. McKenney
2018-05-15 6:31 ` [tip:locking/core] tools/memory-model: Add model support for spin_is_locked() tip-bot for Luc Maranget
2018-05-14 23:33 ` [PATCH memory-model 11/19] tools/memory-model: Flag "cumulativity" and "propagation" tests Paul E. McKenney
2018-05-15 6:32 ` [tip:locking/core] " tip-bot for Paul E. McKenney
2018-05-14 23:33 ` [PATCH memory-model 12/19] tools/memory-model: Remove duplicated code from lock.cat Paul E. McKenney
2018-05-15 6:32 ` tip-bot for Alan Stern [this message]
2018-05-14 23:33 ` [PATCH memory-model 13/19] tools/memory-model: Improve comments in lock.cat Paul E. McKenney
2018-05-15 6:33 ` [tip:locking/core] " tip-bot for Alan Stern
2018-05-14 23:33 ` [PATCH memory-model 14/19] tools/memory-model: Improve mixed-access checking " Paul E. McKenney
2018-05-15 6:33 ` [tip:locking/core] " tip-bot for Alan Stern
2018-05-14 23:33 ` [PATCH memory-model 15/19] tools/memory-model: Remove out-of-date comments and code from lock.cat Paul E. McKenney
2018-05-15 6:34 ` [tip:locking/core] " tip-bot for Alan Stern
2018-05-14 23:33 ` [PATCH memory-model 16/19] tools/memory-model: Fix coding style in 'lock.cat' Paul E. McKenney
2018-05-15 6:34 ` [tip:locking/core] " tip-bot for Andrea Parri
2018-05-14 23:33 ` [PATCH memory-model 17/19] MAINTAINERS: Update e-mail address for Andrea Parri Paul E. McKenney
2018-05-15 6:35 ` [tip:locking/core] MAINTAINERS, tools/memory-model: " tip-bot for Andrea Parri
2018-05-14 23:33 ` [PATCH memory-model 18/19] tools/memory-model: Update ASPLOS information Paul E. McKenney
2018-05-15 6:35 ` [tip:locking/core] " tip-bot for Andrea Parri
2018-05-14 23:33 ` [PATCH memory-model 19/19] tools/memory-model: Add reference for 'Simplifying ARM concurrency' Paul E. McKenney
2018-05-15 6:36 ` [tip:locking/core] " tip-bot for Andrea Parri
2018-05-15 6:15 ` [PATCH memory-model 0/19] Updates to the formal memory model Ingo Molnar
2018-05-15 16:20 ` Paul E. McKenney
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-8559183ccaec97454b2515ac426f113967256cf9@git.kernel.org \
--to=tipbot@zytor.com \
--cc=akiyks@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=andrea.parri@amarulasolutions.com \
--cc=boqun.feng@gmail.com \
--cc=dhowells@redhat.com \
--cc=hpa@zytor.com \
--cc=j.alglave@ucl.ac.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=luc.maranget@inria.fr \
--cc=mingo@kernel.org \
--cc=npiggin@gmail.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=stern@rowland.harvard.edu \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=will.deacon@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).