Skip to contentSkip to conversation

dmaengine: Add missing cleanup on module unload

PATCH In review Guenter Roeck 2 participants 2 messages Oct 20, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dmaengine: Add missing cleanup on module unload

Upstream commit b7cb9a034305 ("dmaengine: idxd: Fix refcount underflow on module unload") fixes a refcount underflow by replacing the call to idxd_cleanup() in the remove function with direct cleanup calls. That works fine upstream. However, upstream removed support for IOMMU_DEV_FEAT_IOPF, which is still supported in v6.12.y. The backport of commit b7cb9a034305 into v6.12.y misses the call to disable it. This results in a warning backtrace when unloading and reloading the module.

WARNING: CPU: 0 PID: 665849 at drivers/pci/ats.c:337 pci_reset_pri+0x4c/0x60
...
RIP: 0010:pci_reset_pri+0xa7/0x130

Add the missing cleanup call to fix the problem.

Fixes ce81905bec91 ("dmaengine: idxd: Fix refcount underflow on module unload")
Cc Yi Sun <[email protected]>
Cc Shuai Xue <[email protected]>
Cc Dave Jiang <[email protected]>
Cc Vinicius Costa Gomes <[email protected]>
Cc Vinod Koul <[email protected]>

---
The problem fixed with this patch only affects v6.12.y.

 drivers/dma/idxd/init.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/dma/idxd/init.c +2 -0
index 74a83203181d..e55136bb525e 100644
@@ -923,6 +923,8 @@ static void idxd_remove(struct pci_dev *pdev)
 	idxd_cleanup_interrupts(idxd);
 	if (device_pasid_enabled(idxd))
 		idxd_disable_system_pasid(idxd);
+	if (device_user_pasid_enabled(idxd))
+		idxd_disable_sva(idxd->pdev);
 	pci_iounmap(pdev, idxd->reg_base);
 	put_device(idxd_confdev(idxd));
 	pci_disable_device(pdev);
Signature · 1 line
2.45.2
Acked-by on v1 1/1
#1 lore raw
Quoted 21 lines · Guenter Roeck

Upstream commit b7cb9a034305 ("dmaengine: idxd: Fix refcount underflow on module unload") fixes a refcount underflow by replacing the call to idxd_cleanup() in the remove function with direct cleanup calls. That works fine upstream. However, upstream removed support for IOMMU_DEV_FEAT_IOPF, which is still supported in v6.12.y. The backport of commit b7cb9a034305 into v6.12.y misses the call to disable it. This results in a warning backtrace when unloading and reloading the module.

WARNING: CPU: 0 PID: 665849 at drivers/pci/ats.c:337 pci_reset_pri+0x4c/0x60
...
RIP: 0010:pci_reset_pri+0xa7/0x130

Add the missing cleanup call to fix the problem.

Fixes ce81905bec91 ("dmaengine: idxd: Fix refcount underflow on module unload")
Cc Yi Sun <[email protected]>
Cc Shuai Xue <[email protected]>
Cc Dave Jiang <[email protected]>
Cc Vinicius Costa Gomes <[email protected]>
Cc Vinod Koul <[email protected]>
Quoted 3 lines

---
The problem fixed with this patch only affects v6.12.y.

Cheers,

Signature · 1 line
Vinicius