From: sashiko-bot@kernel.org
To: "James Hilliard" <james.hilliard1@gmail.com>
Cc: linux-serial@vger.kernel.org, imx@lists.linux.dev, Frank.Li@kernel.org
Subject: Re: [PATCH v14 1/8] serial: 8250_omap: separate locked TX DMA completion processing
Date: Fri, 04 Dec 2026 10:18:45 +0000 [thread overview]
Message-ID: <sashiko-outbox-249585@kernel.org> (raw)
In-Reply-To: <20261204-submit-serial-8250-dma-cancel-v1-v14-1-b691fec8097d@gmail.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Low] serial: 8250_omap: commit message omits why TX DMA helper is
split
- [Low] serial: 8250_omap: confusing TX DMA completion naming and
missing lock assert
--
commit bf5c2c6d6a0451f17f908969e422608e25f2e9a0
Author: James Hilliard <james.hilliard1@gmail.com>
> serial: 8250_omap: separate locked TX DMA completion processing
>
> Separate the port-locked completion processing from the DMA callback
> wrapper. Keep the shutdown check and locking in the callback, and retain
> the existing FIFO accounting, delayed register restore and THRI handling
> in the helper.
>
> Reviewed-by: Raul E Rangel <rrangel@chromium.org>
> Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
[Severity: Low]
Could the commit message explain why this split is needed? As written it
only describes what was moved, leaving omap_8250_tx_dma_complete() with a
single caller and no context for why the dma->shutting_down check stays
outside the helper.
> diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c
> index 4f672b0371022..d18dca27a4c22 100644
> --- a/drivers/tty/serial/8250/8250_omap.c
> +++ b/drivers/tty/serial/8250/8250_omap.c
> @@ -1080,18 +1080,13 @@ static int omap_8250_rx_dma(struct uart_8250_port *p)
>
> static int omap_8250_tx_dma(struct uart_8250_port *p);
>
> -static void omap_8250_dma_tx_complete(void *param)
> +static void omap_8250_tx_dma_complete(struct uart_8250_port *p)
> {
> - struct uart_8250_port *p = param;
> struct uart_8250_dma *dma = p->dma;
> struct tty_port *tport = &p->port.state->port;
> bool en_thri = false;
> struct omap8250_priv *priv = p->port.private_data;
>
> - guard(uart_port_lock_irqsave)(&p->port);
> - if (dma->shutting_down)
> - return;
> -
> dma_sync_single_for_cpu(dmaengine_get_dma_device(dma->txchan), dma->tx_addr,
> UART_XMIT_SIZE, DMA_TO_DEVICE);
>
> @@ -1123,6 +1118,18 @@ static void omap_8250_dma_tx_complete(void *param)
> }
> }
>
> +static void omap_8250_dma_tx_complete(void *param)
> +{
> + struct uart_8250_port *p = param;
> + struct uart_8250_dma *dma = p->dma;
> +
> + guard(uart_port_lock_irqsave)(&p->port);
> +
> + if (dma->shutting_down)
> + return;
> + omap_8250_tx_dma_complete(p);
> +}
> +
> static int omap_8250_tx_dma(struct uart_8250_port *p)
> {
> struct uart_8250_dma *dma = p->dma;
[Severity: Low]
Can the adjacent names omap_8250_tx_dma_complete() and
omap_8250_dma_tx_complete() be made more distinct, and should
omap_8250_tx_dma_complete() assert p->port.lock?
These two functions sit side by side with opposite locking contracts yet
differ only by swapping tx and dma. Because struct uart_8250_port *
implicitly converts to void *, calling the unlocked callback wrapper
while holding p->port.lock compiles without warning and self-deadlocks.
Unlike other port-locked helpers in this file such as omap_8250_rx_dma(),
omap_8250_tx_dma_complete() omits lockdep_assert_held_once(&p->port.lock),
and not all paths through it reach a callee that asserts the lock.
Renaming the static callback wrapper (for example to
omap_8250_tx_dma_complete_cb()) and adding
lockdep_assert_held_once(&p->port.lock) would make the locking contract
clear and lockdep-enforced.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204-submit-serial-8250-dma-cancel-v1-v14-0-b691fec8097d@gmail.com?part=1
next prev parent reply other threads:[~2026-12-04 10:18 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 10:03 [PATCH v14 0/8] serial: 8250: serialize DMA cancellation with buffer reuse James Hilliard
2026-12-04 10:03 ` [PATCH v14 1/8] serial: 8250_omap: separate locked TX DMA completion processing James Hilliard
2026-12-04 10:18 ` sashiko-bot [this message]
2026-12-04 10:03 ` [PATCH v14 2/8] serial: serialize asynchronous write wakeups with the port lock James Hilliard
2026-12-04 10:30 ` sashiko-bot
2026-12-04 10:03 ` [PATCH v14 3/8] serial: 8250_omap: serialize RX DMA completion and flushing James Hilliard
2026-12-04 10:20 ` sashiko-bot
2026-12-04 10:03 ` [PATCH v14 4/8] serial: 8250_omap: quiesce DMA IRQ handling before shutdown James Hilliard
2026-12-04 10:03 ` [PATCH v14 5/8] serial: core: allow drivers to reserve flushed transmit storage James Hilliard
2026-12-04 10:37 ` sashiko-bot
2026-12-04 10:03 ` [PATCH v14 6/8] serial: 8250: drain canceled TX DMA before reusing its buffer James Hilliard
2026-12-04 10:31 ` sashiko-bot
2026-12-04 10:03 ` [PATCH v14 7/8] serial: 8250: retire canceled RX DMA before reusing the receive buffer James Hilliard
2026-12-04 10:44 ` sashiko-bot
2026-12-04 10:03 ` [PATCH v14 8/8] serial: 8250: retain DMA resources when termination fails James Hilliard
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=sashiko-outbox-249585@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=imx@lists.linux.dev \
--cc=james.hilliard1@gmail.com \
--cc=linux-serial@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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