All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: Frank.Li@oss.nxp.com
Cc: dmaengine@vger.kernel.org, linux-pci@vger.kernel.org,
	vkoul@kernel.org, imx@lists.linux.dev, Frank.Li@kernel.org
Subject: Re: [PATCH v6 10/10] dmaengine: dw-edma: Remove struct dw_edma_chunk
Date: Fri, 10 Jul 2026 17:08:36 +0000	[thread overview]
Message-ID: <20260710170836.C423E1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260710-edma_ll-v6-10-1471d278b73a@nxp.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

New issues:
- [High] Refactoring from bounded chunk arrays to a monolithic descriptor array introduces unbounded high-order atomic memory allocations that are prone to failure under fragmentation.

Pre-existing issues:
- [High] Pre-existing locking violation: `dw_edma_device_resume` invokes `dw_edma_start_transfer` without acquiring the virtual channel lock.
--

--- Patch [10]: [PATCH v6 10/10] dmaengine: dw-edma: Remove struct dw_edma_chunk ---
commit 04c138d15d0c47167bf151873232daba3b9881ad
Author: Frank Li <Frank.Li@nxp.com>
Subject: dmaengine: dw-edma: Remove struct dw_edma_chunk

This commit simplifies the DMA descriptor layout by removing the
dw_edma_chunk linked-list layer. The burst array is now allocated
directly within dw_edma_desc to reduce the number of allocations
required per descriptor.

> diff --git a/drivers/dma/dw-edma/dw-edma-core.c b/drivers/dma/dw-edma/dw-edma-core.c
> index 202862a828b4d..30eeb7bffad80 100644
> --- a/drivers/dma/dw-edma/dw-edma-core.c
> +++ b/drivers/dma/dw-edma/dw-edma-core.c

[ ... ]

> -static struct dw_edma_desc *dw_edma_alloc_desc(struct dw_edma_chan *chan)
> +static struct dw_edma_desc *
> +dw_edma_alloc_desc(struct dw_edma_chan *chan, size_t nburst)
>  {
>  	struct dw_edma_desc *desc;
>  
> -	desc = kzalloc_obj(*desc, GFP_NOWAIT);
> +	desc = kzalloc_flex(*desc, burst, nburst, GFP_NOWAIT);

[Severity: High]
Will this monolithic allocation approach cause large DMA transfers to fail?

In dw_edma_device_transfer(), the total burst count is passed directly here
as nburst without chunking. For large scatter-gather transfers, nburst could
be very large.

Since GFP_NOWAIT cannot sleep or reclaim memory, won't these large atomic
allocations fail reliably under memory fragmentation?

>  	if (unlikely(!desc))
>  		return NULL;
>  
>  	desc->chan = chan;
> -
> -	INIT_LIST_HEAD(&desc->chunk_list);
> +	desc->nburst = nburst;
> +	desc->cb = true;

[ ... ]

>  static int dw_edma_start_transfer(struct dw_edma_chan *chan)
>  {
> -	struct dw_edma_chunk *child;
>  	struct dw_edma_desc *desc;
>  	struct virt_dma_desc *vd;
>  
>  	vd = vchan_next_desc(&chan->vc);

[Severity: High]
This is a pre-existing issue, but is it safe for dw_edma_device_resume()
to call dw_edma_start_transfer() without holding the virtual channel lock?

dw_edma_start_transfer() calls vchan_next_desc() here, which actively unlinks
entries from the list.

If dw_edma_device_resume() bypasses spin_lock_irqsave(&chan->vc.lock) and a
concurrent hardware interrupt occurs, could this corrupt the virtual channel
lists?

>  	if (!vd)
>  		return 0;

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260710-edma_ll-v6-0-1471d278b73a@nxp.com?part=10

  reply	other threads:[~2026-07-10 17:08 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-10 16:47 [PATCH v6 00/10] dmaengine: dw-edma: flatten desc structions and simplify code Frank.Li
2026-07-10 16:47 ` [PATCH v6 01/10] dmaengine: dw-edma: Move control field update of DMA link to the last step Frank.Li
2026-07-10 16:57   ` sashiko-bot
2026-07-10 16:47 ` [PATCH v6 02/10] dmaengine: dw-edma: Add xfer_sz field to struct dw_edma_chunk Frank.Li
2026-07-10 16:56   ` sashiko-bot
2026-07-10 16:47 ` [PATCH v6 03/10] dmaengine: dw-edma: Move ll_region from struct dw_edma_chunk to struct dw_edma_chan Frank.Li
2026-07-10 17:05   ` sashiko-bot
2026-07-10 16:47 ` [PATCH v6 04/10] dmaengine: dw-edma: Pass down dw_edma_chan to reduce one level of indirection Frank.Li
2026-07-10 16:56   ` sashiko-bot
2026-07-10 16:47 ` [PATCH v6 05/10] dmaengine: dw-edma: Add helper dw_(edma|hdma)_v0_core_ch_enable() Frank.Li
2026-07-10 16:56   ` sashiko-bot
2026-07-10 16:47 ` [PATCH v6 06/10] dmaengine: dw-edma: Add callbacks to fill link list entries Frank.Li
2026-07-10 16:59   ` sashiko-bot
2026-07-10 16:47 ` [PATCH v6 07/10] dmaengine: dw-edma: Add non_ll_start() callback Frank.Li
2026-07-10 17:04   ` sashiko-bot
2026-07-10 16:47 ` [PATCH v6 08/10] dmaengine: dw-edma: Use common dw_edma_core_start() for both eDMA and HDMA Frank.Li
2026-07-10 17:03   ` sashiko-bot
2026-07-10 16:47 ` [PATCH v6 09/10] dmaengine: dw-edma: Use burst array instead of linked list Frank.Li
2026-07-10 17:07   ` sashiko-bot
2026-07-10 16:47 ` [PATCH v6 10/10] dmaengine: dw-edma: Remove struct dw_edma_chunk Frank.Li
2026-07-10 17:08   ` sashiko-bot [this message]
2026-07-10 17:23 ` [PATCH v6 00/10] dmaengine: dw-edma: flatten desc structions and simplify code Verma, Devendra
2026-07-10 17:28 ` Verma, Devendra

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=20260710170836.C423E1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=Frank.Li@oss.nxp.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=imx@lists.linux.dev \
    --cc=linux-pci@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=vkoul@kernel.org \
    /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.