Skip to content

Commit b9f9602

Browse files
andy-shevvinodkoul
authored andcommitted
dmaengine: dmatest: Fix iteration non-stop logic
Under some circumstances, i.e. when test is still running and about to time out and user runs, for example, grep -H . /sys/module/dmatest/parameters/* the iterations parameter is not respected and test is going on and on until user gives echo 0 > /sys/module/dmatest/parameters/run This is not what expected. The history of this bug is interesting. I though that the commit 2d88ce7 ("dmatest: add a 'wait' parameter") is a culprit, but looking closer to the code I think it simple revealed the broken logic from the day one, i.e. in the commit 0a2ff57 ("dmaengine: dmatest: add a maximum number of test iterations") which adds iterations parameter. So, to the point, the conditional of checking the thread to be stopped being first part of conjunction logic prevents to check iterations. Thus, we have to always check both conditions to be able to stop after given iterations. Since it wasn't visible before second commit appeared, I add a respective Fixes tag. Fixes: 2d88ce7 ("dmatest: add a 'wait' parameter") Cc: Dan Williams <[email protected]> Cc: Nicolas Ferre <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]> Acked-by: Nicolas Ferre <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent 664475c commit b9f9602

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/dma/dmatest.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -662,8 +662,8 @@ static int dmatest_func(void *data)
662662
flags = DMA_CTRL_ACK | DMA_PREP_INTERRUPT;
663663

664664
ktime = ktime_get();
665-
while (!kthread_should_stop()
666-
&& !(params->iterations && total_tests >= params->iterations)) {
665+
while (!(kthread_should_stop() ||
666+
(params->iterations && total_tests >= params->iterations))) {
667667
struct dma_async_tx_descriptor *tx = NULL;
668668
struct dmaengine_unmap_data *um;
669669
dma_addr_t *dsts;

0 commit comments

Comments
 (0)