Thread (4 messages) read the whole thread 4 messages, 2 authors, 2020-08-11

Re: lockdep splat ("possible circular locking dependency detected") with PL011 on 5.8

From: Will Deacon <will@kernel.org>
Date: 2020-08-11 12:37:07
Also in: lkml

On Tue, Aug 11, 2020 at 12:17:13PM +0100, Will Deacon wrote:
On Tue, Aug 11, 2020 at 12:38:41PM +0200, peterz@infradead.org wrote:
quoted
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.
I tried 5.4, 4.19, 4.14 and 4.9:

5.4 and 4.19 have the lockdep splat

4.14 doesn't have the splat, yet I don't see why (the driver code hasn't really
changed)

4.9 magic sysrq doesn't work at all (no splat either though)

Will

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help