From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jirislaby@kernel.org>,
linux-serial@vger.kernel.org,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
qianfan Zhao <qianfanguijin@163.com>,
Adriana Nicolae <adriana@arista.com>,
Jamie Iles <jamie@jamieiles.com>,
linux-kernel@vger.kernel.org
Cc: "Bandal, Shankar" <shankar.bandal@intel.com>,
"Murthy, Shanth" <shanth.murthy@intel.com>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
stable@vger.kernel.org
Subject: [PATCH v2 6/7] serial: 8250: Add late synchronize_irq() to shutdown to handle DW UART BUSY
Date: Wed, 28 Jan 2026 12:53:00 +0200 [thread overview]
Message-ID: <20260128105301.1869-7-ilpo.jarvinen@linux.intel.com> (raw)
In-Reply-To: <20260128105301.1869-1-ilpo.jarvinen@linux.intel.com>
When DW UART is !uart_16550_compatible, it can indicate BUSY at any
point (when under constant Rx pressure) unless a complex sequence of
steps is performed. Any LCR write can run a foul with the condition
that prevents writing LCR while the UART is BUSY, which triggers
BUSY_DETECT interrupt that seems unmaskable using IER bits.
Normal flow is that dw8250_handle_irq() handles BUSY_DETECT condition
by reading USR register. This BUSY feature, however, breaks the
assumptions made in serial8250_do_shutdown(), which runs
synchronize_irq() after clearing IER and assumes no interrupts can
occur after that point but then proceeds to update LCR, which on DW
UART can trigger an interrupt.
If serial8250_do_shutdown() releases the interrupt handler before the
handler has run and processed the BUSY_DETECT condition by read the USR
register, the IRQ is not deasserted resulting in interrupt storm that
triggers "irq x: nobody cared" warning leading to disabling the IRQ.
Add late synchronize_irq() into serial8250_do_shutdown() to ensure
BUSY_DETECT from DW UART is handled before port's interrupt handler is
released. Alternative would be to add DW UART specific shutdown
function but it would mostly duplicate the generic code and the extra
synchronize_irq() seems pretty harmless in serial8250_do_shutdown().
Fixes: 7d4008ebb1c9 ("tty: add a DesignWare 8250 driver")
Cc: stable@vger.kernel.org
Reported-by: "Bandal, Shankar" <shankar.bandal@intel.com>
Tested-by: "Bandal, Shankar" <shankar.bandal@intel.com>
Tested-by: "Murthy, Shanth" <shanth.murthy@intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
drivers/tty/serial/8250/8250_port.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
index bc223eb1f474..fb0b8397cd4b 100644
--- a/drivers/tty/serial/8250/8250_port.c
+++ b/drivers/tty/serial/8250/8250_port.c
@@ -2401,6 +2401,12 @@ void serial8250_do_shutdown(struct uart_port *port)
* the IRQ chain.
*/
serial_port_in(port, UART_RX);
+ /*
+ * LCR writes on DW UART can trigger late (unmaskable) IRQs.
+ * Handle them before releasing the handler.
+ */
+ synchronize_irq(port->irq);
+
serial8250_rpm_put(up);
up->ops->release_irq(up);
--
2.39.5
next prev parent reply other threads:[~2026-01-28 10:54 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-28 10:52 [PATCH v2 0/7] 8250 DW UART fixes when under constant Rx pressure Ilpo Järvinen
2026-01-28 10:52 ` [PATCH v2 1/7] serial: 8250: Protect LCR write in shutdown Ilpo Järvinen
2026-01-28 13:12 ` Andy Shevchenko
2026-01-28 10:52 ` [PATCH v2 2/7] serial: 8250_dw: Avoid unnecessary LCR writes Ilpo Järvinen
2026-01-28 13:36 ` Andy Shevchenko
2026-01-28 10:52 ` [PATCH v2 3/7] serial: 8250: Add serial8250_handle_irq_locked() Ilpo Järvinen
2026-01-28 13:20 ` Andy Shevchenko
2026-01-28 13:26 ` Ilpo Järvinen
2026-01-28 10:52 ` [PATCH v2 4/7] serial: 8250_dw: Rework dw8250_handle_irq() locking and IIR handling Ilpo Järvinen
2026-01-28 13:48 ` Andy Shevchenko
2026-01-28 14:00 ` Ilpo Järvinen
2026-01-28 10:52 ` [PATCH v2 5/7] serial: 8250_dw: Rework IIR_NO_INT handling to stop interrupt storm Ilpo Järvinen
2026-01-28 14:03 ` Andy Shevchenko
2026-01-28 10:53 ` Ilpo Järvinen [this message]
2026-01-28 14:37 ` [PATCH v2 6/7] serial: 8250: Add late synchronize_irq() to shutdown to handle DW UART BUSY Andy Shevchenko
2026-01-28 15:07 ` Ilpo Järvinen
2026-01-28 10:53 ` [PATCH v2 7/7] serial: 8250_dw: Ensure BUSY is deasserted Ilpo Järvinen
2026-01-28 15:42 ` Andy Shevchenko
2026-01-30 12:44 ` Ilpo Järvinen
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=20260128105301.1869-7-ilpo.jarvinen@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=adriana@arista.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=jamie@jamieiles.com \
--cc=jirislaby@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=qianfanguijin@163.com \
--cc=shankar.bandal@intel.com \
--cc=shanth.murthy@intel.com \
--cc=stable@vger.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