Skip to content

dmaengine: migrate channel tasklets to WQ_BH

Allen Pais asahi dmaengine imx linux-arm-kernel linux-arm-msm linux-mediatek linux-mips linux-riscv linux-sunxi linux-tegra linuxppc-dev lkml sashiko-reviews 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest33 patches 4 repliesIn review
  2. v334 patches 43 repliesSuperseded
  3. v264 patches 11 repliesSuperseded

Changes in v4 from the cover letter

- post as a new thread instead of in reply to v3 (Andy)
- rebase onto v7.4-rc2. The ste_dma40 rework merged for 7.4-rc1 added tasklet_schedule() calls in the d40_queue_start() error paths and a devm action that kills the channel tasklets; both now use the BH helpers. fsldma and mv_xor gained tasklet_kill() calls in their channel remove and error paths, which are converted as well. zynqmp_dma and altera-msgdma only needed context fixes. The new amlogic-dma driver and the new at_hdmac channel cleanup path kill the virt-dma channel tasklet directly and are converted in 01/33.
- drop the DW DMA patch (v3 31/34). Andy considers it unneeded churn ahead of a larger cleanup of that driver.
- pl330: initialize the channel BH at probe time instead of in alloc_chan_resources(). dmaengine_init_bh() warns when called on an already initialized channel, and channels can be re-requested.
- txx9dmac: channels served by the shared controller interrupt keep scanning descriptors from the controller tasklet. v3 scheduled a BH that was never initialized for them.
- timb_dma: recompute TIMBDMA_IER from the channel BH once the channel has been finished, and drain the channel BHs on remove and in the probe error path.
- mpc512x: drain the channel BHs in mpc_dma_remove().
- sf-pdma: reset the retry budget when abandoning a descriptor, and spell out in the changelog how the new error path mirrors the done tasklet (Frank).
- hidma: leave hidma_free() unchanged (Frank). Drain the BH in free_chan_resources() and in remove(), after killing the low-level completion tasklet and before hidma_ll_uninit(), and add a device_synchronize() callback.
- qcom-gpi: synchronize the vchan before the channel ring is freed, and add a device_synchronize() callback.
- collect Frank Li's Reviewed-by from v3. I kept it on patches that only picked up mechanical conversions from the rebase (01, 06, 12, 17, 21, 27, 30). timb_dma, txx9dmac, mpc512x, pl330 and qcom-gpi changed enough that I have not carried his tag forward on those.

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/33dmaengine: add tasklet-backed channel BH helpersdrivers/dma/amlogic-dma.c drivers/dma/at_hdmac.c drivers/dma/bcm2835-dma.c +34 more+128 -570 replies
2/33dmaengine: back channel BH helpers with WQ_BHdrivers/dma/dmaengine.c include/linux/dmaengine.h+54 -153 replies
3/33dmaengine: apple-admac: use dmaengine BH callbackdrivers/dma/apple-admac.c+6 -100 replies
4/33dmaengine: at_xdmac: move irq bottom half to dmaengine BHdrivers/dma/at_xdmac.c+6 -70 replies
5/33dmaengine: ep93xx: hook callbacks via dmaengine BHdrivers/dma/ep93xx_dma.c+5 -70 replies
6/33dmaengine: fsldma: migrate tasklet to dmaengine BHdrivers/dma/fsldma.c drivers/dma/fsldma.h+6 -70 replies
7/33dmaengine: fsl_raid: run completions via dmaengine BHdrivers/dma/fsl_raid.c drivers/dma/fsl_raid.h+6 -60 replies
8/33dmaengine: imx-dma: flip per-chan tasklet to dmaengine BHdrivers/dma/imx-dma.c+13 -130 replies
9/33dmaengine: ioat: convert cleanup tasklet to dmaengine BHdrivers/dma/ioat/dma.c drivers/dma/ioat/dma.h drivers/dma/ioat/init.c+9 -100 replies
10/33dmaengine: mmp_pdma: replace per-chan tasklet with dmaengine BHdrivers/dma/mmp_pdma.c+5 -80 replies
11/33dmaengine: mmp_tdma: hook completions to dmaengine BHdrivers/dma/mmp_tdma.c+4 -50 replies
12/33dmaengine: mv_xor: convert irq tasklet to dmaengine BHdrivers/dma/mv_xor.c drivers/dma/mv_xor.h+7 -90 replies
13/33dmaengine: mxs-dma: use dmaengine BH schedulingdrivers/dma/mxs-dma.c+5 -60 replies
14/33dmaengine: nbpfaxi: switch callbacks to dmaengine BHdrivers/dma/nbpfaxi.c+6 -70 replies
15/33dmaengine: pch_dma: convert tasklet to dmaengine BHdrivers/dma/pch_dma.c+7 -70 replies
16/33dmaengine: ppc4xx: replace irq tasklet with dmaengine BHdrivers/dma/ppc4xx/adma.c drivers/dma/ppc4xx/adma.h+7 -90 replies
17/33dmaengine: ste_dma40: convert per-channel tasklet to dmaengine BHdrivers/dma/ste_dma40.c+13 -160 replies
18/33dmaengine: xgene-dma: wire descriptor cleanup to dmaengine BHdrivers/dma/xgene-dma.c+9 -100 replies
19/33dmaengine: xilinx-dma: use dmaengine BH instead of taskletsdrivers/dma/xilinx/xilinx_dma.c+9 -110 replies
20/33dmaengine: xilinx-dpdma: kill vchan BH on removedrivers/dma/xilinx/xilinx_dpdma.c+1 -00 replies
21/33dmaengine: zynqmp-dma: switch completion tasklet to dmaengine BHdrivers/dma/xilinx/zynqmp_dma.c+9 -100 replies
22/33dmaengine: tegra20-apb: use channel BH helpersdrivers/dma/tegra20-apb-dma.c+9 -90 replies
23/33dmaengine: timb_dma: route callbacks via channel BHdrivers/dma/timb_dma.c+36 -50 replies
24/33dmaengine: txx9dmac: route callbacks via channel BHdrivers/dma/txx9dmac.c drivers/dma/txx9dmac.h+5 -60 replies
25/33dmaengine: mv_xor_v2: use channel BH helpersdrivers/dma/mv_xor_v2.c+9 -110 replies
26/33dmaengine: mpc512x: route callbacks via channel BHdrivers/dma/mpc512x_dma.c+51 -270 replies
27/33dmaengine: plx_dma: use channel BH helpersdrivers/dma/plx_dma.c+6 -60 replies
28/33dmaengine: sf-pdma: route error callbacks through channel BHdrivers/dma/sf-pdma/sf-pdma.c+15 -30 replies
29/33dmaengine: pl330: route callbacks via channel BHdrivers/dma/pl330.c+8 -110 replies
30/33dmaengine: altera-msgdma: use channel BH helpersdrivers/dma/altera-msgdma.c+7 -71 reply
31/33dmaengine: hidma: defer callbacks via channel BHdrivers/dma/qcom/hidma.c+23 -10 replies
32/33dmaengine: qcom-gpi: defer callbacks via vchandrivers/dma/qcom/gpi.c+23 -40 replies
33/33dmaengine: switchtec: use channel BH helpersdrivers/dma/switchtec_dma.c+8 -80 replies

Reviews trailers per patch

23 of 33 patches have a Reviewed-by or Acked-by.

PatchFrank LiDave JiangLinus WalleijLogan GunthorpeAdrian Ng Ho Yin
1/33R-b
2/33R-b
3/33R-b
4/33R-b
5/33R-b
6/33R-b
7/33
8/33R-b
9/33R-b A-b
10/33R-b
11/33R-b
12/33R-b
13/33R-b
14/33
15/33R-b
16/33R-b
17/33R-b R-b
18/33R-b
19/33R-b
20/33R-b
21/33R-b
22/33
23/33
24/33
25/33R-b
26/33
27/33R-b R-b
28/33
29/33
30/33R-b A-b
31/33
32/33
33/33R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 5 reviewers.

Read the v4 thread

Cover letter [PATCH v4 00/33] dmaengine: migrate channel tasklets to WQ_BH

Hi Vinod, Frank and Arnd,

This series moves DMAengine client completion bottom halves from private tasklets to a common per-channel API backed by WQ_BH.

The first patch introduces the dmaengine_*_bh() API with a tasklet backend and converts virt-dma to it. It also updates every driver that directly accesses the removed virt_dma_chan tasklet, keeping the patch buildable on its own. This separates the driver-facing API from its implementation without changing callback context.

The second patch switches that backend to a dedicated WQ_BH | WQ_PERCPU workqueue. WQ_BH keeps callbacks in softirq context, while the common API centralizes initialization, scheduling, and synchronization. The workqueue helpers remain internal to DMAengine, and dmaengine_kill_bh() drains scheduled callbacks to preserve tasklet_kill() semantics.

The remaining patches convert driver-owned channel completion tasklets. Tasklets used for controller-level processing, recovery, or other non-client-callback work are deliberately left alone because the appropriate replacement may differ by driver.

As agreed in the RFC discussion, selecting hardirq callback delivery is a separate API change and is not part of this series.

Frank asked about DMAengine users outside drivers/dma/ that still open-code completion tasklets. Those will be converted in a follow-up series once this one has landed, to keep this set from growing further.

Earlier discussion:
https://lore.kernel.org/all/[email protected]/

v2:
https://lore.kernel.org/all/[email protected]/

v3:
https://lore.kernel.org/all/[email protected]/

Changes since v3:
- post as a new thread instead of in reply to v3 (Andy)
- rebase onto v7.4-rc2. The ste_dma40 rework merged for 7.4-rc1 added tasklet_schedule() calls in the d40_queue_start() error paths and a devm action that kills the channel tasklets; both now use the BH helpers. fsldma and mv_xor gained tasklet_kill() calls in their channel remove and error paths, which are converted as well. zynqmp_dma and altera-msgdma only needed context fixes. The new amlogic-dma driver and the new at_hdmac channel cleanup path kill the virt-dma channel tasklet directly and are converted in 01/33.
- drop the DW DMA patch (v3 31/34). Andy considers it unneeded churn ahead of a larger cleanup of that driver.
- pl330: initialize the channel BH at probe time instead of in alloc_chan_resources(). dmaengine_init_bh() warns when called on an already initialized channel, and channels can be re-requested.
- txx9dmac: channels served by the shared controller interrupt keep scanning descriptors from the controller tasklet. v3 scheduled a BH that was never initialized for them.
- timb_dma: recompute TIMBDMA_IER from the channel BH once the channel has been finished, and drain the channel BHs on remove and in the probe error path.
- mpc512x: drain the channel BHs in mpc_dma_remove().
- sf-pdma: reset the retry budget when abandoning a descriptor, and spell out in the changelog how the new error path mirrors the done tasklet (Frank).
- hidma: leave hidma_free() unchanged (Frank). Drain the BH in free_chan_resources() and in remove(), after killing the low-level completion tasklet and before hidma_ll_uninit(), and add a device_synchronize() callback.
- qcom-gpi: synchronize the vchan before the channel ring is freed, and add a device_synchronize() callback.
- collect Frank Li's Reviewed-by from v3. I kept it on patches that only picked up mechanical conversions from the rebase (01, 06, 12, 17, 21, 27, 30). timb_dma, txx9dmac, mpc512x, pl330 and qcom-gpi changed enough that I have not carried his tag forward on those.

The driver changes above came out of going through the Sashiko reports on v3. Most of what it flagged are pre-existing teardown and locking issues in the individual drivers that this series does not make worse; those are out of scope here.

Review tags retained on unchanged standalone patches:
- 09/33 IOAT: Acked-by Dave Jiang
- 17/33 STE DMA40: Reviewed-by Linus Walleij (the rebase only added the mechanical conversions mentioned above)
- 27/33 PLX DMA and 33/33 Switchtec: Reviewed-by Logan Gunthorpe

Review tags received on v2 patches now folded into 01/33:
- v2 41/64 HSU: Reviewed-by Andy Shevchenko
- v2 60/64 BAM DMA: Acked-by Bartosz Golaszewski

The HSU and BAM DMA changes remain in 01/33, but those patch-specific trailers are not attached to the substantially broader 37-file patch. Andy and Bartosz are copied here and on 01/33 for visibility.

Testing:
- build-tested on top of v7.4-rc2 with W=1 for drivers/dma/, with no new warnings compared to the base commit:
- arm64, x86_64 and arm allmodconfig
- powerpc 44x/katmai_defconfig + AMCC_PPC440SPE_ADMA, mpc512x_defconfig + MPC512X_DMA, mpc85xx_smp_defconfig + FSL_DMA, and the same with FSL_DMA replaced by FSL_RAID
- mips rbtx49xx_defconfig + TXX9_DMAC
- every patch builds on its own (drivers/dma/) with the arm64 and x86_64 allmodconfig configurations
- the series also applies cleanly on dmaengine/next (currently v7.4-rc1)
- scripts/checkpatch.pl --strict is clean on all 33 patches
- the sf-pdma and hidma changes are compile-tested only; testing on hardware would be appreciated

Allen Pais (33):
dmaengine: add tasklet-backed channel BH helpers
dmaengine: back channel BH helpers with WQ_BH
dmaengine: apple-admac: use dmaengine BH callback
dmaengine: at_xdmac: move irq bottom half to dmaengine BH
dmaengine: ep93xx: hook callbacks via dmaengine BH
dmaengine: fsldma: migrate tasklet to dmaengine BH
dmaengine: fsl_raid: run completions via dmaengine BH
dmaengine: imx-dma: flip per-chan tasklet to dmaengine BH
dmaengine: ioat: convert cleanup tasklet to dmaengine BH
dmaengine: mmp_pdma: replace per-chan tasklet with dmaengine BH
dmaengine: mmp_tdma: hook completions to dmaengine BH
dmaengine: mv_xor: convert irq tasklet to dmaengine BH
dmaengine: mxs-dma: use dmaengine BH scheduling
dmaengine: nbpfaxi: switch callbacks to dmaengine BH
dmaengine: pch_dma: convert tasklet to dmaengine BH
dmaengine: ppc4xx: replace irq tasklet with dmaengine BH
dmaengine: ste_dma40: convert per-channel tasklet to dmaengine BH
dmaengine: xgene-dma: wire descriptor cleanup to dmaengine BH
dmaengine: xilinx-dma: use dmaengine BH instead of tasklets
dmaengine: xilinx-dpdma: kill vchan BH on remove
dmaengine: zynqmp-dma: switch completion tasklet to dmaengine BH
dmaengine: tegra20-apb: use channel BH helpers
dmaengine: timb_dma: route callbacks via channel BH
dmaengine: txx9dmac: route callbacks via channel BH
dmaengine: mv_xor_v2: use channel BH helpers
dmaengine: mpc512x: route callbacks via channel BH
dmaengine: plx_dma: use channel BH helpers
dmaengine: sf-pdma: route error callbacks through channel BH
dmaengine: pl330: route callbacks via channel BH
dmaengine: altera-msgdma: use channel BH helpers
dmaengine: hidma: defer callbacks via channel BH
dmaengine: qcom-gpi: defer callbacks via vchan
dmaengine: switchtec: use channel BH helpers

 drivers/dma/altera-msgdma.c                   | 14 +--
 drivers/dma/amlogic-dma.c                     |  4 +-
 drivers/dma/apple-admac.c                     | 16 ++--
 drivers/dma/at_hdmac.c                        |  2 +-
 drivers/dma/at_xdmac.c                        | 13 ++-
 drivers/dma/bcm2835-dma.c                     |  2 +-
 drivers/dma/dma-axi-dmac.c                    | 10 ++-
 drivers/dma/dma-jz4780.c                      |  2 +-
 drivers/dma/dmaengine.c                       | 89 ++++++++++++++++++-
 .../dma/dw-axi-dmac/dw-axi-dmac-platform.c    |  2 +-
 drivers/dma/dw-edma/dw-edma-core.c            |  2 +-
 drivers/dma/ep93xx_dma.c                      | 12 ++-
 drivers/dma/fsl-edma-common.c                 |  2 +-
 drivers/dma/fsl-qdma.c                        |  2 +-
 drivers/dma/fsl_raid.c                        | 11 +--
 drivers/dma/fsl_raid.h                        |  1 -
 drivers/dma/fsldma.c                          | 12 +--
 drivers/dma/fsldma.h                          |  1 -
 drivers/dma/hisi_dma.c                        |  2 +-
 drivers/dma/hsu/hsu.c                         |  2 +-
 drivers/dma/idma64.c                          |  4 +-
 drivers/dma/img-mdc-dma.c                     |  2 +-
 drivers/dma/imx-dma.c                         | 26 +++---
 drivers/dma/imx-sdma.c                        |  4 +-
 drivers/dma/ioat/dma.c                        | 14 +--
 drivers/dma/ioat/dma.h                        |  3 +-
 drivers/dma/ioat/init.c                       |  2 +-
 drivers/dma/k3dma.c                           |  2 +-
 drivers/dma/loongson/loongson1-apb-dma.c      |  2 +-
 drivers/dma/mediatek/mtk-cqdma.c              |  2 +-
 drivers/dma/mediatek/mtk-hsdma.c              |  2 +-
 drivers/dma/mediatek/mtk-uart-apdma.c         |  4 +-
 drivers/dma/mmp_pdma.c                        | 13 ++-
 drivers/dma/mmp_tdma.c                        |  9 +-
 drivers/dma/mpc512x_dma.c                     | 78 ++++++++++------
 drivers/dma/mv_xor.c                          | 14 +--
 drivers/dma/mv_xor.h                          |  2 -
 drivers/dma/mv_xor_v2.c                       | 20 ++---
 drivers/dma/mxs-dma.c                         | 11 ++-
 drivers/dma/nbpfaxi.c                         | 13 ++-
 drivers/dma/owl-dma.c                         |  2 +-
 drivers/dma/pch_dma.c                         | 14 +--
 drivers/dma/pl330.c                           | 19 ++--
 drivers/dma/plx_dma.c                         | 12 +--
 drivers/dma/ppc4xx/adma.c                     | 14 +--
 drivers/dma/ppc4xx/adma.h                     |  2 -
 drivers/dma/pxa_dma.c                         |  2 +-
 drivers/dma/qcom/bam_dma.c                    |  4 +-
 drivers/dma/qcom/gpi.c                        | 27 +++++-
 drivers/dma/qcom/hidma.c                      | 24 ++++-
 drivers/dma/qcom/qcom_adm.c                   |  4 +-
 drivers/dma/sa11x0-dma.c                      |  2 +-
 drivers/dma/sf-pdma/sf-pdma.c                 | 18 +++-
 drivers/dma/sprd-dma.c                        |  2 +-
 drivers/dma/st_fdma.c                         |  2 +-
 drivers/dma/ste_dma40.c                       | 29 +++---
 drivers/dma/sun6i-dma.c                       |  2 +-
 drivers/dma/switchtec_dma.c                   | 16 ++--
 drivers/dma/tegra186-gpc-dma.c                |  2 +-
 drivers/dma/tegra20-apb-dma.c                 | 18 ++--
 drivers/dma/tegra210-adma.c                   |  2 +-
 drivers/dma/ti/edma.c                         |  2 +-
 drivers/dma/ti/k3-udma.c                      | 12 +--
 drivers/dma/ti/omap-dma.c                     |  2 +-
 drivers/dma/timb_dma.c                        | 41 +++++++--
 drivers/dma/txx9dmac.c                        | 10 +--
 drivers/dma/txx9dmac.h                        |  1 -
 drivers/dma/virt-dma.c                        | 12 +--
 drivers/dma/virt-dma.h                        |  7 +-
 drivers/dma/xgene-dma.c                       | 19 ++--
 drivers/dma/xilinx/xilinx_dma.c               | 20 ++---
 drivers/dma/xilinx/xilinx_dpdma.c             |  1 +
 drivers/dma/xilinx/zynqmp_dma.c               | 19 ++--
 include/linux/dmaengine.h                     | 28 ++++++
 74 files changed, 503 insertions(+), 316 deletions(-)

base-commit: 7475ea8b58616b33c04afb976cf0fbaad9dd63fb

Signature · 1 line
2.43.0