[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230129230900.GK2948950@paulmck-ThinkPad-P17-Gen-1>
Date: Sun, 29 Jan 2023 15:09:00 -0800
From: "Paul E. McKenney" <paulmck@...nel.org>
To: Boqun Feng <boqun.feng@...il.com>
Cc: Andrea Parri <parri.andrea@...il.com>,
Alan Stern <stern@...land.harvard.edu>,
Jonas Oberhauser <jonas.oberhauser@...weicloud.com>,
will@...nel.org, peterz@...radead.org, npiggin@...il.com,
dhowells@...hat.com, j.alglave@....ac.uk, luc.maranget@...ia.fr,
akiyks@...il.com, dlustig@...dia.com, joel@...lfernandes.org,
urezki@...il.com, quic_neeraju@...cinc.com, frederic@...nel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/2] tools/memory-model: Make ppo a subrelation of po
On Sun, Jan 29, 2023 at 01:43:53PM -0800, Boqun Feng wrote:
> 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.
Thank you, Boqun!
Thanx, Paul
> 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)
Powered by blists - more mailing lists