linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH tty/serial 1/1] tty: serial: lpuart: fix the sysrq lockdep issue
@ 2019-11-22 10:02 Andy Duan
  0 siblings, 0 replies; only message in thread
From: Andy Duan @ 2019-11-22 10:02 UTC (permalink / raw)
  To: gregkh; +Cc: linux-serial, jslaby, Andy Duan, u.kleine-koenig, festevam

From: Fugang Duan <fugang.duan@nxp.com>

commit dbdda842fe96 ("printk: Add console owner and waiter logic to
load balance console writes") introduces the lockdep issue for lpuart
serial driver in sysrq case:

     CPU0                    CPU1
     ----                    ----
lock(&port_lock_key);
                             lock(console_owner);
                             lock(&port_lock_key);
lock(console_owner);

It should unlock port_lock_key in handle_sysrq().

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
---
 drivers/tty/serial/fsl_lpuart.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c
index 4e128d1..2ddb777 100644
--- a/drivers/tty/serial/fsl_lpuart.c
+++ b/drivers/tty/serial/fsl_lpuart.c
@@ -836,7 +836,7 @@ static void lpuart_rxint(struct lpuart_port *sport)
 		sr = readb(sport->port.membase + UARTSR1);
 		rx = readb(sport->port.membase + UARTDR);
 
-		if (uart_handle_sysrq_char(&sport->port, (unsigned char)rx))
+		if (uart_prepare_sysrq_char(&sport->port, (unsigned char)rx))
 			continue;
 
 		if (sr & (UARTSR1_PE | UARTSR1_OR | UARTSR1_FE)) {
@@ -884,7 +884,7 @@ static void lpuart_rxint(struct lpuart_port *sport)
 		writeb(UARTSFIFO_RXOF, sport->port.membase + UARTSFIFO);
 	}
 
-	spin_unlock_irqrestore(&sport->port.lock, flags);
+	uart_unlock_and_check_sysrq(&sport->port, flags);
 
 	tty_flip_buffer_push(port);
 }
@@ -918,7 +918,7 @@ static void lpuart32_rxint(struct lpuart_port *sport)
 		rx = lpuart32_read(&sport->port, UARTDATA);
 		rx &= 0x3ff;
 
-		if (uart_handle_sysrq_char(&sport->port, (unsigned char)rx))
+		if (uart_prepare_sysrq_char(&sport->port, (unsigned char)rx))
 			continue;
 
 		if (sr & (UARTSTAT_PE | UARTSTAT_OR | UARTSTAT_FE)) {
@@ -955,7 +955,7 @@ static void lpuart32_rxint(struct lpuart_port *sport)
 	}
 
 out:
-	spin_unlock_irqrestore(&sport->port.lock, flags);
+	uart_unlock_and_check_sysrq(&sport->port, flags);
 
 	tty_flip_buffer_push(port);
 }
-- 
2.7.4


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-11-22 10:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-22 10:02 [PATCH tty/serial 1/1] tty: serial: lpuart: fix the sysrq lockdep issue Andy Duan

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).