Message ID | 20220628230056.2527816-1-fenghua.yu@intel.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 44c4237cf3436bda2b185ff728123651ad133f69 |
Headers | show |
Series | [v3] dmaengine: idxd: force wq context cleanup on device disable path | expand |
On 28-06-22, 16:00, Fenghua Yu wrote: > From: Dave Jiang <dave.jiang@intel.com> > > 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. Applied, thanks
diff --git a/drivers/dma/idxd/device.c b/drivers/dma/idxd/device.c index ff0ea60051f0..5a8cc52c1abf 100644 --- a/drivers/dma/idxd/device.c +++ b/drivers/dma/idxd/device.c @@ -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); }