* [PATCH v2] dmaengine: dmatest: Fix process hang when reading 'wait' parameter
@ 2020-04-28 11:35 Andy Shevchenko
2020-04-28 16:17 ` Vinod Koul
0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2020-04-28 11:35 UTC (permalink / raw)
To: Dan Williams, Vinod Koul, dmaengine; +Cc: Andy Shevchenko, Seraj Alijan
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 6138f967bccc
("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: 6138f967bccc ("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>
---
v2: Drop unrelated hunk (Vinod)
drivers/dma/dmatest.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c
index 659d6daa2db9a..c1ebc538404d2 100644
--- a/drivers/dma/dmatest.c
+++ b/drivers/dma/dmatest.c
@@ -248,7 +248,7 @@ static bool is_threaded_test_run(struct dmatest_info *info)
struct dmatest_thread *thread;
list_for_each_entry(thread, &dtc->threads, node) {
- if (!thread->done)
+ if (!thread->done && !thread->pending)
return true;
}
}
--
2.26.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] dmaengine: dmatest: Fix process hang when reading 'wait' parameter
2020-04-28 11:35 [PATCH v2] dmaengine: dmatest: Fix process hang when reading 'wait' parameter Andy Shevchenko
@ 2020-04-28 16:17 ` Vinod Koul
0 siblings, 0 replies; 2+ messages in thread
From: Vinod Koul @ 2020-04-28 16:17 UTC (permalink / raw)
To: Andy Shevchenko; +Cc: Dan Williams, dmaengine, Seraj Alijan
On 28-04-20, 14:35, Andy Shevchenko wrote:
> 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 6138f967bccc
>
> ("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.
Applied, thanks
--
~Vinod
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-04-28 16:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-28 11:35 [PATCH v2] dmaengine: dmatest: Fix process hang when reading 'wait' parameter Andy Shevchenko
2020-04-28 16:17 ` Vinod Koul
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox