Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1739132

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

From Tejun Heo <tj@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH] percpu: make this_cpu_generic_read() atomic w.r.t. interrupts
Date 2017-09-25 17:50 +0200
Message-ID <utDNU-8jd-19@gated-at.bofh.it> (permalink)
References <utBCq-6Vt-11@gated-at.bofh.it> <utDkS-86C-35@gated-at.bofh.it> <utDEe-8eJ-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] percpu: make this_cpu_generic_read() atomic w.r.t. interrupts Mark Rutland <mark.rutland@arm.com> - 2017-09-25 15:30 +0200
  Re: [PATCH] percpu: make this_cpu_generic_read() atomic w.r.t.  interrupts Tejun Heo <tj@kernel.org> - 2017-09-25 17:20 +0200
    Re: [PATCH] percpu: make this_cpu_generic_read() atomic w.r.t.  interrupts Mark Rutland <mark.rutland@arm.com> - 2017-09-25 17:40 +0200
      Re: [PATCH] percpu: make this_cpu_generic_read() atomic w.r.t.  interrupts Tejun Heo <tj@kernel.org> - 2017-09-25 17:50 +0200
        Re: [PATCH] percpu: make this_cpu_generic_read() atomic w.r.t.  interrupts Christopher Lameter <cl@linux.com> - 2017-09-26 08:50 +0200
          Re: [PATCH] percpu: make this_cpu_generic_read() atomic w.r.t.  interrupts Thomas Gleixner <tglx@linutronix.de> - 2017-09-26 09:50 +0200

csiph-web