]> git.baikalelectronics.ru Git - kernel.git/commit
dmaengine: dmatest: Fix process hang when reading 'wait' parameter
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Tue, 28 Apr 2020 11:35:18 +0000 (14:35 +0300)
committerVinod Koul <vkoul@kernel.org>
Tue, 28 Apr 2020 16:16:35 +0000 (21:46 +0530)
commit4b8d25d007bdd5c476cb11fe1791e7201ced552c
tree23f02b3989a1f87039c88f09285a2ba52c0854e4
parent3597eed1c0188418d754e66c1eef0981c9a8b180
dmaengine: dmatest: Fix process hang when reading 'wait' parameter

If we do

  % echo 1 > /sys/module/dmatest/parameters/run
  [  115.851124] dmatest: Could not start test, no channels configured

  % echo dma8chan7 > /sys/module/dmatest/parameters/channel
  [  127.563872] dmatest: Added 1 threads using dma8chan7

  % cat /sys/module/dmatest/parameters/wait
  ... !!! HANG !!! ...

The culprit is the commit 176f2f842f4c

  ("dmaengine: dmatest: Use fixed point div to calculate iops")

which makes threads not to run, but pending and being kicked off by writing
to the 'run' node. However, it forgot to consider 'wait' routine to avoid
above mentioned case.

In order to fix this, check for really running threads, i.e. with pending
and done flags unset.

It's pity the culprit commit hadn't updated documentation and tested all
possible scenarios.

Fixes: 176f2f842f4c ("dmaengine: dmatest: Use fixed point div to calculate iops")
Cc: Seraj Alijan <seraj.alijan@sondrel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20200428113518.70620-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/dma/dmatest.c