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

dmaengine: idxd: fix retry value to be constant for duration of function call

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

Intel-SIG: commit bc3452cd dmaengine: idxd: fix retry value to be constant for duration of function call.
Incremental backporting patches for DSA/IAA on Intel Xeon platform.

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

When retries is compared to wq->enqcmds_retries each loop of idxd_enqcmds(),
wq->enqcmds_retries can potentially changed by user. Assign the value
of retries to wq->enqcmds_retries during initialization so it is the
original value set when entering the function.

Fixes: 7930d855 ("dmaengine: idxd: add knob for enqcmds retries")
Suggested-by: NDave Hansen <dave.hansen@intel.com>
Signed-off-by: NDave Jiang <dave.jiang@intel.com>
Link: https://lore.kernel.org/r/165031760154.3658664.1983547716619266558.stgit@djiang5-desk3.ch.intel.comSigned-off-by: NVinod Koul <vkoul@kernel.org>
Signed-off-by: NXiaochen Shen <xiaochen.shen@intel.com>
上级 26bfdd92
...@@ -150,7 +150,7 @@ static void llist_abort_desc(struct idxd_wq *wq, struct idxd_irq_entry *ie, ...@@ -150,7 +150,7 @@ static void llist_abort_desc(struct idxd_wq *wq, struct idxd_irq_entry *ie,
*/ */
int idxd_enqcmds(struct idxd_wq *wq, void __iomem *portal, const void *desc) int idxd_enqcmds(struct idxd_wq *wq, void __iomem *portal, const void *desc)
{ {
unsigned int retries = 0; unsigned int retries = wq->enqcmds_retries;
int rc; int rc;
do { do {
...@@ -158,7 +158,7 @@ int idxd_enqcmds(struct idxd_wq *wq, void __iomem *portal, const void *desc) ...@@ -158,7 +158,7 @@ int idxd_enqcmds(struct idxd_wq *wq, void __iomem *portal, const void *desc)
if (rc == 0) if (rc == 0)
break; break;
cpu_relax(); cpu_relax();
} while (retries++ < wq->enqcmds_retries); } while (retries--);
return rc; return rc;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册