Re: Internal vs. external barriers (was: Re: Interesting LKMM litmus test)

From: Paul E. McKenney
Date: Thu Jan 19 2023 - 14:10:16 EST


On Wed, Jan 18, 2023 at 09:41:38AM -0800, Paul E. McKenney wrote:
> On Wed, Jan 18, 2023 at 11:03:35AM -0500, Alan Stern wrote:
> > On Tue, Jan 17, 2023 at 09:17:04PM -0800, Paul E. McKenney wrote:
> > > On Tue, Jan 17, 2023 at 09:15:15PM -0500, Alan Stern wrote:
> > > > Maybe we don't. Please test the patch below; I think it will do what
> > > > you want -- and it doesn't rule out nesting.
> > >
> > > It works like a champ on manual/kernel/C-srcu*.litmus in the litmus
> > > repository on github, good show and thank you!!!
> > >
> > > I will make more tests, and am checking this against the rest of the
> > > litmus tests in the repo, but in the meantime would you be willing to
> > > have me add your Signed-off-by?
> >
> > I'll email a real patch submission in the not-too-distant future,
> > assuming you don't find any problems with the new code.
>
> Sounds good!
>
> The current state is that last night's testing found a difference only
> for C-srcu-nest-5.litmus, in which case your version gives the correct
> answer and mainline is wrong. There were a couple of broken tests, which
> I fixed and a test involving spin_unlock_wait(), which is at this point
> perma-broken due to the Linux kernel no longer having such a thing.
> (Other than its re-introduction into i915, but they define it as a
> spin_lock_irq() followed by a spin_unlock_irq(), so why worry?)
> There were also a few timeouts.
>
> I intend to run the longer tests overnight.

Except that I had an episode of pilot error. :-/

But here are a couple of litmus tests illustrating how SRCU read-side
critical sections do not flatten/fuse the way that RCU read-side critical
sections do.

Why the difference? Because such a Linux-kernel SRCU implementation
would require additional storage of the order (T * S), where T is
the number of tasks and S is the number of srcu_struct structures.
That just won't be happening.

Here they are, and both behave the way that I would expect given your
unofficial patch:

https://github.com/paulmckrcu/litmus/blob/master/manual/kernel/C-srcu-nest-7.litmus
https://github.com/paulmckrcu/litmus/blob/master/manual/kernel/C-srcu-nest-8.litmus

Whew! ;-)

Thanx, Paul