Re: [PATCH tip/core/rcu 4/4] srcu: Add READ_ONCE() to srcu_struct ->srcu_gp_seq load

From: Paul E. McKenney
Date: Tue Feb 18 2020 - 16:38:08 EST


On Tue, Feb 18, 2020 at 09:26:44PM +0100, Peter Zijlstra wrote:
> On Tue, Feb 18, 2020 at 08:34:05AM -0800, Paul E. McKenney wrote:
> > On Tue, Feb 18, 2020 at 12:43:34PM +0100, Peter Zijlstra wrote:
>
> > > Well, I didn't get further than the Changelog fails to describe an
> > > actual problem and it looks like compare-against-a-constant.
> > >
> > > (worse, it masks off everything but the 2 lowest bits, so even if there
> > > was a problem with load-tearing, it still wouldn't matter)
> >
> > There is still the possibility of load fusing.
>
> Agreed; that can be an issue. But if so, that then needs to be stated.
>
> > And the possibility
> > of defending against possible future changes as well as the current
> > snapshot of the code base.
>
> Sure; and like I said, if you want to use READ_ONCE() I'm not going to
> argue.
>
> > > I'm not going to argue with you if you want to use READ_ONCE() vs
> > > data_race() and a comment to denote false-positive KCSAN warnings, but I
> > > do feel somewhat strongly that the Changelog should describe the actual
> > > problem -- if there is one -- or just flat out state that this is to
> > > make KCSAN shut up but the code is fine.
> >
> > The problem is that "the code is fine" is highly subjective and varies
> > over time. :-/
> >
> > But in this case there was a real problem, just that I got confused
> > when analyzing.
>
> Shit happens :-)
>
> > > That is; every KCSAN report should be analysed, right? All I'm asking is
> > > for that analysis to end up in the Changelog.
> >
> > Before responding further, I have to ask...
> >
> > Are you intending your "every KCSAN report should be analyzed" to apply
> > globally or just when someone creates a patch based on such a report?
>
> Ideally every KCSAN report, but that is a longer term effort. But
> specifically, when someone has written a patch, I expect that same
> someone to have analysed the code. Then it also makes sense to put that
> in the Changelog.
>
> > In any case, you have acked this patch's successor (thank you very
> > much!), so on this specific patch (or more accurately, its successor)
> > I presume that we are all good.
>
> We are. That new patch describes a clear problem and fixes it.
>
> Anyway, the reaoson I'm being difficuly is partly because on the one
> hand I'm just an annoying pendant at times, but also because I've seen
> a bunch of, let's say, hasty, KCSAN patches.

Agreed. I briefly considered putting KCSAN for RCU on the newbie list,
but looking at a few of them put paid to that idea. Responding to them
properly does require a reasonably deep understanding of the code.

Thanx, Paul