lkml.org 
[lkml]   [2017]   [Sep]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] percpu: make this_cpu_generic_read() atomic w.r.t. interrupts
    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) \
    > ({ \
    > typeof(pcp) __ret; \
    > preempt_disable_notrace(); \
    > __ret = raw_cpu_generic_read(pcp); \
    > preempt_enable_notrace(); \
    > __ret; \
    > })

    I see. Yeah, that looks like the bug there.

    > I guess it'd be preferable to manipulate that in-place.
    >
    > > Adding READ_ONCE() doesn't generically guarantee that the reads won't
    > > be split - e.g. there are arch which simply can't load a 64bit value
    > > with a single instruction.
    >
    > In which case, it really sounds like this_cpu_generic_read() needs to
    > disable interrupts too...

    Can you please spin up a patch for this?

    Thanks.

    --
    tejun

    \
     
     \ /
      Last update: 2017-09-25 17:46    [W:2.977 / U:0.124 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site