[PATCH] dmaengine: dmatest: make wait parameter reads interruptible

From: Karl Mehltretter

Date: Sun Oct 18 2026 - 13:56:57 EST


Reading the wait parameter during a finite test uses wait_event(). The
reader remains in uninterruptible sleep until all test threads finish.
Long runs trigger the hung-task detector, and signals cannot stop the
reader:

INFO: task cat:71690 blocked for more than 120 seconds.
Call trace:
dmatest_wait_get+0x17c/0x1d8 [dmatest]
param_attr_show+0x6c/0xb0

Use wait_event_interruptible() and propagate the signal error so Ctrl-C
and timeout can abort the sysfs read. The test threads continue
independently.

On a Raspberry Pi 500+ RP1 DMA channel, a script configured dmatest with
1 MiB buffers and two threads of 2,000 iterations each. The unpatched
run completed all 4,000 tests without failures in 267 seconds, but
emitted hung-task reports at 120 and 241 seconds.

With the patch, the same 4,000 tests completed without failures in 269
seconds and emitted no hung-task report. In a separate patched run,
SIGTERM terminated the reader. Both test threads continued and completed
all 200 tests without failures.

Fixes: 2d88ce76eb98 ("dmatest: add a 'wait' parameter")
Assisted-by: LLM
Signed-off-by: Karl Mehltretter <kmehltretter@xxxxxxxxx>
---
drivers/dma/dmatest.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c
index 2ae346939..7e6b6c446 100644
--- a/drivers/dma/dmatest.c
+++ b/drivers/dma/dmatest.c
@@ -287,9 +287,14 @@ static int dmatest_wait_get(char *val, const struct kernel_param *kp)
{
struct dmatest_info *info = &test_info;
struct dmatest_params *params = &info->params;
+ int ret;

- if (params->iterations)
- wait_event(thread_wait, !is_threaded_test_run(info));
+ if (params->iterations) {
+ ret = wait_event_interruptible(thread_wait,
+ !is_threaded_test_run(info));
+ if (ret)
+ return ret;
+ }
wait = true;
return param_get_bool(val, kp);
}
--
2.39.5 (Apple Git-154)