All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dmaengine: idxd: fix retry value to be constant for duration of function call
@ 2022-04-18 21:33 Dave Jiang
  2022-04-20 10:34 ` Vinod Koul
  0 siblings, 1 reply; 2+ messages in thread
From: Dave Jiang @ 2022-04-18 21:33 UTC (permalink / raw)
  To: vkoul; +Cc: Dave Hansen, dmaengine

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: 7930d8553575 ("dmaengine: idxd: add knob for enqcmds retries")
Suggested-by: Dave Hansen <dave.hansen@intel.com>
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
---
 drivers/dma/idxd/submit.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/idxd/submit.c b/drivers/dma/idxd/submit.c
index 554b0602d2e9..c01db23e3333 100644
--- a/drivers/dma/idxd/submit.c
+++ b/drivers/dma/idxd/submit.c
@@ -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)
 {
-	unsigned int retries = 0;
+	unsigned int retries = wq->enqcmds_retries;
 	int rc;
 
 	do {
@@ -158,7 +158,7 @@ int idxd_enqcmds(struct idxd_wq *wq, void __iomem *portal, const void *desc)
 		if (rc == 0)
 			break;
 		cpu_relax();
-	} while (retries++ < wq->enqcmds_retries);
+	} while (retries--);
 
 	return rc;
 }



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] dmaengine: idxd: fix retry value to be constant for duration of function call
  2022-04-18 21:33 [PATCH] dmaengine: idxd: fix retry value to be constant for duration of function call Dave Jiang
@ 2022-04-20 10:34 ` Vinod Koul
  0 siblings, 0 replies; 2+ messages in thread
From: Vinod Koul @ 2022-04-20 10:34 UTC (permalink / raw)
  To: Dave Jiang; +Cc: Dave Hansen, dmaengine

On 18-04-22, 14:33, Dave Jiang wrote:
> 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.

Applied, thanks

-- 
~Vinod

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-04-20 10:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-18 21:33 [PATCH] dmaengine: idxd: fix retry value to be constant for duration of function call Dave Jiang
2022-04-20 10:34 ` Vinod Koul

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.