From: Thomas Gleixner <tglx@linutronix.de>
To: Joel Fernandes <joel@joelfernandes.org>
Cc: Alan Stern <stern@rowland.harvard.edu>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
rostedt <rostedt@goodmis.org>,
Valentin Schneider <valentin.schneider@arm.com>,
linux-kernel <linux-kernel@vger.kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
paulmck <paulmck@linux.ibm.com>,
Boqun Feng <boqun.feng@gmail.com>,
Will Deacon <will.deacon@arm.com>,
David Howells <dhowells@redhat.com>,
Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH 1/1] Fix: trace sched switch start/stop racy updates
Date: Fri, 16 Aug 2019 22:49:04 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.21.1908162245440.1923@nanos.tec.linutronix.de> (raw)
In-Reply-To: <CAEXW_YQrh42N5bYMmQJCFb6xa0nwXH8jmZMEAnGVBMjGF8wR1Q@mail.gmail.com>
On Fri, 16 Aug 2019, Joel Fernandes wrote:
> On Fri, Aug 16, 2019 at 3:19 PM Alan Stern <stern@rowland.harvard.edu> wrote:
> > On Fri, 16 Aug 2019, Mathieu Desnoyers wrote:
> >
> > > If you choose not to use READ_ONCE(), then the "load tearing" issue can
> > > cause similar spurious 1 -> 0 -> 1 transitions near 16-bit counter
> > > overflow as described above. The "Invented load" also becomes an issue,
> > > because the compiler could use the loaded value for a branch, and re-load
> > > that value between two branches which are expected to use the same value,
> > > effectively generating a corrupted state.
> > >
> > > I think we need a statement about whether READ_ONCE/WRITE_ONCE should
> > > be used in this kind of situation, or if we are fine dealing with the
> > > awkward compiler side-effects when they will occur.
> >
> > The only real downside (apart from readability) of READ_ONCE and
> > WRITE_ONCE is that they prevent the compiler from optimizing accesses
> > to the location being read or written. But if you're just doing a
> > single access in each place, not multiple accesses, then there's
> > nothing to optimize anyway. So there's no real reason not to use
> > READ_ONCE or WRITE_ONCE.
>
> I am also more on the side of using *_ONCE. To me, by principal, I
> would be willing to convert any concurrent plain access using _ONCE,
> just so we don't have to worry about it now or in the future and also
> documents the access.
By that argumentation we need to plaster half of the kernel with _ONCE()
and I'm so not looking forward to the insane amount of script kiddies
patches to do that.
Can we finally put a foot down and tell compiler and standard committee
people to stop this insanity?
Thanks,
tglx
next prev parent reply other threads:[~2019-08-16 20:49 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-18 10:29 WARNING in tracepoint_probe_register_prio (3) syzbot
2019-08-16 0:11 ` syzbot
2019-08-16 14:26 ` [PATCH 1/1] Fix: trace sched switch start/stop racy updates Mathieu Desnoyers
2019-08-16 16:25 ` Steven Rostedt
2019-08-16 16:48 ` Valentin Schneider
2019-08-16 17:04 ` Steven Rostedt
2019-08-16 17:41 ` Mathieu Desnoyers
2019-08-16 19:18 ` Steven Rostedt
2019-08-16 19:19 ` Alan Stern
2019-08-16 20:44 ` Joel Fernandes
2019-08-16 20:49 ` Thomas Gleixner [this message]
2019-08-16 20:57 ` Joel Fernandes
2019-08-16 22:27 ` Valentin Schneider
2019-08-16 22:57 ` Linus Torvalds
2019-08-17 1:41 ` Mathieu Desnoyers
2019-08-17 4:52 ` Paul E. McKenney
2019-08-17 8:28 ` Linus Torvalds
2019-08-17 8:44 ` Linus Torvalds
2019-08-17 15:02 ` Mathieu Desnoyers
2019-08-17 20:03 ` Valentin Schneider
2019-08-17 23:00 ` Paul E. McKenney
2019-08-19 10:34 ` Valentin Schneider
2019-08-17 22:28 ` Paul E. McKenney
2019-08-20 14:01 ` Peter Zijlstra
2019-08-20 20:31 ` Paul E. McKenney
2019-08-20 20:39 ` Peter Zijlstra
2019-08-20 20:52 ` Paul E. McKenney
2019-08-16 21:04 ` Linus Torvalds
2019-08-17 1:36 ` Mathieu Desnoyers
2019-08-17 2:13 ` Steven Rostedt
2019-08-17 14:40 ` Mathieu Desnoyers
2019-08-17 15:26 ` Steven Rostedt
2019-08-17 15:55 ` Mathieu Desnoyers
2019-08-17 16:40 ` Steven Rostedt
2019-08-17 22:06 ` Paul E. McKenney
2019-08-17 8:08 ` Linus Torvalds
2019-08-20 13:56 ` Peter Zijlstra
2019-08-20 20:29 ` Paul E. McKenney
2019-08-21 10:32 ` Will Deacon
2019-08-21 13:23 ` Paul E. McKenney
2019-08-21 13:32 ` Will Deacon
2019-08-21 13:56 ` Paul E. McKenney
2019-08-21 16:22 ` Will Deacon
2019-08-21 15:33 ` Peter Zijlstra
2019-08-21 15:48 ` Mathieu Desnoyers
2019-08-21 16:14 ` Paul E. McKenney
2019-08-21 19:03 ` Joel Fernandes
2019-09-09 6:21 ` Herbert Xu
2019-08-16 20:49 ` Steven Rostedt
2019-08-16 20:59 ` Joel Fernandes
2019-08-17 1:25 ` Mathieu Desnoyers
2019-08-18 9:15 ` stable markup was " Pavel Machek
2019-08-16 17:19 ` Mathieu Desnoyers
2019-08-16 19:15 ` Steven Rostedt
2019-08-17 14:27 ` Mathieu Desnoyers
2019-08-17 15:42 ` Steven Rostedt
2019-08-17 15:53 ` Mathieu Desnoyers
2019-08-17 16:43 ` Steven Rostedt
2019-08-16 12:32 ` WARNING in tracepoint_probe_register_prio (3) syzbot
2019-08-16 12:41 ` Sebastian Andrzej Siewior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.21.1908162245440.1923@nanos.tec.linutronix.de \
--to=tglx@linutronix.de \
--cc=boqun.feng@gmail.com \
--cc=dhowells@redhat.com \
--cc=joel@joelfernandes.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=paulmck@linux.ibm.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=stern@rowland.harvard.edu \
--cc=torvalds@linux-foundation.org \
--cc=valentin.schneider@arm.com \
--cc=will.deacon@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).