All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Marco Elver <elver@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	LKML <linux-kernel@vger.kernel.org>,
	kasan-dev <kasan-dev@googlegroups.com>,
	"Paul E. McKenney" <paulmck@kernel.org>,
	Ingo Molnar <mingo@kernel.org>,
	Frederic Weisbecker <frederic@kernel.org>,
	Will Deacon <will@kernel.org>,
	Naresh Kamboju <naresh.kamboju@linaro.org>,
	syzbot+23a256029191772c2f02@syzkaller.appspotmail.com,
	syzbot+56078ac0b9071335a745@syzkaller.appspotmail.com,
	syzbot+867130cb240c41f15164@syzkaller.appspotmail.com
Subject: Re: [patch 3/3] tick: Annotate tick_do_timer_cpu data races
Date: Tue, 8 Dec 2020 09:01:08 +0100	[thread overview]
Message-ID: <20201208080108.GP2414@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <CANpmjNNQiTbnkkj+ZHS5xxQuQfnWN_JGwSnN-_xqfa=raVrXHQ@mail.gmail.com>

On Mon, Dec 07, 2020 at 07:19:51PM +0100, Marco Elver wrote:
> On Mon, 7 Dec 2020 at 18:46, Thomas Gleixner <tglx@linutronix.de> wrote:
> > On Mon, Dec 07 2020 at 13:09, Peter Zijlstra wrote:
> > > On Sun, Dec 06, 2020 at 10:12:56PM +0100, Thomas Gleixner wrote:
> > >> +            if (data_race(tick_do_timer_cpu) == TICK_DO_TIMER_BOOT) {
> > >
> > > I prefer the form:
> > >
> > >       if (data_race(tick_do_timer_cpu == TICK_DO_TIMER_BOOT)) {
> > >
> > > But there doesn't yet seem to be sufficient data_race() usage in the
> > > kernel to see which of the forms is preferred. Do we want to bike-shed
> > > this now and document the outcome somewhere?
> >
> > Yes please before we get a gazillion of patches changing half of them
> > half a year from now.
> 
> That rule should be as simple as possible. The simplest would be:
> "Only enclose the smallest required expression in data_race(); keep
> the number of required data_race() expressions to a minimum." (=> want
> least amount of code inside data_race() with the least number of
> data_race()s).
> 
> In the case here, that'd be the "if (data_race(tick_do_timer_cpu) ==
> ..." variant.

So I was worried that data_race(var) == const, would not allow the
compiler to emit

	cmpq $CONST, ();

but would instead force a separate load. But I checked and it does
generate the right code.

  parent reply	other threads:[~2020-12-08  8:02 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-06 21:12 [patch 0/3] tick: Annotate and document the intentionaly racy tick_do_timer_cpu Thomas Gleixner
2020-12-06 21:12 ` [patch 1/3] tick: Remove pointless cpu valid check in hotplug code Thomas Gleixner
2020-12-07 11:59   ` Peter Zijlstra
2020-12-07 17:44     ` Thomas Gleixner
2020-12-11 22:21   ` Frederic Weisbecker
2020-12-12  0:16     ` Thomas Gleixner
2020-12-12  1:20       ` Frederic Weisbecker
2020-12-11 22:31   ` Frederic Weisbecker
2020-12-16 10:50   ` [tip: timers/urgent] " tip-bot2 for Thomas Gleixner
2020-12-06 21:12 ` [patch 2/3] tick/sched: Remove bogus boot "safety" check Thomas Gleixner
2020-12-11 22:41   ` Frederic Weisbecker
2020-12-16 10:50   ` [tip: timers/urgent] " tip-bot2 for Thomas Gleixner
2020-12-06 21:12 ` [patch 3/3] tick: Annotate tick_do_timer_cpu data races Thomas Gleixner
2020-12-07 12:09   ` Peter Zijlstra
2020-12-07 17:46     ` Thomas Gleixner
2020-12-07 18:19       ` Marco Elver
2020-12-07 19:43         ` Thomas Gleixner
2020-12-07 19:44         ` Paul E. McKenney
2020-12-07 21:46           ` Thomas Gleixner
2020-12-07 22:38             ` Paul E. McKenney
2020-12-07 22:46               ` Thomas Gleixner
2020-12-07 22:55                 ` Paul E. McKenney
2020-12-08  8:11           ` Peter Zijlstra
2020-12-08 15:03             ` Paul E. McKenney
2020-12-16  0:27               ` Thomas Gleixner
2020-12-16 21:19                 ` Paul E. McKenney
2020-12-16 21:23                   ` Thomas Gleixner
2020-12-16 21:32                     ` Paul E. McKenney
2020-12-17 10:48                   ` Peter Zijlstra
2020-12-17 14:59                     ` Paul E. McKenney
2020-12-08  8:01         ` Peter Zijlstra [this message]
2020-12-07 11:05 ` [patch 0/3] tick: Annotate and document the intentionaly racy tick_do_timer_cpu 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=20201208080108.GP2414@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=elver@google.com \
    --cc=frederic@kernel.org \
    --cc=kasan-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=naresh.kamboju@linaro.org \
    --cc=paulmck@kernel.org \
    --cc=syzbot+23a256029191772c2f02@syzkaller.appspotmail.com \
    --cc=syzbot+56078ac0b9071335a745@syzkaller.appspotmail.com \
    --cc=syzbot+867130cb240c41f15164@syzkaller.appspotmail.com \
    --cc=tglx@linutronix.de \
    --cc=will@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.