summaryrefslogtreecommitdiffstats
path: root/drivers/dma
diff options
context:
space:
mode:
authorDave Jiang <dave.jiang@intel.com>2022-06-28 16:00:56 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-07-12 16:35:19 +0200
commita5fe76328ea53d38c4f86aef52eb3af5bac9ab63 (patch)
tree6531fa2437937e0bcce88f40abd7c78a4946cf0f /drivers/dma
parent568b2bd79b59f3c376bec40d7e93fb22c9d8a65f (diff)
downloadlinux-stable-a5fe76328ea53d38c4f86aef52eb3af5bac9ab63.tar.gz
linux-stable-a5fe76328ea53d38c4f86aef52eb3af5bac9ab63.tar.bz2
linux-stable-a5fe76328ea53d38c4f86aef52eb3af5bac9ab63.zip
dmaengine: idxd: force wq context cleanup on device disable path
commit 44c4237cf3436bda2b185ff728123651ad133f69 upstream. 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. Reported-by: Tony Zhu <tony.zhu@intel.com> Tested-by: Tony Zhu <tony.zhu@intel.com> Fixes: 0dcfe41e9a4c ("dmanegine: idxd: cleanup all device related bits after disabling device") Signed-off-by: Dave Jiang <dave.jiang@intel.com> Co-developed-by: Fenghua Yu <fenghua.yu@intel.com> Signed-off-by: Fenghua Yu <fenghua.yu@intel.com> Link: https://lore.kernel.org/r/20220628230056.2527816-1-fenghua.yu@intel.com Signed-off-by: Vinod Koul <vkoul@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/dma')
-rw-r--r--drivers/dma/idxd/device.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/dma/idxd/device.c b/drivers/dma/idxd/device.c
index e622245c9380..11d3f2aede71 100644
--- a/drivers/dma/idxd/device.c
+++ b/drivers/dma/idxd/device.c
@@ -720,10 +720,7 @@ static void idxd_device_wqs_clear_state(struct idxd_device *idxd)
for (i = 0; i < idxd->max_wqs; i++) {
struct idxd_wq *wq = idxd->wqs[i];
- 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);
}
}