DMA Engine development
 help / color / mirror / Atom feed
* [PATCH] dmaengine: dmatest: make wait parameter reads interruptible
@ 2026-10-18 17:56 Karl Mehltretter
  2026-10-19 21:01 ` Frank Li
  0 siblings, 1 reply; 2+ messages in thread
From: Karl Mehltretter @ 2026-10-18 17:56 UTC (permalink / raw)
  To: Vinod Koul, dmaengine
  Cc: Karl Mehltretter, Frank Li, Dan Williams, linux-kernel

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@gmail.com>
---
 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)


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] dmaengine: dmatest: make wait parameter reads interruptible
  2026-10-18 17:56 [PATCH] dmaengine: dmatest: make wait parameter reads interruptible Karl Mehltretter
@ 2026-10-19 21:01 ` Frank Li
  0 siblings, 0 replies; 2+ messages in thread
From: Frank Li @ 2026-10-19 21:01 UTC (permalink / raw)
  To: Karl Mehltretter
  Cc: Vinod Koul, dmaengine, Frank Li, Dan Williams, linux-kernel

On Sun, Oct 18, 2026 at 07:56:06PM +0200, Karl Mehltretter wrote:
> 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@gmail.com>
> ---

Reviewed-by: Frank Li <Frank.Li@nxp.com>

>  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)
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-19 21:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-18 17:56 [PATCH] dmaengine: dmatest: make wait parameter reads interruptible Karl Mehltretter
2026-10-19 21:01 ` Frank Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox