Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1739636
| From | Thomas Gleixner <tglx@linutronix.de> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] percpu: make this_cpu_generic_read() atomic w.r.t. interrupts |
| Date | 2017-09-26 09:50 +0200 |
| Message-ID | <utSMW-1IU-9@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> <utDNU-8jd-19@gated-at.bofh.it> <utRQS-150-29@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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_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.
>
> This is a single fetch operation of a value that needs to be atomic. It
> really does not matter if an interrupt happens before or after that load
> 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 an exception for double word fetches.
this_cpu_read_8() is a double word fetch on many 32bit architectures.
> Maybe we would need to special code that case but so far this does not
> seem to have been an issue.
Just because nobody ran into problem with that it is a non issue? That's
just hillarious.
It's obviously not correct and needs to be fixed _before_ someone has to go
through the pain of debugging such a problem.
Thanks,
tglx
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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
Re: [PATCH] percpu: make this_cpu_generic_read() atomic w.r.t. interrupts Christopher Lameter <cl@linux.com> - 2017-09-26 18:50 +0200
Re: [PATCH] percpu: make this_cpu_generic_read() atomic w.r.t. interrupts Thomas Gleixner <tglx@linutronix.de> - 2017-09-27 11:10 +0200
Re: [PATCH] percpu: make this_cpu_generic_read() atomic w.r.t. interrupts Mark Rutland <mark.rutland@arm.com> - 2017-09-27 12:20 +0200
Re: [PATCH] percpu: make this_cpu_generic_read() atomic w.r.t. interrupts Mark Rutland <mark.rutland@arm.com> - 2017-09-26 19:40 +0200
csiph-web