On 01/10/2021 10:56, Johan Hovold wrote:
No, no, no.
Just replace this unlock with uart_unlock_and_check_sysrq() and do the
corresponding change in imx_uart_int(). The result is an even smaller
diff than what you're currently proposing and without any performance
penalty from dropping and reacquiring the lock.
Just to be clear, this is something that I have also tried:
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 8b121cd869e9..b652908f0bf1 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -803,7 +803,7 @@ static irqreturn_t __imx_uart_rxint(int irq, void
*dev_id)
continue;
}
- if (uart_handle_sysrq_char(&sport->port, (unsigned char)rx))
+ if (uart_prepare_sysrq_char(&sport->port, (unsigned char)rx))
continue;
if (unlikely(rx & URXD_ERR)) {
@@ -858,7 +858,7 @@ static irqreturn_t imx_uart_rxint(int irq, void
*dev_id)
ret = __imx_uart_rxint(irq, dev_id);
- spin_unlock(&sport->port.lock);
+ uart_unlock_and_check_sysrq(&sport->port);
return ret;
}
@@ -991,7 +991,7 @@ static irqreturn_t imx_uart_int(int irq, void
*dev_id)
ret = IRQ_HANDLED;
}
- spin_unlock(&sport->port.lock);
+ uart_unlock_and_check_sysrq(&sport->port);
return ret;
}
@@ -1977,9 +1977,7 @@ imx_uart_console_write(struct console *co, const
char *s, unsigned int count)
unsigned int ucr1;
int locked = 1;
- if (sport->port.sysrq)
- locked = 0;
- else if (oops_in_progress)
+ if (oops_in_progress)
locked = spin_trylock_irqsave(&sport->port.lock, flags);
else
spin_lock_irqsave(&sport->port.lock, flags);
, but still get the lockdep warning in this case.
Thanks