All of lore.kernel.org
 help / color / mirror / Atom feed
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 v11 4/8] serial: 8250_omap: quiesce DMA IRQ handling before shutdown
Date: Tue, 10 Nov 2026 04:29:28 +0000	[thread overview]
Message-ID: <sashiko-outbox-206203@kernel.org> (raw)
In-Reply-To: <20261109-submit-serial-8250-dma-cancel-v1-v11-4-6364edca63d6@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] serial: 8250_omap: UART_OMAP_EFR2 cleared before locked RX
  DMA flush
--

commit 4f01158f98251ff9fc53053baff46ab365f1866d
Author: James Hilliard <james.hilliard1@gmail.com>

serial: 8250_omap: quiesce DMA IRQ handling before shutdown

This commit gates DMA IRQ handling on up->dma->shutting_down under the
port lock, moves the final RX DMA flush into that locked section, and
switches omap_8250_shutdown() from disable_irq_nosync() to disable_irq()
before releasing DMA resources.

> diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c
> index 5e114dd8f9bfb..51013dd2d8510 100644
> --- a/drivers/tty/serial/8250/8250_omap.c
> +++ b/drivers/tty/serial/8250/8250_omap.c
> @@ -771,10 +771,6 @@ static void omap_8250_shutdown(struct uart_port *port)
>  	guard(serial8250_rpm)(up);
>  
>  	flush_work(&priv->qos_work);
> -	if (up->dma) {
> -		guard(uart_port_lock_irq)(port);
> -		omap_8250_rx_dma_flush(up);
> -	}
>  
>  	serial_out(up, UART_OMAP_WER, 0);
>  	if (priv->habit & UART_HAS_EFR2)
> @@ -782,13 +778,16 @@ static void omap_8250_shutdown(struct uart_port *port)
>  
>  	/* Synchronize UART_IER access against the console. */
>  	scoped_guard(uart_port_lock_irq, port) {
> -		if (up->dma)
> +		if (up->dma) {
>  			up->dma->shutting_down = true;
> +			omap_8250_rx_dma_flush(up);
> +		}
>  		up->ier = 0;
>  		serial_out(up, UART_IER, 0);
>  	}

[Severity: Medium]
Can clearing UART_OMAP_EFR2 before acquiring port->lock leave
UART_OMAP_EFR2_TIMEOUT_BEHAVE set after shutdown?

Moving omap_8250_rx_dma_flush() into the locked block places it after
serial_out(up, UART_OMAP_EFR2, 0x0):

CPU0                              CPU1
omap_8250_shutdown()              omap_8250_dma_handle_irq()
  serial_out(up, UART_OMAP_EFR2, 0x0)
                                    uart_port_lock(port)
                                    /* shutting_down is still false */
                                    am654_8250_handle_rx_dma()
                                      omap_8250_rx_dma(up)
                                      serial_out(up, UART_OMAP_EFR2,
                                        UART_OMAP_EFR2_TIMEOUT_BEHAVE)
                                    uart_port_unlock(port)
  uart_port_lock_irq(port)
  up->dma->shutting_down = true
  omap_8250_rx_dma_flush(up)      <-- EFR2 is not cleared again

Neither omap_8250_startup() nor omap8250_restore_regs() resets
UART_OMAP_EFR2, so UART_OMAP_EFR2_TIMEOUT_BEHAVE stays set across
shutdown.  Clearing UART_OMAP_EFR2 inside the port->lock block after
omap_8250_rx_dma_flush() would also match the flush-then-clear order in
am654_8250_handle_rx_dma().

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261109-submit-serial-8250-dma-cancel-v1-v11-0-6364edca63d6@gmail.com?part=4

  reply	other threads:[~2026-11-10  4:29 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10  4:00 [PATCH v11 0/8] serial: 8250: serialize DMA cancellation with buffer reuse James Hilliard
2026-11-10  4:00 ` [PATCH v11 1/8] serial: 8250_omap: separate locked TX DMA completion processing James Hilliard
2026-11-10  4:05   ` sashiko-bot
2026-11-10  4:00 ` [PATCH v11 2/8] serial: serialize asynchronous write wakeups with the port lock James Hilliard
2026-11-10  4:15   ` sashiko-bot
2026-11-10  4:00 ` [PATCH v11 3/8] serial: 8250_omap: serialize RX DMA completion and flushing James Hilliard
2026-11-10  4:10   ` sashiko-bot
2026-11-10  4:00 ` [PATCH v11 4/8] serial: 8250_omap: quiesce DMA IRQ handling before shutdown James Hilliard
2026-11-10  4:29   ` sashiko-bot [this message]
2026-11-10  4:00 ` [PATCH v11 5/8] serial: core: allow drivers to reserve flushed transmit storage James Hilliard
2026-11-10  4:24   ` sashiko-bot
2026-11-10  4:00 ` [PATCH v11 6/8] serial: 8250: drain canceled TX DMA before reusing its buffer James Hilliard
2026-11-10  4:29   ` sashiko-bot
2026-11-10  4:00 ` [PATCH v11 7/8] serial: 8250: retire canceled RX DMA before reusing the receive buffer James Hilliard
2026-11-10  4:41   ` sashiko-bot
2026-11-10 21:05   ` Raul E Rangel
2026-11-10  4:00 ` [PATCH v11 8/8] serial: 8250: retain DMA resources when termination fails James Hilliard
2026-11-10  4:35   ` sashiko-bot

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-206203@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.