From: sashiko-bot@kernel.org
To: "Srinivas Neeli" <srinivas.neeli@amd.com>
Cc: Frank.Li@kernel.org, dmaengine@vger.kernel.org, vkoul@kernel.org
Subject: Re: [PATCH V3 2/4] dmaengine: xilinx_dma: Move descriptors to done list based on completion bit
Date: Thu, 09 Jul 2026 10:11:23 +0000 [thread overview]
Message-ID: <20260709101123.F2F9E1F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260708100652.603074-3-srinivas.neeli@amd.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Software state mismatch leading to hardware corruption and channel hang in AXI MCDMA.
- [Medium] Missing read memory barrier (`dma_rmb()`) after checking the DMA completion flag in coherent memory.
--
--- Patch [2]: [PATCH V3 2/4] dmaengine: xilinx_dma: Move descriptors to done list based on completion bit ---
commit d59255ad1a6d4a4beb643022da1f9820716a0752
Author: Srinivas Neeli <srinivas.neeli@amd.com>
dmaengine: xilinx_dma: Move descriptors to done list based on completion bit
In AXI MCDMA scatter-gather mode, xilinx_dma_complete_descriptor() previously
moved all active descriptors to the done list unconditionally. This commit adds
a check for the descriptor completion bit before moving entries, handling
scenarios where interrupt coalescing causes interrupts before all queued
descriptors are processed.
> diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c
> index 965fb69a2a3ad..9b8b6f1acd4ea 100644
> --- a/drivers/dma/xilinx/xilinx_dma.c
> +++ b/drivers/dma/xilinx/xilinx_dma.c
> @@ -1773,6 +1773,17 @@ static void xilinx_dma_complete_descriptor(struct xilinx_dma_chan *chan)
> struct xilinx_axidma_tx_segment, node);
> if (!(seg->hw.status & XILINX_DMA_BD_COMP_MASK) && chan->has_sg)
> break;
> + } else if (chan->xdev->dma_config->dmatype == XDMA_TYPE_AXIMCDMA) {
> + struct xilinx_aximcdma_tx_segment *seg;
> + u32 status;
> +
> + seg = list_last_entry(&desc->segments,
> + struct xilinx_aximcdma_tx_segment,
> + node);
> + status = (chan->direction == DMA_DEV_TO_MEM) ?
> + seg->hw.s2mm_status : seg->hw.mm2s_status;
> + if (!(status & XILINX_DMA_BD_COMP_MASK))
[Severity: Medium]
Is a read memory barrier needed after checking this completion status?
The CPU polls the s2mm_status or mm2s_status field in coherent memory to
check the completion bit. Without a dma_rmb() here, could weakly ordered
architectures speculatively execute subsequent descriptor reads out of
order?
This might result in stale reads of the descriptor fields later on
(for instance, during residue calculation) before the hardware has
actually confirmed completion.
> + break;
[Severity: High]
Does breaking out early here create a state mismatch with the IRQ handler?
If this check breaks out leaving descriptors in the active list, the
channel is technically still running. However, looking at the call chain,
xilinx_mcdma_irq_handler() immediately forces the channel idle and
starts a new transfer:
xilinx_mcdma_irq_handler() {
...
xilinx_dma_complete_descriptor(chan);
chan->idle = true;
chan->start_transfer(chan);
...
}
This appears to bypass the idle safety check in
xilinx_mcdma_start_transfer() and overwrite the CDESC hardware register
while the DMA engine is actively processing the remaining active list.
Could this software-splice new descriptors without establishing hardware
links, leading to a permanent channel hang?
> + }
> if (chan->has_sg && chan->xdev->dma_config->dmatype !=
> XDMA_TYPE_VDMA)
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260708100652.603074-1-srinivas.neeli@amd.com?part=2
next prev parent reply other threads:[~2026-07-09 10:11 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-08 10:06 [PATCH V3 0/4] dmaengine: xilinx_dma: MCDMA descriptor and metadata handling improvements Srinivas Neeli
2026-07-08 10:06 ` [PATCH V3 1/4] dmaengine: xilinx_dma: Fix MCDMA descriptor fields based on DMA direction Srinivas Neeli
2026-07-08 15:32 ` Pandey, Radhey Shyam
2026-07-08 10:06 ` [PATCH V3 2/4] dmaengine: xilinx_dma: Move descriptors to done list based on completion bit Srinivas Neeli
2026-07-08 15:56 ` Pandey, Radhey Shyam
2026-07-09 10:11 ` sashiko-bot [this message]
2026-07-09 15:48 ` Neeli, Srinivas
2026-07-08 10:06 ` [PATCH V3 3/4] net: xilinx: axienet: Derive RX frame length from DMA residue Srinivas Neeli
2026-07-08 16:41 ` Pandey, Radhey Shyam
2026-07-09 10:11 ` sashiko-bot
2026-07-09 16:18 ` Neeli, Srinivas
2026-07-08 10:06 ` [PATCH V3 4/4] dmaengine: xilinx_dma: Extend metadata handling for AXI DMA and MCDMA Srinivas Neeli
2026-07-09 10:11 ` sashiko-bot
2026-07-09 16:28 ` Neeli, Srinivas
2026-07-09 14:13 ` Pandey, Radhey Shyam
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=20260709101123.F2F9E1F00A3D@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=dmaengine@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=srinivas.neeli@amd.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox