From: claudiu beznea <claudiu.beznea@tuxon.dev>
To: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>,
Vinod Koul <vkoul@kernel.org>, Frank Li <Frank.Li@kernel.org>,
Seraj Alijan <seraj.alijan@sondrel.com>
Cc: dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] dmaengine: dmatest: fix race between wait for thread and thread start
Date: Mon, 12 Oct 2026 13:12:56 +0300 [thread overview]
Message-ID: <3ff66de9-4b90-4fac-bd67-7b21aef9aae0@tuxon.dev> (raw)
In-Reply-To: <20260828151024.2081478-1-cosmin-gabriel.tanislav.xa@renesas.com>
On 8/28/26 18:10, Cosmin Tanislav wrote:
> Each dmatest worker thread has a pending and a done flag which describe
> the thread's lifecycle.
>
> pending is initialized to true when the thread is added to the threads
> list. pending is set to false once the thread is actually running. done
> is set to true once the thread has finished its testing.
>
> When the wait module parameter is set to true, dmatest_init() waits for
> the !is_threaded_test_run() condition to become true.
>
> If the worker thread is not started and running by the time
> dmatest_init() waits, the !is_threaded_test_run() condition will be true
> and the wait will stop early, before the worker thread is even started.
> dmatest_init() exits, defeating the whole purpose of the wait.
>
> If then we try to remove the module, kthread_stop() will try to cleanup
> the worker threads, interrupting wait_event_freezable_timeout(), which
> will return -ERESTARTSYS, causing the "test timed out" message to be
> printed.
>
> Clear the pending flag once we wake up the worker thread to avoid this
> race.
>
> Fixes: d53513d5dc28 ("dmaengine: dmatest: Add support for multi channel testing")
> Signed-off-by: Cosmin Tanislav<cosmin-gabriel.tanislav.xa@renesas.com>
I've tested this on RZ/Five and RZ/V2L, on top of next-20261002. There are no
more "test timed out" reported.
Tested-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
next prev parent reply other threads:[~2026-10-12 10:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-28 15:10 Cosmin Tanislav
2026-10-12 10:12 ` claudiu beznea [this message]
2026-10-12 14:56 ` 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=3ff66de9-4b90-4fac-bd67-7b21aef9aae0@tuxon.dev \
--to=claudiu.beznea@tuxon.dev \
--cc=Frank.Li@kernel.org \
--cc=cosmin-gabriel.tanislav.xa@renesas.com \
--cc=dmaengine@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=seraj.alijan@sondrel.com \
--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®