Re: serial: imx: Possible circular locking dependency

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Sep 29, 2021 at 1:10 PM Fabio Estevam <festevam@xxxxxxxxx> wrote:
>
> Hi Petr and Sergey,
>
> I know this has been reported before [1] and [2], but I am still
> observing the deadlock below
> on an imx6q board since commit dbdda842fe96 ("printk: Add console
> owner and waiter logic to load balance console writes").
>
> To reproduce it:
>
> # echo t > /proc/sysrq-trigger
>
> [   20.325246] ======================================================
> [   20.325252] WARNING: possible circular locking dependency detected
> [   20.325260] 5.15.0-rc2-next-20210924-00004-gd2d6e664f29f-dirty #163

If I move the __imx_uart_rxint() block outside the spin_lock() like this:

diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 8b121cd869e9..c94704f5dd99 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -955,13 +955,6 @@ static irqreturn_t imx_uart_int(int irq, void *dev_id)
        if ((ucr4 & UCR4_OREN) == 0)
                usr2 &= ~USR2_ORE;

-       if (usr1 & (USR1_RRDY | USR1_AGTIM)) {
-               imx_uart_writel(sport, USR1_AGTIM, USR1);
-
-               __imx_uart_rxint(irq, dev_id);
-               ret = IRQ_HANDLED;
-       }
-
        if ((usr1 & USR1_TRDY) || (usr2 & USR2_TXDC)) {
                imx_uart_transmit_buffer(sport);
                ret = IRQ_HANDLED;
@@ -993,6 +986,13 @@ static irqreturn_t imx_uart_int(int irq, void *dev_id)

        spin_unlock(&sport->port.lock);

+       if (usr1 & (USR1_RRDY | USR1_AGTIM)) {
+               imx_uart_writel(sport, USR1_AGTIM, USR1);
+
+               __imx_uart_rxint(irq, dev_id);
+               ret = IRQ_HANDLED;
+       }
+
        return ret;
 }

Then the problem does not happen anymore.

Is this a proper fix?

Thanks



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux