linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Will Deacon <will@kernel.org>
To: peterz@infradead.org
Cc: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
	linux@armlinux.org.uk, linux-arm-kernel@lists.infradead.org,
	andre.przywara@arm.com
Subject: Re: lockdep splat ("possible circular locking dependency detected") with PL011 on 5.8
Date: Tue, 11 Aug 2020 12:17:13 +0100	[thread overview]
Message-ID: <20200811111713.GA7203@willie-the-truck> (raw)
In-Reply-To: <20200811103841.GC2674@hirez.programming.kicks-ass.net>

On Tue, Aug 11, 2020 at 12:38:41PM +0200, peterz@infradead.org wrote:
> On Tue, Aug 11, 2020 at 11:13:13AM +0100, Will Deacon wrote:
> > Using magic-sysrq via a keyboard interrupt over the serial console results in
> > the following lockdep splat with the PL011 UART driver on v5.8. I can reproduce
> > the issue under QEMU with arm64 defconfig + PROVE_LOCKING.
> > 
> > Any chance somebody could take a look, please? It's a little annoying,
> > because it means when I uses magic-sysrq to increase the loglevel prior
> > to testing something else, lockdep gets disabled as a result.
> > 
> 
> Going by msm_serial, the thing to do is something like this:
> 
> diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
> index 8efd7c2a34fe..1717790ece2b 100644
> --- a/drivers/tty/serial/amba-pl011.c
> +++ b/drivers/tty/serial/amba-pl011.c
> @@ -308,8 +308,9 @@ static void pl011_write(unsigned int val, const struct uart_amba_port *uap,
>   */
>  static int pl011_fifo_to_tty(struct uart_amba_port *uap)
>  {
> -	u16 status;
>  	unsigned int ch, flag, fifotaken;
> +	int sysrq;
> +	u16 status;
>  
>  	for (fifotaken = 0; fifotaken != 256; fifotaken++) {
>  		status = pl011_read(uap, REG_FR);
> @@ -344,10 +345,12 @@ static int pl011_fifo_to_tty(struct uart_amba_port *uap)
>  				flag = TTY_FRAME;
>  		}
>  
> -		if (uart_handle_sysrq_char(&uap->port, ch & 255))
> -			continue;
> +		spin_unlock(&uap->port.lock);
> +		sysrq = uart_handle_sysrq_char(&uap->port, ch & 255);
> +		spin_lock(&uap->port.lock);
>  
> -		uart_insert_char(&uap->port, ch, UART011_DR_OE, ch, flag);
> +		if (!sysrq)
> +			uart_insert_char(&uap->port, ch, UART011_DR_OE, ch, flag);
>  	}
>  
>  	return fifotaken;

Cheers, that seems to do the trick:

Tested-by: Will Deacon <will@kernel.org>

but what I don't understand is why I haven't run into this before, and why
nobody else seems to be reporting it!

I'll try some older kernels to see if it ever worked.

Will

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2020-08-11 11:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-11 10:13 lockdep splat ("possible circular locking dependency detected") with PL011 on 5.8 Will Deacon
2020-08-11 10:38 ` peterz
2020-08-11 11:17   ` Will Deacon [this message]
2020-08-11 12:36     ` Will Deacon

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=20200811111713.GA7203@willie-the-truck \
    --to=will@kernel.org \
    --cc=andre.przywara@arm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=peterz@infradead.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).