From: Will Deacon <will@kernel.org>
To: Marco Elver <elver@google.com>
Cc: "Paul E. McKenney" <paulmck@kernel.org>,
Dmitry Vyukov <dvyukov@google.com>,
Alexander Potapenko <glider@google.com>,
Andrey Konovalov <andreyknvl@google.com>,
kasan-dev <kasan-dev@googlegroups.com>,
LKML <linux-kernel@vger.kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
clang-built-linux <clang-built-linux@googlegroups.com>
Subject: Re: [PATCH -tip 08/10] READ_ONCE, WRITE_ONCE: Remove data_race() wrapping
Date: Thu, 21 May 2020 11:22:14 +0100 [thread overview]
Message-ID: <20200521102214.GC5360@willie-the-truck> (raw)
In-Reply-To: <CANpmjNPLVMTSUAARL94Pug21ab4+zNikO1HYN2fVO3LfM4aMuQ@mail.gmail.com>
On Thu, May 21, 2020 at 12:18:14PM +0200, Marco Elver wrote:
> On Thu, 21 May 2020 at 11:47, Marco Elver <elver@google.com> wrote:
> > On Fri, 15 May 2020 at 17:04, Marco Elver <elver@google.com> wrote:
> > > diff --git a/include/linux/compiler.h b/include/linux/compiler.h
> > > index 17c98b215572..fce56402c082 100644
> > > --- a/include/linux/compiler.h
> > > +++ b/include/linux/compiler.h
> > > @@ -229,7 +229,7 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
> > > #define __READ_ONCE_SCALAR(x) \
> > > ({ \
> > > typeof(x) *__xp = &(x); \
> > > - __unqual_scalar_typeof(x) __x = data_race(__READ_ONCE(*__xp)); \
> > > + __unqual_scalar_typeof(x) __x = __READ_ONCE(*__xp); \
> > > kcsan_check_atomic_read(__xp, sizeof(*__xp)); \
> >
> > Some self-review: We don't need kcsan_check_atomic anymore, and this
> > should be removed.
> >
> > I'll send v2 to address this (together with fix to data_race()
> > removing nested statement expressions).
>
> The other thing here is that we no longer require __xp, and can just
> pass x into __READ_ONCE.
>
> > > smp_read_barrier_depends(); \
> > > (typeof(x))__x; \
> > > @@ -250,7 +250,7 @@ do { \
> > > do { \
> > > typeof(x) *__xp = &(x); \
> > > kcsan_check_atomic_write(__xp, sizeof(*__xp)); \
> >
> > Same.
>
> __xp can also be removed.
>
> Note that this effectively aliases __WRITE_ONCE_SCALAR to
> __WRITE_ONCE. To keep the API consistent with READ_ONCE, I assume we
> want to keep __WRITE_ONCE_SCALAR, in case it is meant to change in
> future?
Ha! So I think this ends up being very similar to what I had *before* I
rebased onto KCSAN:
https://git.kernel.org/pub/scm/linux/kernel/git/will/linux.git/tree/include/linux/compiler.h?h=rwonce/cleanup#n202
in which case you can drop __WRITE_ONCE_SCALAR; the _SCALAR things shouldn't
be used outside of the implementation anyway.
Will
next prev parent reply other threads:[~2020-05-21 10:22 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-15 15:03 [PATCH -tip 00/10] Fix KCSAN for new ONCE (require Clang 11) Marco Elver
2020-05-15 15:03 ` [PATCH -tip 01/10] ubsan, kcsan: don't combine sanitizer with kcov on clang Marco Elver
2020-05-15 15:03 ` [PATCH -tip 02/10] kcsan: Avoid inserting __tsan_func_entry/exit if possible Marco Elver
2020-05-15 15:03 ` [PATCH -tip 03/10] kcsan: Support distinguishing volatile accesses Marco Elver
2020-05-15 15:03 ` [PATCH -tip 04/10] kcsan: Pass option tsan-instrument-read-before-write to Clang Marco Elver
2020-05-15 15:03 ` [PATCH -tip 05/10] kcsan: Remove 'noinline' from __no_kcsan_or_inline Marco Elver
2020-05-15 15:03 ` [PATCH -tip 06/10] kcsan: Restrict supported compilers Marco Elver
2020-05-15 15:03 ` [PATCH -tip 07/10] kcsan: Update Documentation to change " Marco Elver
2020-05-15 15:03 ` [PATCH -tip 08/10] READ_ONCE, WRITE_ONCE: Remove data_race() wrapping Marco Elver
2020-05-21 9:47 ` Marco Elver
2020-05-21 10:18 ` Marco Elver
2020-05-21 10:22 ` Will Deacon [this message]
2020-05-15 15:03 ` [PATCH -tip 09/10] compiler.h: Move function attributes to compiler_types.h Marco Elver
2020-05-15 15:03 ` [PATCH -tip 10/10] compiler_types.h, kasan: Use __SANITIZE_ADDRESS__ instead of CONFIG_KASAN to decide inlining Marco Elver
2020-05-21 11:11 ` [PATCH -tip 00/10] Fix KCSAN for new ONCE (require Clang 11) Marco Elver
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=20200521102214.GC5360@willie-the-truck \
--to=will@kernel.org \
--cc=andreyknvl@google.com \
--cc=clang-built-linux@googlegroups.com \
--cc=dvyukov@google.com \
--cc=elver@google.com \
--cc=glider@google.com \
--cc=kasan-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/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
all inboxes | Powered by JetHome®