提交 eff323a8 编写于 作者: D Dave Jiang 提交者: Xiaochen Shen

dmaengine: idxd: force wq context cleanup on device disable path

mainline inclusion
from mainline-v5.19
commit 44c4237c
category: bugfix
bugzilla: https://gitee.com/openeuler/intel-kernel/issues/I596WO
CVE: NA

Intel-SIG: commit 44c4237c dmaengine: idxd: force wq context cleanup on device disable path.
Incremental backporting patches for DSA/IAA on Intel Xeon platform.

--------------------------------

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: NTony Zhu <tony.zhu@intel.com>
Tested-by: NTony Zhu <tony.zhu@intel.com>
Fixes: 0dcfe41e ("dmanegine: idxd: cleanup all device related bits after disabling device")
Signed-off-by: NDave Jiang <dave.jiang@intel.com>
Co-developed-by: NFenghua Yu <fenghua.yu@intel.com>
Signed-off-by: NFenghua Yu <fenghua.yu@intel.com>
Link: https://lore.kernel.org/r/20220628230056.2527816-1-fenghua.yu@intel.comSigned-off-by: NVinod Koul <vkoul@kernel.org>
Signed-off-by: NXiaochen Shen <xiaochen.shen@intel.com>
上级 e3bfb96e
......@@ -715,13 +715,10 @@ 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) {
mutex_lock(&wq->wq_lock);
idxd_wq_disable_cleanup(wq);
wq->state = IDXD_WQ_DISABLED;
mutex_unlock(&wq->wq_lock);
}
mutex_lock(&wq->wq_lock);
idxd_wq_disable_cleanup(wq);
idxd_wq_device_reset_cleanup(wq);
mutex_unlock(&wq->wq_lock);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册