dmaengine: migrate channel tasklets to WQ_BH
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v4 Latest33 patches 4 repliesIn review
- v334 patches 43 repliesSuperseded
- 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 files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/33 | dmaengine: add tasklet-backed channel BH helpersdrivers/ drivers/ drivers/ +34 more | +128 | 0 replies | |
| 2/33 | dmaengine: back channel BH helpers with WQ_BHdrivers/ include/ | +54 | 3 replies | |
| 3/33 | dmaengine: apple-admac: use dmaengine BH callbackdrivers/ | +6 | 0 replies | |
| 4/33 | dmaengine: at_xdmac: move irq bottom half to dmaengine BHdrivers/ | +6 | 0 replies | |
| 5/33 | dmaengine: ep93xx: hook callbacks via dmaengine BHdrivers/ | +5 | 0 replies | |
| 6/33 | dmaengine: fsldma: migrate tasklet to dmaengine BHdrivers/ drivers/ | +6 | 0 replies | |
| 7/33 | dmaengine: fsl_raid: run completions via dmaengine BHdrivers/ drivers/ | +6 | 0 replies | |
| 8/33 | dmaengine: imx-dma: flip per-chan tasklet to dmaengine BHdrivers/ | +13 | 0 replies | |
| 9/33 | dmaengine: ioat: convert cleanup tasklet to dmaengine BHdrivers/ drivers/ drivers/ | +9 | 0 replies | |
| 10/33 | dmaengine: mmp_pdma: replace per-chan tasklet with dmaengine BHdrivers/ | +5 | 0 replies | |
| 11/33 | dmaengine: mmp_tdma: hook completions to dmaengine BHdrivers/ | +4 | 0 replies | |
| 12/33 | dmaengine: mv_xor: convert irq tasklet to dmaengine BHdrivers/ drivers/ | +7 | 0 replies | |
| 13/33 | dmaengine: mxs-dma: use dmaengine BH schedulingdrivers/ | +5 | 0 replies | |
| 14/33 | dmaengine: nbpfaxi: switch callbacks to dmaengine BHdrivers/ | +6 | 0 replies | |
| 15/33 | dmaengine: pch_dma: convert tasklet to dmaengine BHdrivers/ | +7 | 0 replies | |
| 16/33 | dmaengine: ppc4xx: replace irq tasklet with dmaengine BHdrivers/ drivers/ | +7 | 0 replies | |
| 17/33 | dmaengine: ste_dma40: convert per-channel tasklet to dmaengine BHdrivers/ | +13 | 0 replies | |
| 18/33 | dmaengine: xgene-dma: wire descriptor cleanup to dmaengine BHdrivers/ | +9 | 0 replies | |
| 19/33 | dmaengine: xilinx-dma: use dmaengine BH instead of taskletsdrivers/ | +9 | 0 replies | |
| 20/33 | dmaengine: xilinx-dpdma: kill vchan BH on removedrivers/ | +1 | 0 replies | |
| 21/33 | dmaengine: zynqmp-dma: switch completion tasklet to dmaengine BHdrivers/ | +9 | 0 replies | |
| 22/33 | dmaengine: tegra20-apb: use channel BH helpersdrivers/ | +9 | 0 replies | |
| 23/33 | dmaengine: timb_dma: route callbacks via channel BHdrivers/ | +36 | 0 replies | |
| 24/33 | dmaengine: txx9dmac: route callbacks via channel BHdrivers/ drivers/ | +5 | 0 replies | |
| 25/33 | dmaengine: mv_xor_v2: use channel BH helpersdrivers/ | +9 | 0 replies | |
| 26/33 | dmaengine: mpc512x: route callbacks via channel BHdrivers/ | +51 | 0 replies | |
| 27/33 | dmaengine: plx_dma: use channel BH helpersdrivers/ | +6 | 0 replies | |
| 28/33 | dmaengine: sf-pdma: route error callbacks through channel BHdrivers/ | +15 | 0 replies | |
| 29/33 | dmaengine: pl330: route callbacks via channel BHdrivers/ | +8 | 0 replies | |
| 30/33 | dmaengine: altera-msgdma: use channel BH helpersdrivers/ | +7 | 1 reply | |
| 31/33 | dmaengine: hidma: defer callbacks via channel BHdrivers/ | +23 | 0 replies | |
| 32/33 | dmaengine: qcom-gpi: defer callbacks via vchandrivers/ | +23 | 0 replies | |
| 33/33 | dmaengine: switchtec: use channel BH helpersdrivers/ | +8 | 0 replies |
Reviews trailers per patch
23 of 33 patches have a Reviewed-by or Acked-by.
| Patch | Frank Li | Dave Jiang | Linus Walleij | Logan Gunthorpe | Adrian Ng Ho Yin |
|---|---|---|---|---|---|
| 1/33 | R-b | ||||
| 2/33 | R-b | ||||
| 3/33 | R-b | ||||
| 4/33 | R-b | ||||
| 5/33 | R-b | ||||
| 6/33 | R-b | ||||
| 7/33 | |||||
| 8/33 | R-b | ||||
| 9/33 | R-b | A-b | |||
| 10/33 | R-b | ||||
| 11/33 | R-b | ||||
| 12/33 | R-b | ||||
| 13/33 | R-b | ||||
| 14/33 | |||||
| 15/33 | R-b | ||||
| 16/33 | R-b | ||||
| 17/33 | R-b | R-b | |||
| 18/33 | R-b | ||||
| 19/33 | R-b | ||||
| 20/33 | R-b | ||||
| 21/33 | R-b | ||||
| 22/33 | |||||
| 23/33 | |||||
| 24/33 | |||||
| 25/33 | R-b | ||||
| 26/33 | |||||
| 27/33 | R-b | R-b | |||
| 28/33 | |||||
| 29/33 | |||||
| 30/33 | R-b | A-b | |||
| 31/33 | |||||
| 32/33 | |||||
| 33/33 | R-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.
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