From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796211262; b=e7Mx4BrLTnCaGWj/PmSE+MSmOQPYYz09BSQMtlXbx/poilLiGdyu5jMaizHpahsVYIME dENMQbNT3wm6U3x5HIojXnXHJeDeNwaGQ0+koW4qDJT7t2GY73209r5fdvZhEGvLYFn8L 0CQ5IRQH1YuqPdzJf7teO4iCHadcXr7adNmDdY7UNCigFQDn3GoOhkavtCWaqX66jaQ5H ynC9Cc2Y170raXzFkPQc9g0TYy94PLJxxv4lTNqykvB3VIw49mJ9cSopLVEv09IzAu1kp l6s3sU1vwek3sLk+wJbd64pDZzquBd2bEOOU3ltfyL9absoQ2B8QfMuTkCyGd32BZdQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796211262; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=PE1c8ElQhJAvZ9DgFe8brgbdB7xRcLD2rWFQ8PakZ+M=; b=kNLU1bZVL4YaqNzJfJv8IPARIprM93r0BHa+L1VdBbhoVs385oDe++366Vc+6NGOqAia gEjrUQyZgCXwSVNZZBv9D0cgrSD2SExE7kM8XHOqEJbPbLGhA/z+XKsFMQLchfaKlpX0S sxEfNo2aPalzv/IGv1t+8IS4DNMFbkgCAc+WMYffGdIcG63dq8KNrsgjcvGC7FjswrZEB x0oz6mSZD9fBMi93N5PXlcUntEFS9dq8+He9c+FYu8BsBf/G/vEd/w+MoeerHBPKcJml7 7bJt5wEuQQgr+d+JDfZjV+zRPGK5/j/0yONM5WgDSOd6+gORNHEV8p6TaQZuEmZOIyQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=azbCKsqg; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 09671606A31A for ; Wed, 2 Dec 2026 11:34:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=azbCKsqg Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80A261F00896; Wed, 2 Dec 2026 11:34:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796211261; bh=PE1c8ElQhJAvZ9DgFe8brgbdB7xRcLD2rWFQ8PakZ+M=; h=From:Subject:Reply-To:To:In-Reply-To:References:Date; b=azbCKsqggJEzWqQAusGQPVhiceM7zZCA9Gv10FbPjJIxOxPOY1P8UiFxHJq/hU6rL UaflcbkCjkt6SPwxgPKLXrdTOQBaR770t0ZnxxVC0drS6lXQk/V7Bw5LtDiCpbGnv8 SWQ7K4rkQqdiLO+YyttW7p6y4TJ3N8Ho6nXNWhR8uw8exJ53cnDtl/AwyUBKGyS3Sw QJQo2o445aVvg/vb3EWMkW3CnBNB6ZiF6NpH1I4qicWzeHMsgxufR4hNSDzIwbDMDb d5Ct7fEOgZd61kPZAjQ3CPuiu3tUBE3hJE6BSrMnEV95EXfg0vwW5I+qWzgf0OI+u2 lVwzZ/XSGjH6g== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH] serial: imx: stop TX-ready interrupt storm on idle port Reply-To: sashiko-reviews@lists.linux.dev To: "Michael Glembotzki" , linux-serial@vger.kernel.org In-Reply-To: <20261202111526.664966-2-Michael.Glembotzki@iris-sensing.com> References: <20261202111526.664966-2-Michael.Glembotzki@iris-sensing.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Wed, 02 Dec 2026 11:34:21 +0000 X-Mailing-List: linux-serial@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [Medium] serial: imx: incomplete TX interrupt storm fix in imx_uart_int() - [Low] serial: imx: missing Fixes trailer for commit cb1a60923609 -- commit 11d7b6ef67792384c5672f5466f0d1655bebf34b Author: Michael Glembotzki > serial: imx: stop TX-ready interrupt storm on idle port > > On i.MX8MP, watchdog diagnostics captured repeated UART TX-ready > interrupts with tx_state OFF, an empty transmit buffer and no pending > x_char. The normal transmit handler calls imx_uart_stop_tx(), but that > function returns early when the state is OFF without clearing > UCR1_TRDYEN. The still-asserted interrupt can starve the CPU and prevent > the watchdog from being serviced. > > When this precise idle condition is observed in the interrupt handler, > clear TRDYEN and continue the normal handler. Keep UART and RX enabled; > subsequent transmission can enable TX-ready interrupts through the > regular TX path. Do not change behavior when characters are pending. > > The origin of the inconsistent state is not yet known. This change > addresses the observed interrupt loop, not the initial state mismatch. > > Cc: stable@vger.kernel.org > Signed-off-by: Michael Glembotzki [Severity: Low] Since this fixes the early return before clearing UCR1_TRDYEN in imx_uart_stop_tx() and is tagged for stable, should it include: Fixes: cb1a60923609 ("serial: imx: implement rts delaying for rs485") > diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c > index 0831bd5ee3dc2..258e03b744c06 100644 > --- a/drivers/tty/serial/imx.c > +++ b/drivers/tty/serial/imx.c > @@ -1038,6 +1038,14 @@ static irqreturn_t imx_uart_int(int irq, void *dev= _id) > } > =20 > if ((usr1 & USR1_TRDY) || (usr2 & USR2_TXDC)) { > + /* An idle transmitter must not keep firing a ready interrupt. */ > + if ((usr1 & USR1_TRDY) && sport->tx_state =3D=3D OFF && > + !sport->port.x_char && > + kfifo_is_empty(&sport->port.state->port.xmit_fifo)) { > + u32 current_ucr1 =3D imx_uart_readl(sport, UCR1); > + > + imx_uart_writel(sport, current_ucr1 & ~UCR1_TRDYEN, UCR1); > + } > imx_uart_transmit_buffer(sport); > ret =3D IRQ_HANDLED; > } [Severity: Medium] Can this still leave UCR1_TRDYEN enabled in an interrupt storm when uart_tx_stopped(&sport->port) is true and xmit_fifo is non-empty? When flow control stops transmission while unsent bytes remain in xmit_fifo, kfifo_is_empty() is false, so this new check is skipped. imx_uart_transmit_buffer() then sees uart_tx_stopped() and calls imx_uart_stop_tx() without draining xmit_fifo: drivers/tty/serial/imx.c:imx_uart_transmit_buffer() { ... if (kfifo_is_empty(&tport->xmit_fifo) || uart_tx_stopped(&sport->port)) { imx_uart_stop_tx(&sport->port); return; } ... } Because sport->tx_state is OFF, imx_uart_stop_tx() returns early without clearing UCR1_TRDYEN, repeating the interrupt loop and starving the CPU. Handling this in imx_uart_int() also misses a few other paths where imx_uart_stop_tx() returns early while sport->tx_state =3D=3D OFF: draining pending characters in imx_uart_transmit_buffer() fails to clear UCR1_TRDYEN at the end of the transfer, USR2_TXDC with UCR4_TCEN set is not cleared, and platforms with a separate TX IRQ use imx_uart_txint() instead of imx_uart_int(). Would clearing UCR1_TRDYEN (and UCR4_TCEN) in imx_uart_stop_tx() before the sport->tx_state =3D=3D OFF early return cover all of these paths in one place? --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261202111526.6649= 66-2-Michael.Glembotzki@iris-sensing.com?part=3D1