dmaengine: idxd: force wq context cleanup on device disable path
Subsystems (2)
PATCH v2 1/1 dmaengine: idxd: force wq context cleanup on device disable path
From: Dave Jiang <[email protected]>
Testing shown that when a wq mode is setup to be dedicated and then torn down and reconfigured to shared, the wq configured end up being dedicated anyays. The root cause is when idxd_device_wqs_clear_state() gets called during idxd_driver removal, idxd_wq_disable_cleanup() does not get called vs when the wq driver is removed first. The check of wq state being "enabled" causes the cleanup to be bypassed. However, idxd_driver->remove() releases all wq drivers. So the wqs goes to "disabled" state and will never be "enabled". By that point, the driver has no idea if the wq was previously configured or clean. So force call idxd_wq_disable_cleanup() on all wqs always to make sure everything gets cleaned up.
---
Change Log:
v2:
- Re-based to 5.19-rc2 so that it can be applied cleanly. No functionality change.
drivers/dma/idxd/device.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/dma/idxd/device.c +1 -4
@@ -716,10 +716,7 @@ static void idxd_device_wqs_clear_state(struct idxd_device *idxd)struct idxd_wq *wq = idxd->wqs[i];mutex_lock (&wq->wq_lock); -if (wq->state ==IDXD_WQ_ENABLED ) { -idxd_wq_disable_cleanup (wq); - wq->state =IDXD_WQ_DISABLED ; - } +idxd_wq_disable_cleanup (wq);idxd_wq_device_reset_cleanup (wq);mutex_unlock (&wq->wq_lock); }
Signature · 1 line
2.32.0
Quoted 13 lines · Fenghua Yu
From: Dave Jiang <[email protected]>
Testing shown that when a wq mode is setup to be dedicated and then torn down and reconfigured to shared, the wq configured end up being dedicated anyays. The root cause is when
idxd_device_wqs_clear_state()gets called duringidxd_driverremoval,idxd_wq_disable_cleanup()does not get called vs when the wq driver is removed first. The check of wq state being "enabled" causes the cleanup to be bypassed. However,idxd_driver->remove()releases all wq drivers. So the wqs goes to "disabled" state and will never be "enabled". By that point, the driver has no idea if the wq was previously configured or clean. So force callidxd_wq_disable_cleanup()on all wqs always to make sure everything gets cleaned up.
Quoted 4 lines
Reported-by Tony Zhu <[email protected]>Tested-by Tony Zhu <[email protected]>Fixes 0dcfe41e9a4c ("dmanegine: idxd: cleanup all device related bits after disabling device")Signed-off-by Dave Jiang <[email protected]>
Quoted 31 lines
---
Change Log:
v2:
- Re-based to 5.19-rc2 so that it can be applied cleanly. No functionality change.drivers/dma/idxd/device.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)drivers/dma/idxd/device.c +1
-4@@ -716,10 +716,7 @@ static void idxd_device_wqs_clear_state(struct idxd_device *idxd)struct idxd_wq *wq = idxd->wqs[i];mutex_lock (&wq->wq_lock); -if (wq->state ==IDXD_WQ_ENABLED ) { -idxd_wq_disable_cleanup (wq); - wq->state =IDXD_WQ_DISABLED ; - } +idxd_wq_disable_cleanup (wq);idxd_wq_device_reset_cleanup (wq);mutex_unlock (&wq->wq_lock); }Signature · 1 line
2.32.0
Vinod Koul
maintainerQuoted 14 lines · Fenghua Yu
Quoted 13 lines · Fenghua Yu
From: Dave Jiang <[email protected]>
Testing shown that when a wq mode is setup to be dedicated and then torn down and reconfigured to shared, the wq configured end up being dedicated anyays. The root cause is when
idxd_device_wqs_clear_state()gets called duringidxd_driverremoval,idxd_wq_disable_cleanup()does not get called vs when the wq driver is removed first. The check of wq state being "enabled" causes the cleanup to be bypassed. However,idxd_driver->remove()releases all wq drivers. So the wqs goes to "disabled" state and will never be "enabled". By that point, the driver has no idea if the wq was previously configured or clean. So force callidxd_wq_disable_cleanup()on all wqs always to make sure everything gets cleaned up.
Quoted 6 lines
Quoted 4 lines
Reported-by Tony Zhu <[email protected]>Tested-by Tony Zhu <[email protected]>Fixes 0dcfe41e9a4c ("dmanegine: idxd: cleanup all device related bits after disabling device")Signed-off-by Dave Jiang <[email protected]>Signed-off-by Fenghua Yu <[email protected]>
Pls send updated patchset
Quoted 32 lines
Quoted 32 lines
---
Change Log:
v2:
- Re-based to 5.19-rc2 so that it can be applied cleanly. No functionality change.drivers/dma/idxd/device.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)drivers/dma/idxd/device.c +1
-4@@ -716,10 +716,7 @@ static void idxd_device_wqs_clear_state(struct idxd_device *idxd)struct idxd_wq *wq = idxd->wqs[i];mutex_lock (&wq->wq_lock); -if (wq->state ==IDXD_WQ_ENABLED ) { -idxd_wq_disable_cleanup (wq); - wq->state =IDXD_WQ_DISABLED ; - } +idxd_wq_disable_cleanup (wq);idxd_wq_device_reset_cleanup (wq);mutex_unlock (&wq->wq_lock); }Signature · 1 line
2.32.0
Signature · 1 line
~Vinod