linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Julien Grall <julien.grall@arm.com>
Cc: linux-kernel@vger.kernel.org, jslaby@suse.com,
	gregkh@linuxfoundation.org,
	"linux-rt-users@vger.kernel.org" <linux-rt-users@vger.kernel.org>
Subject: Re: [PATCH] tty/sysrq: Convert show_lock to raw_spinlock_t
Date: Mon, 4 Mar 2019 23:01:53 +0100	[thread overview]
Message-ID: <20190304220152.nozgclpu2jx3zgvy@linutronix.de> (raw)
In-Reply-To: <545fb96e-0f07-758e-5c79-a725e74e3387@arm.com>

On 2019-03-04 17:21:57 [+0000], Julien Grall wrote:
> (CC correctly linux-rt-users)
> 
> On 04/03/2019 17:20, Julien Grall wrote:
> > At the moment show_lock is implemented using spin_lock_t and called from
> > an interrupt context on Arm64. The following backtrace was triggered by:
> > 
> > 42sh# echo l > /proc/sysrq-trigger
> > 
> > [ 4432.073756] sysrq: SysRq : Show backtrace of all active CPUs
> > [ 4432.403422] BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:974
> > [ 4432.403424] sysrq: CPU6:
> > [ 4432.403426] in_atomic(): 1, irqs_disabled(): 128, pid: 2410, name: kworker/u16:2
> > 
> > [...]
> > 
> > [ 4432.403581] Call trace:
> > [ 4432.403584]  dump_backtrace+0x0/0x148
> > [ 4432.403586]  show_stack+0x14/0x20
> > [ 4432.403588]  dump_stack+0x9c/0xd4
> > [ 4432.403592]  ___might_sleep+0x1cc/0x298
> > [ 4432.403595]  rt_spin_lock+0x5c/0x70
> > [ 4432.403596]  showacpu+0x34/0x68
> > [ 4432.403599]  flush_smp_call_function_queue+0xd4/0x278
> > [ 4432.403602]  generic_smp_call_function_single_interrupt+0x10/0x18
> > [ 4432.403605]  handle_IPI+0x26c/0x668
> > [ 4432.403607]  gic_handle_irq+0x9c/0xa0
> > [ 4432.403609]  el1_irq+0xb4/0x13c
> > 
> > With RT-patches, spin_lock can now sleep and therefore cannot be used from
> > interrupt context. Use a raw_spin_lock instead to prevent the lock to
> > sleep.
> > 
> > Signed-off-by: Julien Grall <julien.grall@arm.com>

I don't have to look at this properly but this looks is wrong. 
Please CC the RT developers if you plan any changes that affects primary
only the RT tree. This change is a nop for the !RT tree.

> >   drivers/tty/sysrq.c | 6 +++---
> >   1 file changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
> > index 1f03078ec352..8473557c7ab2 100644
> > --- a/drivers/tty/sysrq.c
> > +++ b/drivers/tty/sysrq.c
> > @@ -208,7 +208,7 @@ static struct sysrq_key_op sysrq_showlocks_op = {
> >   #endif
> >   #ifdef CONFIG_SMP
> > -static DEFINE_SPINLOCK(show_lock);
> > +static DEFINE_RAW_SPINLOCK(show_lock);
> >   static void showacpu(void *dummy)
> >   {
> > @@ -218,10 +218,10 @@ static void showacpu(void *dummy)
> >   	if (idle_cpu(smp_processor_id()))
> >   		return;
> > -	spin_lock_irqsave(&show_lock, flags);
> > +	raw_spin_lock_irqsave(&show_lock, flags);
> >   	pr_info("CPU%d:\n", smp_processor_id());
> >   	show_stack(NULL, NULL);
> > -	spin_unlock_irqrestore(&show_lock, flags);
> > +	raw_spin_unlock_irqrestore(&show_lock, flags);
> >   }
> >   static void sysrq_showregs_othercpus(struct work_struct *dummy)
> > 

Sebastian

  reply	other threads:[~2019-03-04 22:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-04 17:20 [PATCH] tty/sysrq: Convert show_lock to raw_spinlock_t Julien Grall
2019-03-04 17:21 ` Julien Grall
2019-03-04 22:01   ` Sebastian Andrzej Siewior [this message]
2019-03-04 22:25     ` Julien Grall
2019-03-04 23:15       ` Steven Rostedt
2019-03-06 11:08         ` Julien Grall
2019-03-07 12:38 ` Sebastian Andrzej Siewior
2019-03-07 18:14   ` Julien Grall
2019-03-08 17:14     ` Sebastian Andrzej Siewior

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=20190304220152.nozgclpu2jx3zgvy@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.com \
    --cc=julien.grall@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).