From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Mike Galbraith <efault@gmx.de>,
LKML <linux-kernel@vger.kernel.org>,
linux-rt-users <linux-rt-users@vger.kernel.org>,
Steven Rostedt <rostedt@goodmis.org>,
Peter Zijlstra <peterz@infradead.org>
Subject: Re: [patch-rt] drivers/zram: fix zcomp_stream_get() smp_processor_id() use in preemptible code
Date: Thu, 31 Aug 2017 21:26:38 +0200 [thread overview]
Message-ID: <20170831192637.ffzw2km3zfiafx7s@linutronix.de> (raw)
In-Reply-To: <alpine.DEB.2.20.1708312103530.2346@nanos>
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
next prev parent reply other threads:[~2017-08-31 19:26 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-18 12:09 [ANNOUNCE] v4.11.12-rt10 Sebastian Andrzej Siewior
2017-08-23 9:53 ` v4.11.12-rt10 - hotplug lockdep splat Mike Galbraith
2017-08-31 16:18 ` Sebastian Andrzej Siewior
2017-09-02 7:00 ` Mike Galbraith
2017-09-03 2:48 ` Mike Galbraith
2017-09-04 14:58 ` Sebastian Andrzej Siewior
2017-08-23 9:57 ` [patch-rt] drivers/zram: fix zcomp_stream_get() smp_processor_id() use in preemptible code Mike Galbraith
2017-08-31 15:48 ` Sebastian Andrzej Siewior
2017-08-31 19:11 ` Thomas Gleixner
2017-08-31 19:26 ` Sebastian Andrzej Siewior [this message]
2017-08-31 19:32 ` Thomas Gleixner
2017-09-01 7:40 ` Sebastian Andrzej Siewior
2017-09-01 7:47 ` Thomas Gleixner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170831192637.ffzw2km3zfiafx7s@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=efault@gmx.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-users@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox