From: Jonathan Liu <net147@gmail.com>
To: Serge Semin <Sergey.Semin@baikalelectronics.ru>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jirislaby@kernel.org>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
Russell King <linux@armlinux.org.uk>,
Serge Semin <fancer.lancer@gmail.com>,
Alexey Malahov <Alexey.Malahov@baikalelectronics.ru>,
Hans de Goede <hdegoede@redhat.com>,
Andy Shevchenko <andy.shevchenko@gmail.com>,
Pavel Parkhomenko <Pavel.Parkhomenko@baikalelectronics.ru>,
linux-serial@vger.kernel.org, Will Deacon <will@kernel.org>,
linux-arm-kernel <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 3/3] serial: 8250_dw: Fix clk-notifier/port suspend deadlock
Date: Sun, 18 Oct 2020 11:32:06 +1100 [thread overview]
Message-ID: <CANwerB2GzDiM__UzzfHRn9ENvXYVabRZq8J9ArHcDmWT9zEKNA@mail.gmail.com> (raw)
In-Reply-To: <20200923161950.6237-4-Sergey.Semin@baikalelectronics.ru>
On Wed, 23 Sep 2020 at 16:19, Serge Semin
<Sergey.Semin@baikalelectronics.ru> wrote:
>
> It has been discovered that there is a potential deadlock between
> the clock-change-notifier thread and the UART port suspending one:
>
> CPU0 (suspend CPU/UART) CPU1 (update clock)
> ---- ----
> lock(&port->mutex);
> lock((work_completion)(&data->clk_work));
> lock(&port->mutex);
> lock((work_completion)(&data->clk_work));
>
> *** DEADLOCK ***
>
> The best way to fix this is to eliminate the CPU0
> port->mutex/work-completion scenario. So we suggest to register and
> unregister the clock-notifier during the DW APB UART port probe/remove
> procedures, instead of doing that at the points of the port
> startup/shutdown.
>
> Link: https://lore.kernel.org/linux-serial/f1cd5c75-9cda-6896-a4e2-42c5bfc3f5c3@redhat.com
>
> Fixes: cc816969d7b5 ("serial: 8250_dw: Fix common clocks usage race condition")
> Reported-by: Hans de Goede <hdegoede@redhat.com>
> Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
Tested-by: Jonathan Liu <net147@gmail.com>
Fixes hang while closing the serial port on RK3399 that I was
experiencing often with Linux 5.9.
After applying this patch, it no longer hangs while closing the serial port.
No problems while rebooting either.
Thanks.
Regards,
Jonathan
next prev parent reply other threads:[~2020-10-18 0:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-23 16:19 [PATCH 0/3] serial: 8250_dw: Fix clk-notifier/port suspend deadlock Serge Semin
2020-09-23 16:19 ` [PATCH 1/3] serial: 8250: Discard RTS/DTS setting from clock update method Serge Semin
2020-09-23 16:19 ` [PATCH 2/3] serial: 8250: Skip uninitialized TTY port baud rate update Serge Semin
2020-09-23 16:19 ` [PATCH 3/3] serial: 8250_dw: Fix clk-notifier/port suspend deadlock Serge Semin
2020-10-18 0:32 ` Jonathan Liu [this message]
2020-09-27 15:01 ` [PATCH 0/3] " Hans de Goede
2020-09-29 20:51 ` Serge Semin
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=CANwerB2GzDiM__UzzfHRn9ENvXYVabRZq8J9ArHcDmWT9zEKNA@mail.gmail.com \
--to=net147@gmail.com \
--cc=Alexey.Malahov@baikalelectronics.ru \
--cc=Pavel.Parkhomenko@baikalelectronics.ru \
--cc=Sergey.Semin@baikalelectronics.ru \
--cc=andriy.shevchenko@linux.intel.com \
--cc=andy.shevchenko@gmail.com \
--cc=fancer.lancer@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=hdegoede@redhat.com \
--cc=jirislaby@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=mripard@kernel.org \
--cc=will@kernel.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).