Re: [PATCH 2/2] x86/percpu: Fix this_cpu_read()

2018-10-11 Thread Eric Dumazet
On Thu, Oct 11, 2018 at 8:50 AM Peter Zijlstra wrote: > Right; it goes back a long long way... is: > > 7c3576d261ce ("[PATCH] i386: Convert PDA into the percpu section") > > early enough? That introduces percpu_from_op(), but arguably the > pda_from_op() it replaces was buggy already. Yeah I

Re: [PATCH 2/2] x86/percpu: Fix this_cpu_read()

2018-10-11 Thread Eric Dumazet
On Thu, Oct 11, 2018 at 8:50 AM Peter Zijlstra wrote: > Right; it goes back a long long way... is: > > 7c3576d261ce ("[PATCH] i386: Convert PDA into the percpu section") > > early enough? That introduces percpu_from_op(), but arguably the > pda_from_op() it replaces was buggy already. Yeah I

Re: [PATCH 2/2] x86/percpu: Fix this_cpu_read()

2018-10-11 Thread Peter Zijlstra
On Thu, Oct 11, 2018 at 08:24:49AM -0700, Eric Dumazet wrote: > On Thu, Oct 11, 2018 at 8:02 AM Eric Dumazet wrote: > > > > On Thu, Oct 11, 2018 at 3:45 AM Peter Zijlstra wrote: > > > > > > Eric reported that a sequence count loop using this_cpu_read() got > > > optimized out. This is wrong,

Re: [PATCH 2/2] x86/percpu: Fix this_cpu_read()

2018-10-11 Thread Peter Zijlstra
On Thu, Oct 11, 2018 at 08:24:49AM -0700, Eric Dumazet wrote: > On Thu, Oct 11, 2018 at 8:02 AM Eric Dumazet wrote: > > > > On Thu, Oct 11, 2018 at 3:45 AM Peter Zijlstra wrote: > > > > > > Eric reported that a sequence count loop using this_cpu_read() got > > > optimized out. This is wrong,

Re: [PATCH 2/2] x86/percpu: Fix this_cpu_read()

2018-10-11 Thread Eric Dumazet
On Thu, Oct 11, 2018 at 8:02 AM Eric Dumazet wrote: > > On Thu, Oct 11, 2018 at 3:45 AM Peter Zijlstra wrote: > > > > Eric reported that a sequence count loop using this_cpu_read() got > > optimized out. This is wrong, this_cpu_read() must imply READ_ONCE() > > because the interface is IRQ-safe,

Re: [PATCH 2/2] x86/percpu: Fix this_cpu_read()

2018-10-11 Thread Eric Dumazet
On Thu, Oct 11, 2018 at 8:02 AM Eric Dumazet wrote: > > On Thu, Oct 11, 2018 at 3:45 AM Peter Zijlstra wrote: > > > > Eric reported that a sequence count loop using this_cpu_read() got > > optimized out. This is wrong, this_cpu_read() must imply READ_ONCE() > > because the interface is IRQ-safe,

Re: [PATCH 2/2] x86/percpu: Fix this_cpu_read()

2018-10-11 Thread Eric Dumazet
On Thu, Oct 11, 2018 at 3:45 AM Peter Zijlstra wrote: > > Eric reported that a sequence count loop using this_cpu_read() got > optimized out. This is wrong, this_cpu_read() must imply READ_ONCE() > because the interface is IRQ-safe, therefore an interrupt can have > changed the per-cpu value. > >

Re: [PATCH 2/2] x86/percpu: Fix this_cpu_read()

2018-10-11 Thread Eric Dumazet
On Thu, Oct 11, 2018 at 3:45 AM Peter Zijlstra wrote: > > Eric reported that a sequence count loop using this_cpu_read() got > optimized out. This is wrong, this_cpu_read() must imply READ_ONCE() > because the interface is IRQ-safe, therefore an interrupt can have > changed the per-cpu value. > >

[PATCH 2/2] x86/percpu: Fix this_cpu_read()

2018-10-11 Thread Peter Zijlstra
Eric reported that a sequence count loop using this_cpu_read() got optimized out. This is wrong, this_cpu_read() must imply READ_ONCE() because the interface is IRQ-safe, therefore an interrupt can have changed the per-cpu value. Fixes: 59eaef78bfea ("x86/tsc: Remodel cyc2ns to use

[PATCH 2/2] x86/percpu: Fix this_cpu_read()

2018-10-11 Thread Peter Zijlstra
Eric reported that a sequence count loop using this_cpu_read() got optimized out. This is wrong, this_cpu_read() must imply READ_ONCE() because the interface is IRQ-safe, therefore an interrupt can have changed the per-cpu value. Fixes: 59eaef78bfea ("x86/tsc: Remodel cyc2ns to use