Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1724508 > unrolled thread
| Started by | Thomas Gleixner <tglx@linutronix.de> |
|---|---|
| First post | 2017-08-31 21:20 +0200 |
| Last post | 2017-09-01 09:50 +0200 |
| Articles | 5 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [patch-rt] drivers/zram: fix zcomp_stream_get() smp_processor_id() use in preemptible code Thomas Gleixner <tglx@linutronix.de> - 2017-08-31 21:20 +0200
Re: [patch-rt] drivers/zram: fix zcomp_stream_get() smp_processor_id() use in preemptible code Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2017-08-31 21:30 +0200
Re: [patch-rt] drivers/zram: fix zcomp_stream_get() smp_processor_id() use in preemptible code Thomas Gleixner <tglx@linutronix.de> - 2017-08-31 21:40 +0200
Re: [patch-rt] drivers/zram: fix zcomp_stream_get() smp_processor_id() use in preemptible code Thomas Gleixner <tglx@linutronix.de> - 2017-09-01 09:50 +0200
Re: [patch-rt] drivers/zram: fix zcomp_stream_get() smp_processor_id() use in preemptible code Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2017-09-01 09:50 +0200
| From | Thomas Gleixner <tglx@linutronix.de> |
|---|---|
| Date | 2017-08-31 21:20 +0200 |
| Subject | Re: [patch-rt] drivers/zram: fix zcomp_stream_get() smp_processor_id() use in preemptible code |
| Message-ID | <ukDap-1iX-1@gated-at.bofh.it> |
On Wed, 23 Aug 2017, Mike Galbraith wrote:
>
> Use get_local_ptr() vs this_cpu_ptr().
>
> Signed-off-by: Mike Galbraith <efault@gmx.de>
> ---
> drivers/block/zram/zcomp.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> --- a/drivers/block/zram/zcomp.c
> +++ b/drivers/block/zram/zcomp.c
> @@ -120,7 +120,7 @@ struct zcomp_strm *zcomp_stream_get(stru
> {
> struct zcomp_strm *zstrm;
>
> - zstrm = *this_cpu_ptr(comp->stream);
> + zstrm = *get_local_ptr(comp->stream);
This looks wrong. On mainline the calling code must have preemption disable
somehow, otherwise this_cpu_ptr() would not work.
Looking at the call site it is;
zram_slot_lock()
bit_spin_lock()
which is of course evading lockdep and everything else debugging wise.
Sebastian, do we have migration protection in bitlocked regions? And we
shpuld look into converting that into a spinlock on rt.
Thanks,
tglx
[toc] | [next] | [standalone]
| From | Sebastian Andrzej Siewior <bigeasy@linutronix.de> |
|---|---|
| Date | 2017-08-31 21:30 +0200 |
| Subject | Re: [patch-rt] drivers/zram: fix zcomp_stream_get() smp_processor_id() use in preemptible code |
| Message-ID | <ukDk6-1mJ-17@gated-at.bofh.it> |
| In reply to | #1724508 |
On 2017-08-31 21:11:08 [+0200], Thomas Gleixner wrote:
> On Wed, 23 Aug 2017, Mike Galbraith wrote:
>
> >
> > Use get_local_ptr() vs this_cpu_ptr().
> >
> > Signed-off-by: Mike Galbraith <efault@gmx.de>
> > ---
> > drivers/block/zram/zcomp.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > --- a/drivers/block/zram/zcomp.c
> > +++ b/drivers/block/zram/zcomp.c
> > @@ -120,7 +120,7 @@ struct zcomp_strm *zcomp_stream_get(stru
> > {
> > struct zcomp_strm *zstrm;
> >
> > - zstrm = *this_cpu_ptr(comp->stream);
> > + zstrm = *get_local_ptr(comp->stream);
>
> This looks wrong. On mainline the calling code must have preemption disable
> somehow, otherwise this_cpu_ptr() would not work.
This was introduced by Mike in a previous patch. The zstrm is only
accessed while the spinlock is held.
> Looking at the call site it is;
>
> zram_slot_lock()
> bit_spin_lock()
>
> which is of course evading lockdep and everything else debugging wise.
>
> Sebastian, do we have migration protection in bitlocked regions? And we
> shpuld look into converting that into a spinlock on rt.
zram_lock_table() is bit_spin_lock() on !RT and spin_lock(&table->lock);
on RT. So this is done.
!RT has this running in a kmap_atomic() section so they have no
preemption there.
zcomp_stream_get() returns a per-CPU object which is protected with a
spinlock and only accessed locked.
> Thanks,
>
> tglx
Sebastian
[toc] | [prev] | [next] | [standalone]
| From | Thomas Gleixner <tglx@linutronix.de> |
|---|---|
| Date | 2017-08-31 21:40 +0200 |
| Message-ID | <ukDtL-1q4-1@gated-at.bofh.it> |
| In reply to | #1724519 |
On Thu, 31 Aug 2017, Sebastian Andrzej Siewior wrote:
> On 2017-08-31 21:11:08 [+0200], Thomas Gleixner wrote:
> > On Wed, 23 Aug 2017, Mike Galbraith wrote:
> >
> > >
> > > Use get_local_ptr() vs this_cpu_ptr().
> > >
> > > Signed-off-by: Mike Galbraith <efault@gmx.de>
> > > ---
> > > drivers/block/zram/zcomp.c | 3 ++-
> > > 1 file changed, 2 insertions(+), 1 deletion(-)
> > >
> > > --- a/drivers/block/zram/zcomp.c
> > > +++ b/drivers/block/zram/zcomp.c
> > > @@ -120,7 +120,7 @@ struct zcomp_strm *zcomp_stream_get(stru
> > > {
> > > struct zcomp_strm *zstrm;
> > >
> > > - zstrm = *this_cpu_ptr(comp->stream);
> > > + zstrm = *get_local_ptr(comp->stream);
> >
> > This looks wrong. On mainline the calling code must have preemption disable
> > somehow, otherwise this_cpu_ptr() would not work.
>
> This was introduced by Mike in a previous patch. The zstrm is only
> accessed while the spinlock is held.
>
> > Looking at the call site it is;
> >
> > zram_slot_lock()
> > bit_spin_lock()
> >
> > which is of course evading lockdep and everything else debugging wise.
> >
> > Sebastian, do we have migration protection in bitlocked regions? And we
> > shpuld look into converting that into a spinlock on rt.
>
> zram_lock_table() is bit_spin_lock() on !RT and spin_lock(&table->lock);
> on RT. So this is done.
> !RT has this running in a kmap_atomic() section so they have no
> preemption there.
> zcomp_stream_get() returns a per-CPU object which is protected with a
> spinlock and only accessed locked.
So when we are inside a spinlocked section, why is this_cpu_ptr() not
working? That does not make sense.
Thanks,
tglx
[toc] | [prev] | [next] | [standalone]
| From | Thomas Gleixner <tglx@linutronix.de> |
|---|---|
| Date | 2017-09-01 09:50 +0200 |
| Message-ID | <ukOSd-Pw-1@gated-at.bofh.it> |
| In reply to | #1724520 |
On Fri, 1 Sep 2017, Sebastian Andrzej Siewior wrote: > On 2017-08-31 21:32:30 [+0200], Thomas Gleixner wrote: > > > zram_lock_table() is bit_spin_lock() on !RT and spin_lock(&table->lock); > > > on RT. So this is done. > > > !RT has this running in a kmap_atomic() section so they have no > > > preemption there. > > > zcomp_stream_get() returns a per-CPU object which is protected with a > > > spinlock and only accessed locked. > > > > So when we are inside a spinlocked section, why is this_cpu_ptr() not > > working? That does not make sense. > > zram_decompress_page() invokes zcomp_stream_get() within a spin_lock > section (zram_lock_table()). This is fine. > zram_bvec_write() does not invoke zcomp_stream_get() within a spin_lock > section. Fair enough.
[toc] | [prev] | [next] | [standalone]
| From | Sebastian Andrzej Siewior <bigeasy@linutronix.de> |
|---|---|
| Date | 2017-09-01 09:50 +0200 |
| Subject | Re: [patch-rt] drivers/zram: fix zcomp_stream_get() smp_processor_id() use in preemptible code |
| Message-ID | <ukOSd-Pw-3@gated-at.bofh.it> |
| In reply to | #1724520 |
On 2017-08-31 21:32:30 [+0200], Thomas Gleixner wrote: > > zram_lock_table() is bit_spin_lock() on !RT and spin_lock(&table->lock); > > on RT. So this is done. > > !RT has this running in a kmap_atomic() section so they have no > > preemption there. > > zcomp_stream_get() returns a per-CPU object which is protected with a > > spinlock and only accessed locked. > > So when we are inside a spinlocked section, why is this_cpu_ptr() not > working? That does not make sense. zram_decompress_page() invokes zcomp_stream_get() within a spin_lock section (zram_lock_table()). This is fine. zram_bvec_write() does not invoke zcomp_stream_get() within a spin_lock section. > Thanks, > > tglx Sebastian
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web