[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230116042329.GN2948950@paulmck-ThinkPad-P17-Gen-1>
Date: Sun, 15 Jan 2023 20:23:29 -0800
From: "Paul E. McKenney" <paulmck@...nel.org>
To: Alan Stern <stern@...land.harvard.edu>
Cc: Jonas Oberhauser <jonas.oberhauser@...wei.com>,
Peter Zijlstra <peterz@...radead.org>,
"parri.andrea" <parri.andrea@...il.com>, will <will@...nel.org>,
"boqun.feng" <boqun.feng@...il.com>, npiggin <npiggin@...il.com>,
dhowells <dhowells@...hat.com>,
"j.alglave" <j.alglave@....ac.uk>,
"luc.maranget" <luc.maranget@...ia.fr>, akiyks <akiyks@...il.com>,
dlustig <dlustig@...dia.com>, joel <joel@...lfernandes.org>,
urezki <urezki@...il.com>,
quic_neeraju <quic_neeraju@...cinc.com>,
frederic <frederic@...nel.org>,
Kernel development list <linux-kernel@...r.kernel.org>
Subject: Re: Internal vs. external barriers (was: Re: Interesting LKMM litmus
test)
On Sun, Jan 15, 2023 at 03:46:10PM -0500, Alan Stern wrote:
> On Sun, Jan 15, 2023 at 10:10:52AM -0800, Paul E. McKenney wrote:
> > On Sun, Jan 15, 2023 at 11:23:31AM -0500, Alan Stern wrote:
> > > On Sat, Jan 14, 2023 at 09:15:10PM -0800, Paul E. McKenney wrote:
> > > > What am I missing here?
> > >
> > > I don't think you're missing anything. This is a matter for Boqun or
> > > Luc; it must have something to do with the way herd treats the
> > > srcu_read_lock() and srcu_read_unlock() primitives.
> >
> > It looks like we need something that tracks (data | rf)* between
> > the return value of srcu_read_lock() and the second parameter of
> > srcu_read_unlock(). The reason for rf rather than rfi is the upcoming
> > srcu_down_read() and srcu_up_read().
>
> Or just make herd treat srcu_read_lock(s) as an annotated equivalent of
> READ_ONCE(&s) and srcu_read_unlock(s, v) as an annotated equivalent of
> WRITE_ONCE(s, v). But with some special accomodation to avoid
> interaction with the new carry-dep relation.
This is a modification to herd7 you are suggesting? Otherwise, I am
suffering a failure of imagination on how to properly sort it from the
other READ_ONCE() and WRITE_ONCE() instances.
> > But what I will do in the meantime is to switch back to a commit that
> > simply flags nesting of same-srcu_struct SRCU read-side critical sections,
> > while blindly assuming that the return value of a given srcu_read_lock()
> > is passed in to the corresponding srcu_read_unlock():
> >
> > ------------------------------------------------------------------------
> >
> > (* Compute matching pairs of Srcu-lock and Srcu-unlock, but prohibit nesting *)
> > let srcu-unmatched = Srcu-lock | Srcu-unlock
> > let srcu-unmatched-po = ([srcu-unmatched] ; po ; [srcu-unmatched]) & loc
> > let srcu-unmatched-locks-to-unlock = ([Srcu-lock] ; po ; [Srcu-unlock]) & loc
> > let srcu-rscs = srcu-unmatched-locks-to-unlock \ (srcu-unmatched-po ; srcu-unmatched-po)
> >
> > (* 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
> >
> > (* Validate SRCU dynamic match *)
> > flag ~empty different-values(srcu-rscs) as srcu-bad-nesting
> >
> > ------------------------------------------------------------------------
> >
> > Or is there some better intermediate position that could be taken?
>
> Do you mean go back to the current linux-kernel.bell? The code you
> wrote above is different, since it prohibits nesting.
Not to the current linux-kernel.bell, but, as you say, making the change
to obtain a better approximation by prohibiting nesting.
Thanx, Paul
Powered by blists - more mailing lists