Re: [PATCH] percpu: make this_cpu_generic_read() atomic w.r.t. interrupts

2017-09-27 Thread Mark Rutland
On Wed, Sep 27, 2017 at 11:01:13AM +0200, Thomas Gleixner wrote: > The default for 32bit architectures is that they CANNOT do atomic > fetch/write of 8 bytes. Indeed. In addition, even the native word size accesses weren't guaranteed to be atomic, as we hadn't used the appropriate accessors to pr

Re: [PATCH] percpu: make this_cpu_generic_read() atomic w.r.t. interrupts

2017-09-27 Thread Thomas Gleixner
On Tue, 26 Sep 2017, Christopher Lameter wrote: > On Tue, 26 Sep 2017, Thomas Gleixner wrote: > > > > because it could also occur before or after the preempt_enable/disable > > > without the code being able to distinguish that case. > > > > > > The fetch of a scalar value from memory is an atomic

Re: [PATCH] percpu: make this_cpu_generic_read() atomic w.r.t. interrupts

2017-09-26 Thread Mark Rutland
Hi, On Tue, Sep 26, 2017 at 01:47:27AM -0500, Christopher Lameter wrote: > On Mon, 25 Sep 2017, Tejun Heo wrote: > > On Mon, Sep 25, 2017 at 04:33:02PM +0100, Mark Rutland wrote: > > > Unfortunately, the generic this_cpu_read(), which is intended to be > > > irq-safe, is not: > > > > > > #define t

Re: [PATCH] percpu: make this_cpu_generic_read() atomic w.r.t. interrupts

2017-09-26 Thread Christopher Lameter
On Tue, 26 Sep 2017, Thomas Gleixner wrote: > > because it could also occur before or after the preempt_enable/disable > > without the code being able to distinguish that case. > > > > The fetch of a scalar value from memory is an atomic operation and that is > > required from all arches. There is

Re: [PATCH] percpu: make this_cpu_generic_read() atomic w.r.t. interrupts

2017-09-26 Thread Thomas Gleixner
On Tue, 26 Sep 2017, Christopher Lameter wrote: > On Mon, 25 Sep 2017, Tejun Heo wrote: > > > Hello, > > > > On Mon, Sep 25, 2017 at 04:33:02PM +0100, Mark Rutland wrote: > > > Unfortunately, the generic this_cpu_read(), which is intended to be > > > irq-safe, is not: > > > > > > #define this_cpu_

Re: [PATCH] percpu: make this_cpu_generic_read() atomic w.r.t. interrupts

2017-09-25 Thread Christopher Lameter
On Mon, 25 Sep 2017, Tejun Heo wrote: > Hello, > > On Mon, Sep 25, 2017 at 04:33:02PM +0100, Mark Rutland wrote: > > Unfortunately, the generic this_cpu_read(), which is intended to be > > irq-safe, is not: > > > > #define this_cpu_generic_read(pcp) \ > > ({

Re: [PATCH] percpu: make this_cpu_generic_read() atomic w.r.t. interrupts

2017-09-25 Thread Tejun Heo
Hello, On Mon, Sep 25, 2017 at 04:33:02PM +0100, Mark Rutland wrote: > Unfortunately, the generic this_cpu_read(), which is intended to be > irq-safe, is not: > > #define this_cpu_generic_read(pcp) \ > ({

Re: [PATCH] percpu: make this_cpu_generic_read() atomic w.r.t. interrupts

2017-09-25 Thread Mark Rutland
On Mon, Sep 25, 2017 at 08:18:27AM -0700, Tejun Heo wrote: > Hello, Mark. > > On Mon, Sep 25, 2017 at 02:24:32PM +0100, Mark Rutland wrote: > > As raw_cpu_generic_read() is a plain read from a raw_cpu_ptr() address, > > it's possible (albeit unlikely) that the compiler will split the access > > ac

Re: [PATCH] percpu: make this_cpu_generic_read() atomic w.r.t. interrupts

2017-09-25 Thread Tejun Heo
Hello, Mark. On Mon, Sep 25, 2017 at 02:24:32PM +0100, Mark Rutland wrote: > As raw_cpu_generic_read() is a plain read from a raw_cpu_ptr() address, > it's possible (albeit unlikely) that the compiler will split the access > across multiple instructions. > > In this_cpu_generic_read() we disable