Re: [PATCH v6 04/10] dmaengine: dw-edma: Make DMA link list work as a circular buffer

[email protected]
Newsgroups org.kernel.vger.dmaengine
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The driver explicitly rejects linked-list DMA descriptors larger than the ring size, breaking support for large DMA transfers.
--

--- Patch [4]: [PATCH v6 04/10] dmaengine: dw-edma: Make DMA link list work as a circular buffer ---
commit afa3e356ba74dbd5874af4d32f4fd3abdf7cbf7c
Author: Frank Li <[email protected]>

dmaengine: dw-edma: Make DMA link list work as a circular buffer

This patch converts the DMA link list into a circular buffer instead of
rebuilding it for every transfer. It clears control words before first use,
rejects descriptors that exceed the usable ring capacity, and resets the
ring after termination or abort.

> diff --git a/drivers/dma/dw-edma/dw-edma-core.c b/drivers/dma/dw-edma/dw-edma-core.c
> index a6bb68ffdfe26..1af262b6e881e 100644
> --- a/drivers/dma/dw-edma/dw-edma-core.c
> +++ b/drivers/dma/dw-edma/dw-edma-core.c
> @@ -51,13 +51,19 @@ dw_edma_alloc_desc(struct dw_edma_chan *chan, size_t nburst)
>  {
>  	struct dw_edma_desc *desc;
>  
> +	/*
> +	 * For now, a descriptor that does not fit would stall the channel
> +	 * forever: reject it up front.
> +	 */
> +	if (!chan->non_ll && nburst > chan->ll_max - 1)
> +		return NULL;
> +

[Severity: High]
Does this change break support for large DMA transfers?

By explicitly rejecting linked-list DMA descriptors larger than the ring
size, any client driver (such as storage or networking) that submits a
scatter-gather transfer larger than chan->ll_max - 1 will fail
unconditionally.

While the commit message acknowledges this as a limitation "until reclaim
support lands", that support appears to be completely missing from this
patch series.

Could this cause functional regressions for subsystems relying on this DMA
engine to submit moderately large transfers?

[ ... ]

> @@ -645,6 +708,8 @@ static void dw_edma_done_interrupt(struct dw_edma_chan *chan)
>  							    DMA_TRANS_NOERROR);
>  				list_del(&vd->node);
>  				vchan_cookie_complete(vd);
> +				if (!chan->non_ll)
> +					chan->ll_done = chan->ll_head;
>  			}
>  
>  			if (chan->request == EDMA_REQ_PAUSE) {

[Severity: High]
Since ring space is only reclaimed here when an entire descriptor completes,
does this structural change prevent incrementally chunking large descriptors?

Without the ability to reclaim space as partial transfers complete, this
seems to be the reason why large transfers can no longer be supported.

Could partial completions be handled here to prevent the functional regression
before the full reclaim support lands?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.