[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200217174658.GC112239@google.com>
Date: Mon, 17 Feb 2020 12:46:58 -0500
From: Joel Fernandes <joel@...lfernandes.org>
To: Peter Zijlstra <peterz@...radead.org>
Cc: paulmck@...nel.org, rcu@...r.kernel.org,
linux-kernel@...r.kernel.org, kernel-team@...com, mingo@...nel.org,
jiangshanlai@...il.com, dipankar@...ibm.com,
akpm@...ux-foundation.org, mathieu.desnoyers@...icios.com,
josh@...htriplett.org, tglx@...utronix.de, rostedt@...dmis.org,
dhowells@...hat.com, edumazet@...gle.com, fweisbec@...il.com,
oleg@...hat.com
Subject: Re: [PATCH tip/core/rcu 1/4] srcu: Fix __call_srcu()/process_srcu()
datarace
On Mon, Feb 17, 2020 at 06:11:04PM +0100, Peter Zijlstra wrote:
> On Mon, Feb 17, 2020 at 12:01:57PM -0500, Joel Fernandes wrote:
>
> > Peter it sounds like you have a failure scenario in mind. Could you describe
> > more if so?
> >
> > I am curious if you were thinking of invented-stores issue here.
> >
> > For educational purposes, I was trying to come up with an example where my
> > compiler does something bad to code without WRITE_ONCE(). So far I only can
> > reproduce a write-tearing example when write with an immediate value is split
> > into 2 writes, like Will mentioned:
> > http://lore.kernel.org/r/20190821103200.kpufwtviqhpbuv2n@willie-the-truck
> > But that does not seem to apply to this code.
>
> > > > - snp->srcu_gp_seq_needed_exp = gpseq;
> > > > + WRITE_ONCE(snp->srcu_gp_seq_needed_exp, gpseq);
>
> Yeah, store tearing. No sane compiler will actually do that, but it is
> allowed to do random permutations of byte stores just to fuck with us.
>
> WRITE_ONCE() disallows that.
>
> In that case, the READ_ONCE()s could observe garbage and the compare
> might accidentally report the wrong thing.
Oh ok, I understand what you mean now. Thank you for clarification!
thanks,
- Joel
Powered by blists - more mailing lists