From: "Peng Fan (OSS)" <peng.fan@oss.nxp.com>
To: Jiale Yao <yaojiale02@163.com>
Cc: Peng Fan <peng.fan@oss.nxp.com>, Frank Li <Frank.Li@kernel.org>,
Zhang Wei <zw@zh-kernel.org>,
Sascha Hauer <s.hauer@pengutronix.de>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>,
Linus Walleij <linusw@kernel.org>,
H Hartley Sweeten <hsweeten@visionengravers.com>,
Ryan Mallon <rmallon@gmail.com>,
Mika Westerberg <mika.westerberg@iki.fi>,
Ebony Zhu <ebony.zhu@freescale.com>,
Kumar Gala <galak@gate.crashing.org>,
Dan Williams <djbw@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Zhangfei Gao <zhangfei.gao@marvell.com>,
Arnd Bergmann <arnd@arndb.de>, Qiao Zhou <zhouqiao@marvell.com>,
Leo Yan <leoy@marvell.com>,
Lennert Buytenhek <buytenh@marvell.com>,
Nicolas Pitre <nico@marvell.com>,
Saeed Bishara <saeed@marvell.com>,
Maciej Sosnowski <maciej.sosnowski@intel.com>,
Shawn Guo <shawn.guo@freescale.com>,
Srinidh Kasagar <srinidhi.kasagar@stericsson.com>,
dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org,
linuxppc-dev@lists.ozlabs.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 0/7] dmaengine: drain completion tasklets during teardown
Date: Tue, 20 Oct 2026 15:36:19 +0800 [thread overview]
Message-ID: <20261020073620.224795-1-peng.fan@oss.nxp.com> (raw)
In-Reply-To: <20261018040724.534641-1-yaojiale02@163.com>
On Sun, 18 Oct 2026 12:07:16 +0800 Jiale Yao <yaojiale02@163.com> wrote:
> Several DMAengine drivers defer interrupt completion processing to
> tasklets, but release channel resources without draining tasklets that
> were already queued. Stopping or releasing an IRQ prevents new hard IRQ
> handlers, but does not synchronize the deferred tasklet.
>
> Depending on the driver, a late tasklet can access freed descriptor
> storage or invoke a completion callback after its client data has been
> released. Ensure each producer is stopped before killing the tasklet and
> freeing the resources it can access.
>
> Each patch is independent and keeps the synchronization local to one
> driver's channel or device teardown path.
>
> Jiale Yao (7):
> dmaengine: ep93xx: drain tasklet before freeing channel resources
> dmaengine: fsldma: drain channel tasklet during removal
> dmaengine: mmp_pdma: drain channel tasklets during removal
> dmaengine: mmp_tdma: synchronize tasklet when freeing a channel
> dmaengine: mv_xor: drain IRQ tasklet before freeing channel memory
> dmaengine: mxs-dma: synchronize tasklet when freeing a channel
> dmaengine: ste_dma40: synchronize tasklet when releasing a channel
>
> drivers/dma/ep93xx_dma.c | 4 +++-
> drivers/dma/fsldma.c | 1 +
> drivers/dma/mmp_pdma.c | 4 ++++
> drivers/dma/mmp_tdma.c | 2 ++
> drivers/dma/mv_xor.c | 6 ++++--
> drivers/dma/mxs-dma.c | 1 +
> drivers/dma/ste_dma40.c | 2 ++
You might need to add a bit more context on the issues.
Taking mxs-dma for example, it is non-SMP processor.
The normal completion path is:
1. DMA hardirq fires -> mxs_dma_int_handler() -> tasklet_schedule() -> raises TASKLET_SOFTIRQ
2. irq_exit() -> softirq processing -> tasklet_action() -> mxs_dma_tasklet() runs
3. Return to process context
The tasklet almost always completes before process context resumes.
The only way to hit the race on UP is if softirq processing gets deferred
to ksoftirqd, and then:
In PREEMPT_RT case: Tasklets become threaded and can interleave.
Is there a chance that in non-RT case, could we hit issues on UP processor?
Or I may understand wrong?
Regards
Peng
> 7 files changed, 17 insertions(+), 3 deletions(-)
>
> --
> 2.34.1
Sent using hkml (https://github.com/sjp38/hackermail)
next prev parent reply other threads:[~2026-10-20 7:39 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-18 4:07 [PATCH 0/7] dmaengine: drain completion tasklets during teardown Jiale Yao
2026-10-18 4:07 ` [PATCH 1/7] dmaengine: ep93xx: drain tasklet before freeing channel resources Jiale Yao
2026-10-18 4:19 ` sashiko-bot
2026-10-18 4:07 ` [PATCH 2/7] dmaengine: fsldma: drain channel tasklet during removal Jiale Yao
2026-10-18 4:07 ` [PATCH 3/7] dmaengine: mmp_pdma: drain channel tasklets " Jiale Yao
2026-10-18 4:07 ` [PATCH 4/7] dmaengine: mmp_tdma: synchronize tasklet when freeing a channel Jiale Yao
2026-10-18 4:25 ` sashiko-bot
2026-10-18 4:07 ` [PATCH 5/7] dmaengine: mv_xor: drain IRQ tasklet before freeing channel memory Jiale Yao
2026-10-18 4:07 ` [PATCH 6/7] dmaengine: mxs-dma: synchronize tasklet when freeing a channel Jiale Yao
2026-10-18 4:07 ` [PATCH 7/7] dmaengine: ste_dma40: synchronize tasklet when releasing " Jiale Yao
2026-10-18 21:00 ` Linus Walleij
2026-10-20 7:36 ` Peng Fan (OSS) [this message]
2026-10-20 8:10 ` Re:Re: [PATCH 0/7] dmaengine: drain completion tasklets during teardown jiale yao
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=20261020073620.224795-1-peng.fan@oss.nxp.com \
--to=peng.fan@oss.nxp.com \
--cc=Frank.Li@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=buytenh@marvell.com \
--cc=djbw@kernel.org \
--cc=dmaengine@vger.kernel.org \
--cc=ebony.zhu@freescale.com \
--cc=festevam@gmail.com \
--cc=galak@gate.crashing.org \
--cc=hsweeten@visionengravers.com \
--cc=imx@lists.linux.dev \
--cc=kernel@pengutronix.de \
--cc=leoy@marvell.com \
--cc=linusw@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maciej.sosnowski@intel.com \
--cc=mika.westerberg@iki.fi \
--cc=nico@marvell.com \
--cc=rmallon@gmail.com \
--cc=s.hauer@pengutronix.de \
--cc=saeed@marvell.com \
--cc=shawn.guo@freescale.com \
--cc=srinidhi.kasagar@stericsson.com \
--cc=yaojiale02@163.com \
--cc=zhangfei.gao@marvell.com \
--cc=zhouqiao@marvell.com \
--cc=zw@zh-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