From: James Hilliard <james.hilliard1@gmail.com>
To: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>,
Vinod Koul <vkoul@kernel.org>, Frank Li <Frank.Li@kernel.org>,
Sergey Khimich <serghox@gmail.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Sia Jee Heng <jee.heng.sia@intel.com>
Cc: Mitch Barnett <mitch@accuratesound.ca>,
dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org,
James Hilliard <james.hilliard1@gmail.com>,
Wang YuWei <1973615295@qq.com>,
stable@vger.kernel.org
Subject: [PATCH v6 6/7] dmaengine: dw-axi-dmac: retain descriptors until callbacks drain
Date: Sun, 15 Nov 2026 23:00:47 -0700 [thread overview]
Message-ID: <20261115-submit-dw-axi-dma-stop-pause-v1-v6-6-bcb23d1e7029@gmail.com> (raw)
In-Reply-To: <20261115-submit-dw-axi-dma-stop-pause-v1-v6-0-bcb23d1e7029@gmail.com>
Termination frees every descriptor while a pending period callback can
still refer to one through vc->cyclic. An executing callback has already
cleared that pointer, but still receives a pointer to the descriptor's
tx_result and can use it after termination frees the descriptor.
An error interrupt can also move the cyclic descriptor to desc_completed
before termination. Looking only at the head of desc_issued therefore
does not cover every pending cyclic callback.
Use vchan_terminate_all() after stopping the channel to clear the pending
alias and move the collected descriptors to desc_terminated. The existing
synchronize callback drains the tasklet before reclaiming that list.
Descriptors already detached onto the tasklet's private completed list
remain owned by the tasklet. Repeated termination preserves the retired
list, including when called from a completion callback.
Fixes: 1deb96c0fa58 ("dmaegine: dw-axi-dmac: Support device_prep_dma_cyclic()")
Reported-by: Wang YuWei <1973615295@qq.com>
Link: https://lore.kernel.org/r/tencent_C00D995A9F70206DFD1330DCB1222EEBCB07@qq.com/
Reported-by: Mitch Barnett <mitch@accuratesound.ca>
Cc: Wang YuWei <1973615295@qq.com>
Cc: stable@vger.kernel.org
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
---
drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
index cd9a5b45d295..97098367535f 100644
--- a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
+++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
@@ -1203,7 +1203,6 @@ static int dma_chan_terminate_all(struct dma_chan *dchan)
unsigned long flags;
bool enabled;
int ret;
- LIST_HEAD(head);
spin_lock_irqsave(&chan->vc.lock, flags);
@@ -1224,7 +1223,7 @@ static int dma_chan_terminate_all(struct dma_chan *dchan)
if (chan->direction == DMA_MEM_TO_DEV)
dw_axi_dma_set_byte_halfword(chan, false);
- vchan_get_all_descriptors(&chan->vc, &head);
+ vchan_terminate_all(&chan->vc);
axi_chan_irq_clear(chan, DWAXIDMAC_IRQ_SUSPENDED);
chan->desc = NULL;
@@ -1233,8 +1232,6 @@ static int dma_chan_terminate_all(struct dma_chan *dchan)
chan->cyclic_restart = false;
spin_unlock_irqrestore(&chan->vc.lock, flags);
- vchan_dma_desc_free_list(&chan->vc, &head);
-
dev_vdbg(dmaengine_chan_dev(dchan), "terminated: %s\n", axi_chan_name(chan));
return 0;
--
2.53.0
next prev parent reply other threads:[~2026-11-16 6:01 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 6:00 [PATCH v6 0/7] dmaengine: dw-axi-dmac: fix termination and pause acknowledgment James Hilliard
2026-11-16 6:00 ` [PATCH v6 1/7] dmaengine: dw-axi-dmac: keep cyclic mode in the descriptor James Hilliard
2026-11-16 6:00 ` [PATCH v6 2/7] dmaengine: dw-axi-dmac: poll the correct enable bit during termination James Hilliard
2026-11-16 6:00 ` [PATCH v6 3/7] dmaengine: dw-axi-dmac: retain descriptors when termination times out James Hilliard
2026-11-16 6:00 ` [PATCH v6 4/7] dmaengine: dw-axi-dmac: use atomic polling for suspend acknowledgment James Hilliard
2026-11-16 6:00 ` [PATCH v6 5/7] dmaengine: dw-axi-dmac: preserve pending pause requests James Hilliard
2026-11-16 6:00 ` James Hilliard [this message]
2026-11-16 6:00 ` [PATCH v6 7/7] dmaengine: dw-axi-dmac: serialize interrupt status with channel reuse James Hilliard
2026-11-17 2:42 ` [PATCH v6 0/7] dmaengine: dw-axi-dmac: fix termination and pause acknowledgment Mitch Barnett
2026-11-17 3:19 ` James Hilliard
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=20261115-submit-dw-axi-dma-stop-pause-v1-v6-6-bcb23d1e7029@gmail.com \
--to=james.hilliard1@gmail.com \
--cc=1973615295@qq.com \
--cc=Eugeniy.Paltsev@synopsys.com \
--cc=Frank.Li@kernel.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=dmaengine@vger.kernel.org \
--cc=jee.heng.sia@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mitch@accuratesound.ca \
--cc=serghox@gmail.com \
--cc=stable@vger.kernel.org \
--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
all inboxes | Powered by JetHome®