Re: [PATCH v3 3/4] dmaengine: dw: Prevent tx-status calling DMA-desc callback

From: Frank Li

Date: Wed Oct 28 2026 - 12:34:46 EST


On Fri, Oct 23, 2026 at 10:27:24AM -0600, James Hilliard wrote:
> From: Serge Semin <fancer.lancer@xxxxxxxxx>
>
> The DMA transfer status getter can invoke a completion callback from
> dwc_scan_descriptors(). An 8250 RX timeout queries that status while
> holding the UART port lock, and its DMA callback takes the same lock:
>
> serial8250_handle_irq()
> uart_port_lock_irqsave(port)
> serial8250_rx_dma_flush()
> dmaengine_tx_status()
> dwc_scan_descriptors()
> dwc_descriptor_complete()
> dma_rx_complete()
> uart_port_lock_irqsave(port)
>
> Separate cookie completion from client notification. Under the channel
> lock, move completed descriptors onto a completion list and advance their
> cookies before starting queued work. The controller tasklet takes ownership
> of that list and invokes callbacks outside the lock. Termination discards
> notifications still on the shared list; the tasklet retains ownership of
> descriptors it has already detached.
>
> Keep handling raw completion events from tx_status(). Clients such as
> catpt poll transfers without DMA_PREP_INTERRUPT and can mask the controller
> interrupt externally. Polling must still advance software-emulated LLP
> blocks and complete cookies without waiting for tasklet execution. Schedule
> the tasklet for deferred notifications and calculate residue separately
> for active and queued transfers.
>
> Serialize cookie updates with termination so a delayed callback cannot
> move completed_cookie back behind a canceled transfer. On channel release,
> wait for an executing tasklet and discard queued notifications before
> clearing channel configuration. A pending tasklet run can then return
> without accessing a controller whose last channel has been released.

Can you split into smaller patches?

Frank