Re: [patch 3/3] tick: Annotate tick_do_timer_cpu data races

2020-12-17 Thread Paul E. McKenney
On Thu, Dec 17, 2020 at 11:48:23AM +0100, Peter Zijlstra wrote: > On Wed, Dec 16, 2020 at 01:19:31PM -0800, Paul E. McKenney wrote: > > Given that there is no optimization potential, then the main reason to use > > data_race() instead of *_ONCE() is to prevent KCSAN from considering the > >

Re: [patch 3/3] tick: Annotate tick_do_timer_cpu data races

2020-12-17 Thread Peter Zijlstra
On Wed, Dec 16, 2020 at 01:19:31PM -0800, Paul E. McKenney wrote: > Given that there is no optimization potential, then the main reason to use > data_race() instead of *_ONCE() is to prevent KCSAN from considering the > accesses when looking for data races. But that is mostly for debugging >

Re: [patch 3/3] tick: Annotate tick_do_timer_cpu data races

2020-12-16 Thread Paul E. McKenney
On Wed, Dec 16, 2020 at 10:23:57PM +0100, Thomas Gleixner wrote: > On Wed, Dec 16 2020 at 13:19, Paul E. McKenney wrote: > > On Wed, Dec 16, 2020 at 01:27:43AM +0100, Thomas Gleixner wrote: > >> So my intent was to document that this code does not care about anything > >> else than what I'd

Re: [patch 3/3] tick: Annotate tick_do_timer_cpu data races

2020-12-16 Thread Thomas Gleixner
On Wed, Dec 16 2020 at 13:19, Paul E. McKenney wrote: > On Wed, Dec 16, 2020 at 01:27:43AM +0100, Thomas Gleixner wrote: >> So my intent was to document that this code does not care about anything >> else than what I'd consider to be plain compiler bugs. >> >> My conclusion might be wrong as

Re: [patch 3/3] tick: Annotate tick_do_timer_cpu data races

2020-12-16 Thread Paul E. McKenney
On Wed, Dec 16, 2020 at 01:27:43AM +0100, Thomas Gleixner wrote: > On Tue, Dec 08 2020 at 07:03, Paul E. McKenney wrote: > > > On Tue, Dec 08, 2020 at 09:11:29AM +0100, Peter Zijlstra wrote: > >> On Mon, Dec 07, 2020 at 11:44:06AM -0800, Paul E. McKenney wrote: > >> > >> > Also, in this

Re: [patch 3/3] tick: Annotate tick_do_timer_cpu data races

2020-12-15 Thread Thomas Gleixner
On Tue, Dec 08 2020 at 07:03, Paul E. McKenney wrote: > On Tue, Dec 08, 2020 at 09:11:29AM +0100, Peter Zijlstra wrote: >> On Mon, Dec 07, 2020 at 11:44:06AM -0800, Paul E. McKenney wrote: >> >> > Also, in this particular case, why data_race() rather than READ_ONCE()? >> > Do we really expect

Re: [patch 3/3] tick: Annotate tick_do_timer_cpu data races

2020-12-08 Thread Paul E. McKenney
On Tue, Dec 08, 2020 at 09:11:29AM +0100, Peter Zijlstra wrote: > On Mon, Dec 07, 2020 at 11:44:06AM -0800, Paul E. McKenney wrote: > > > Also, in this particular case, why data_race() rather than READ_ONCE()? > > Do we really expect the compiler to be able to optimize this case > > significantly

Re: [patch 3/3] tick: Annotate tick_do_timer_cpu data races

2020-12-08 Thread Peter Zijlstra
On Mon, Dec 07, 2020 at 11:44:06AM -0800, Paul E. McKenney wrote: > Also, in this particular case, why data_race() rather than READ_ONCE()? > Do we really expect the compiler to be able to optimize this case > significantly without READ_ONCE()? It's about intent and how the code reads.

Re: [patch 3/3] tick: Annotate tick_do_timer_cpu data races

2020-12-08 Thread Peter Zijlstra
On Mon, Dec 07, 2020 at 07:19:51PM +0100, Marco Elver wrote: > On Mon, 7 Dec 2020 at 18:46, Thomas Gleixner 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) ==

Re: [patch 3/3] tick: Annotate tick_do_timer_cpu data races

2020-12-07 Thread Paul E. McKenney
On Mon, Dec 07, 2020 at 11:46:48PM +0100, Thomas Gleixner wrote: > On Mon, Dec 07 2020 at 14:38, Paul E. McKenney wrote: > > > On Mon, Dec 07, 2020 at 10:46:33PM +0100, Thomas Gleixner wrote: > >> On Mon, Dec 07 2020 at 11:44, Paul E. McKenney wrote: > >> > On Mon, Dec 07, 2020 at 07:19:51PM

Re: [patch 3/3] tick: Annotate tick_do_timer_cpu data races

2020-12-07 Thread Thomas Gleixner
On Mon, Dec 07 2020 at 14:38, Paul E. McKenney wrote: > On Mon, Dec 07, 2020 at 10:46:33PM +0100, Thomas Gleixner wrote: >> On Mon, Dec 07 2020 at 11:44, Paul E. McKenney wrote: >> > On Mon, Dec 07, 2020 at 07:19:51PM +0100, Marco Elver wrote: >> >> On Mon, 7 Dec 2020 at 18:46, Thomas Gleixner

Re: [patch 3/3] tick: Annotate tick_do_timer_cpu data races

2020-12-07 Thread Paul E. McKenney
On Mon, Dec 07, 2020 at 10:46:33PM +0100, Thomas Gleixner wrote: > On Mon, Dec 07 2020 at 11:44, Paul E. McKenney wrote: > > On Mon, Dec 07, 2020 at 07:19:51PM +0100, Marco Elver wrote: > >> On Mon, 7 Dec 2020 at 18:46, Thomas Gleixner wrote: > >> I currently don't know what the rule for Peter's

Re: [patch 3/3] tick: Annotate tick_do_timer_cpu data races

2020-12-07 Thread Thomas Gleixner
On Mon, Dec 07 2020 at 11:44, Paul E. McKenney wrote: > On Mon, Dec 07, 2020 at 07:19:51PM +0100, Marco Elver wrote: >> On Mon, 7 Dec 2020 at 18:46, Thomas Gleixner wrote: >> I currently don't know what the rule for Peter's preferred variant >> would be, without running the risk of some

Re: [patch 3/3] tick: Annotate tick_do_timer_cpu data races

2020-12-07 Thread Paul E. McKenney
On Mon, Dec 07, 2020 at 07:19:51PM +0100, Marco Elver wrote: > On Mon, 7 Dec 2020 at 18:46, Thomas Gleixner 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) ==

Re: [patch 3/3] tick: Annotate tick_do_timer_cpu data races

2020-12-07 Thread Thomas Gleixner
On Mon, Dec 07 2020 at 19:19, Marco Elver wrote: > On Mon, 7 Dec 2020 at 18:46, Thomas Gleixner wrote: >> On Mon, Dec 07 2020 at 13:09, Peter Zijlstra wrote: >> > I prefer the form: >> > >> > if (data_race(tick_do_timer_cpu == TICK_DO_TIMER_BOOT)) { >> > >> > But there doesn't yet seem to

Re: [patch 3/3] tick: Annotate tick_do_timer_cpu data races

2020-12-07 Thread Marco Elver
On Mon, 7 Dec 2020 at 18:46, Thomas Gleixner 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

Re: [patch 3/3] tick: Annotate tick_do_timer_cpu data races

2020-12-07 Thread Thomas Gleixner
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

Re: [patch 3/3] tick: Annotate tick_do_timer_cpu data races

2020-12-07 Thread Peter Zijlstra
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