Skip to content

Commit bc3452c

Browse files
davejiangvinodkoul
authored andcommitted
dmaengine: idxd: fix retry value to be constant for duration of function call
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: 7930d85 ("dmaengine: idxd: add knob for enqcmds retries") Suggested-by: Dave Hansen <dave.hansen@intel.com> Signed-off-by: Dave Jiang <dave.jiang@intel.com> Link: https://lore.kernel.org/r/165031760154.3658664.1983547716619266558.stgit@djiang5-desk3.ch.intel.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
1 parent 5d9d16e commit bc3452c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/dma/idxd/submit.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,15 +150,15 @@ static void llist_abort_desc(struct idxd_wq *wq, struct idxd_irq_entry *ie,
150150
*/
151151
int idxd_enqcmds(struct idxd_wq *wq, void __iomem *portal, const void *desc)
152152
{
153-
unsigned int retries = 0;
153+
unsigned int retries = wq->enqcmds_retries;
154154
int rc;
155155

156156
do {
157157
rc = enqcmds(portal, desc);
158158
if (rc == 0)
159159
break;
160160
cpu_relax();
161-
} while (retries++ < wq->enqcmds_retries);
161+
} while (retries--);
162162

163163
return rc;
164164
}

0 commit comments

Comments
 (0)