]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
dmaengine: dmatest: Fix iteration non-stop logic
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Fri, 24 Apr 2020 16:11:42 +0000 (19:11 +0300)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Mon, 25 May 2020 08:42:26 +0000 (10:42 +0200)
commitebe29b7712091b46d1d5aedea8a7abc16b5b8316
treed93dbdfff0b33160be49ce0e144469eda436e458
parenta69438c186921725d3db9a4dc6f8764ac4008eda
dmaengine: dmatest: Fix iteration non-stop logic

BugLink: https://bugs.launchpad.net/bugs/1877592
commit b9f960201249f20deea586b4ec814669b4c6b1c0 upstream.

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
  2d88ce76eb98 ("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
  0a2ff57d6fba ("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: 2d88ce76eb98 ("dmatest: add a 'wait' parameter")
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Link: https://lore.kernel.org/r/20200424161147.16895-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/dma/dmatest.c