mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Karl Mehltretter <kmehltretter@gmail.com>
To: Vinod Koul <vkoul@kernel.org>, dmaengine@vger.kernel.org
Cc: Karl Mehltretter <kmehltretter@gmail.com>,
	Frank Li <Frank.Li@kernel.org>, Dan Williams <djbw@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: [PATCH] dmaengine: dmatest: make wait parameter reads interruptible
Date: Sun, 18 Oct 2026 19:56:06 +0200	[thread overview]
Message-ID: <20261018175606.38045-1-kmehltretter@gmail.com> (raw)

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)


             reply	other threads:[~2026-10-18 17:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-18 17:56 Karl Mehltretter [this message]
2026-10-19 21:01 ` Frank Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261018175606.38045-1-kmehltretter@gmail.com \
    --to=kmehltretter@gmail.com \
    --cc=Frank.Li@kernel.org \
    --cc=djbw@kernel.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®