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=1796379647; b=m8W1RZeSOdjf9ch9c4vkVw1e+RgRVrTdV7nS2ksiqa3JUy5ogxC6VV3Ha4kHDTQohoTc zE8yXhWFLh/Vz1KfNdmM1gTxyED/8fgxyULCBSJcx9pag15U4iyPsuxNvtYsssyD1rlBA Bbhb0oMR7PHLJIqLyYqfPBPbktFdktHPy4l5tgDIKpmIhb9p/YBQou18ZePBXiS0b77EX aCfbAWN8J6FocO6ei5+8YlaZZPWJe+RCE/mDVxjT+1GIYdyyuZ/EPUY2ZFXjM9IsINd96 sINwEWY+kTtSftsDkajUdBsQG40L65fvr3iQzPAxbVL8ThcIChD6bbXt2GXZ/Ezkwbg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796379647; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=jabbkVa29RHboUkJdFsIrYX+KX7CFmeql6Re+9GALwE=; b=cibM/V0but9kijoo0+Rj9qSsN+JSaiCL1NVf9Ut1wmaUkcxuooZDeV1SZw1KuFQzVevU xnhdqXlyxrRnjlPkwX37qwn5/IU0g1qkqVyvZqSmtL5stKciMzFoWZmWA1+PPuZxqLgsD NK9/kR6dWS62Cx1+hXgT3BwLNWXpKavQhQ2TCFmhJCgbPg5MUm+8jvLYZzrrZPgNrn3uj B96oZ7mgUNt7IIwAeJjIbNKriFHzFyMlUaj3E2lCkIoZ+VYSYfbQAMmFDiC9LDoPBHul6 ycuboUc4ySpMfD5Ie8goBt61Cl8B+gtrVfmP52pIgecZ3YD5fqlFHs2pDpMsDDo9vPw== 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=NDO9KWYC; 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 08579606A322; Fri, 4 Dec 2026 10:20:46 +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=NDO9KWYC Received: by smtp.kernel.org (Postfix) with ESMTPSA id 708DB1F000CE; Fri, 4 Dec 2026 10:20:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796379646; bh=jabbkVa29RHboUkJdFsIrYX+KX7CFmeql6Re+9GALwE=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=NDO9KWYCaViQgNUoThCRr7s2U+bJYof4a3A1MN+Hl62+ArqpmYxSm6dSNuWdEpZaY syXRfFUcCdcfxmQ5fc6jsXKdLiPOCg2MsdAkhWplpB6cJun/OtUyno1O7i8TfMYYvK nSAMTy6kLS5QeMb4hqmdicx3eRHZ8XW/TbLzbEyuNUFl1dEBNg/fkj43NJdPXe9T8U XzKslbOKa84/SN8s/klszZfegO+BRh6Z807U7IkAV8CyAvC/9UGcjU3NXIvhlYBRXD 3fuUWY89e4+3Q+8zseCv3uHNm8FE8p3EVNmsagzW5va3Ux5bQRMvyH86leSKsYqx81 9hWp1nKQpbvWw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v14 3/8] serial: 8250_omap: serialize RX DMA completion and flushing Reply-To: sashiko-reviews@lists.linux.dev To: "James Hilliard" Cc: linux-serial@vger.kernel.org, imx@lists.linux.dev, Frank.Li@kernel.org In-Reply-To: <20261204-submit-serial-8250-dma-cancel-v1-v14-3-b691fec8097d@gmail.com> References: <20261204-submit-serial-8250-dma-cancel-v1-v14-0-b691fec8097d@gmail.com> <20261204-submit-serial-8250-dma-cancel-v1-v14-3-b691fec8097d@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 10:20:46 +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: - [High] serial: 8250_omap: AB-BA deadlock on port lock in omap8250_runtime_suspend() - [Low] serial: 8250_omap: redundant priv->rx_dma_lock under port lock in RX DMA -- commit b087c1c0ef62420632ac4cbef6f88f28c80c857c Author: James Hilliard serial: 8250_omap: serialize RX DMA completion and flushing This commit takes priv->rx_dma_lock under the port lock in __dma_rx_complete(), acquires the port lock around omap_8250_rx_dma_flush() during shutdown and runtime suspend, and adds lockdep assertions to the RX DMA completion and flush helpers. > diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/825= 0/8250_omap.c > index d18dca27a4c22..5e8a5aafdb6dc 100644 > --- a/drivers/tty/serial/8250/8250_omap.c > +++ b/drivers/tty/serial/8250/8250_omap.c [ ... ] > @@ -977,7 +982,8 @@ static void __dma_rx_complete(void *param) > if (dmaengine_tx_status(dma->rxchan, dma->rx_cookie, &state) !=3D DMA_C= OMPLETE) > return; > =20 > - __dma_rx_do_complete(p); > + scoped_guard(spinlock, &priv->rx_dma_lock) > + __dma_rx_do_complete(p); > if (priv->throttled) > return; [Severity: Low] Is priv->rx_dma_lock still needed once every RX DMA path holds p->port.lock? With this change, all three sites that acquire priv->rx_dma_lock (__dma_rx_complete(), omap_8250_rx_dma_flush(), and omap_8250_rx_dma()) always hold p->port.lock, so priv->rx_dma_lock provides no extra mutual exclusion. Taking it here adds an uncontended spinlock acquire/release on every RX DMA completion, right before omap_8250_rx_dma() takes it again under the same port lock. If the runtime PM lock-ordering issue below allows keeping RX D= MA serialized by p->port.lock, removing priv->rx_dma_lock would simplify the locking and avoid the extra overhead. [ ... ] > @@ -1811,8 +1819,10 @@ static int omap8250_runtime_suspend(struct device = *dev) > } > } > =20 > - if (up && up->dma && up->dma->rxchan) > + if (up && up->dma && up->dma->rxchan) { > + guard(uart_port_lock_irqsave)(&up->port); > omap_8250_rx_dma_flush(up); > + } > =20 > priv->latency =3D PM_QOS_CPU_LATENCY_DEFAULT_VALUE; > schedule_work(&priv->qos_work); [Severity: High] Can acquiring &up->port.lock in omap8250_runtime_suspend() cause an ABBA deadlock with runtime PM? 8250_omap sets UART_CAP_RPM without pm_runtime_irq_safe(), and several serial_core and 8250_port paths call pm_runtime_resume_and_get() or pm_runtime_get_sync() while holding port->lock with interrupts disabled, such as uart_update_mctrl() -> omap8250_set_mctrl(). CPU0 CPU1 ---- ---- omap8250_runtime_suspend() [status =3D RPM_SUSPENDING] uart_update_mctrl() guard(uart_port_lock_irqsave)(port) omap8250_set_mctrl() pm_runtime_resume_and_get() rpm_resume() wait for RPM_SUSPENDING <-- sleeps holding port->lock guard(uart_port_lock_irqsave) <-- spins forever on port->lock CPU1 sleeps in TASK_UNINTERRUPTIBLE inside rpm_resume() waiting for RPM_SUSPENDING to finish while holding port->lock, while CPU0 cannot leave RPM_SUSPENDING until CPU1 releases port->lock, deadlocking both CPUs. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204-submit-ser= ial-8250-dma-cancel-v1-v14-0-b691fec8097d@gmail.com?part=3D3