From: Boqun Feng <boqun.feng@gmail.com>
To: "Paul E. McKenney" <paulmck@kernel.org>
Cc: Andrea Parri <parri.andrea@gmail.com>,
Alan Stern <stern@rowland.harvard.edu>,
Jonas Oberhauser <jonas.oberhauser@huaweicloud.com>,
will@kernel.org, peterz@infradead.org, npiggin@gmail.com,
dhowells@redhat.com, j.alglave@ucl.ac.uk, luc.maranget@inria.fr,
akiyks@gmail.com, dlustig@nvidia.com, joel@joelfernandes.org,
urezki@gmail.com, quic_neeraju@quicinc.com, frederic@kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] tools/memory-model: Make ppo a subrelation of po
Date: Sun, 29 Jan 2023 13:43:53 -0800 [thread overview]
Message-ID: <Y9bomciHJ/6WGYM0@boqun-archlinux> (raw)
In-Reply-To: <20230129184403.GJ2948950@paulmck-ThinkPad-P17-Gen-1>
On Sun, Jan 29, 2023 at 10:44:03AM -0800, Paul E. McKenney wrote:
> On Sun, Jan 29, 2023 at 06:28:27PM +0100, Andrea Parri wrote:
> > > Why can't P3's spin_lock() read from that initial write?
> >
> > Mmh, sounds like you want to play with something like below?
> >
> > Andrea
> >
> > diff --git a/tools/memory-model/lock.cat b/tools/memory-model/lock.cat
> > index 6b52f365d73ac..20c3af4511255 100644
> > --- a/tools/memory-model/lock.cat
> > +++ b/tools/memory-model/lock.cat
> > @@ -74,7 +74,6 @@ flag ~empty UL \ range(critical) as unmatched-unlock
> >
> > (* Allow up to one unmatched LKW per location; more must deadlock *)
> > let UNMATCHED-LKW = LKW \ domain(critical)
> > -empty ([UNMATCHED-LKW] ; loc ; [UNMATCHED-LKW]) \ id as unmatched-locks
> >
> > (* rfi for LF events: link each LKW to the LF events in its critical section *)
> > let rfi-lf = ([LKW] ; po-loc ; [LF]) \ ([LKW] ; po-loc ; [UL] ; po-loc)
> > @@ -120,8 +119,7 @@ let rf-ru = rfe-ru | rfi-ru
> > let rf = rf | rf-lf | rf-ru
> >
> > (* Generate all co relations, including LKW events but not UL *)
> > -let co0 = co0 | ([IW] ; loc ; [LKW]) |
> > - (([LKW] ; loc ; [UNMATCHED-LKW]) \ [UNMATCHED-LKW])
> > +let co0 = co0 | ([IW] ; loc ; [LKW])
> > include "cos-opt.cat"
> > let W = W | UL
> > let M = R | W
>
> No idea. But the following litmus test gets no executions whatsoever,
> so point taken about my missing at least one corner case. ;-)
>
> Adding a spin_unlock() to the end of either process allows both to
> run.
>
> One could argue that this is a bug, but one could equally well argue
> that if you have a deadlock, you have a deadlock.
>
in lock.cat:
(* Allow up to one unmatched LKW per location; more must deadlock *)
let UNMATCHED-LKW = LKW \ domain(critical)
empty ([UNMATCHED-LKW] ; loc ; [UNMATCHED-LKW]) \ id as unmatched-locks
we rule out deadlocks from the execution candidates we care about.
Regards,
Boqun
> Thoughts?
>
> Thanx, Paul
>
> ------------------------------------------------------------------------
>
> C lock
>
> {
> }
>
>
> P0(int *a, int *b, spinlock_t *l)
> {
> spin_lock(l);
> WRITE_ONCE(*a, 1);
> }
>
> P1(int *a, int *b, spinlock_t *l)
> {
> spin_lock(l);
> WRITE_ONCE(*b, 1);
> }
>
> exists (a=1 /\ b=1)
next prev parent reply other threads:[~2023-01-29 21:44 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-26 13:46 [PATCH v2 0/2] Streamlining treatment of smp_mb__after_unlock_lock Jonas Oberhauser
2023-01-26 13:46 ` [PATCH v2 1/2] tools/memory-model: Unify UNLOCK+LOCK pairings to po-unlock-lock-po Jonas Oberhauser
2023-01-26 16:36 ` Alan Stern
2023-01-26 20:08 ` Paul E. McKenney
2023-01-26 23:21 ` Paul E. McKenney
2023-01-27 13:18 ` Jonas Oberhauser
2023-01-27 15:13 ` Paul E. McKenney
2023-01-27 15:57 ` Jonas Oberhauser
2023-01-27 16:48 ` Paul E. McKenney
2023-01-26 13:46 ` [PATCH v2 2/2] tools/memory-model: Make ppo a subrelation of po Jonas Oberhauser
2023-01-26 16:36 ` Alan Stern
2023-01-27 14:31 ` Jonas Oberhauser
2023-01-28 19:56 ` Alan Stern
2023-01-28 22:14 ` Andrea Parri
2023-01-28 22:21 ` Andrea Parri
2023-01-28 22:59 ` Alan Stern
2023-01-29 5:17 ` Paul E. McKenney
2023-01-29 16:03 ` Alan Stern
2023-01-29 16:21 ` Paul E. McKenney
2023-01-29 17:28 ` Andrea Parri
2023-01-29 18:44 ` Paul E. McKenney
2023-01-29 21:43 ` Boqun Feng [this message]
2023-01-29 23:09 ` Paul E. McKenney
2023-01-30 2:18 ` Alan Stern
2023-01-30 4:43 ` Paul E. McKenney
2023-01-29 19:17 ` Paul E. McKenney
2023-01-29 17:11 ` Andrea Parri
2023-01-29 22:10 ` Alan Stern
2023-01-29 22:19 ` Jonas Oberhauser
2023-01-30 2:39 ` Alan Stern
2023-01-30 4:36 ` Paul E. McKenney
2023-01-30 16:47 ` Alan Stern
2023-01-30 16:50 ` Paul E. McKenney
2023-01-31 13:56 ` Jonas Oberhauser
2023-01-31 15:06 ` Alan Stern
2023-01-31 15:33 ` Jonas Oberhauser
2023-01-31 16:55 ` Alan Stern
2023-02-01 10:37 ` Jonas Oberhauser
2023-01-30 4:46 ` 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=Y9bomciHJ/6WGYM0@boqun-archlinux \
--to=boqun.feng@gmail.com \
--cc=akiyks@gmail.com \
--cc=dhowells@redhat.com \
--cc=dlustig@nvidia.com \
--cc=frederic@kernel.org \
--cc=j.alglave@ucl.ac.uk \
--cc=joel@joelfernandes.org \
--cc=jonas.oberhauser@huaweicloud.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luc.maranget@inria.fr \
--cc=npiggin@gmail.com \
--cc=parri.andrea@gmail.com \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=quic_neeraju@quicinc.com \
--cc=stern@rowland.harvard.edu \
--cc=urezki@gmail.com \
--cc=will@kernel.org \
/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