From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: tglx@kernel.org, mingo@redhat.com, peterz@infradead.org
Cc: linux-kernel@vger.kernel.org, dvhart@infradead.org,
dave@stgolabs.net, andrealmeid@igalia.com, shuah@kernel.org,
linux-kselftest@vger.kernel.org
Subject: Re: [PATCH] selftests/futex: Retry the wake in futex_wait instead of sleeping
Date: Sun, 8 Nov 2026 09:34:42 -0500 [thread overview]
Message-ID: <7636700d-1aed-4e6f-adc6-720b1aa98501@efficios.com> (raw)
In-Reply-To: <20261108142309.1527337-1-mathieu.desnoyers@efficios.com>
On 2026-11-08 09:23, Mathieu Desnoyers wrote:
> Each futex_wait test starts a waiter thread, which calls futex_wait()
> with a 30ms timeout. The main thread sleeps 10ms, then expects
> futex_wake() to wake one waiter. So the test assumes that the waiter
> reaches futex_wait() within 10ms, and that the main thread runs again
> within 30ms.
>
> A busy machine breaks both. The built-in locktorture at times holds a
> spinlock for 100ms with preemption off. With it, private_futex failed in
> about 0.5% of the runs in 8-CPU VMs, on v7.4-rc1.
> Timestamps showed two cases. The waiter started up to 75ms late, after
> the wake. Or the main thread woke up to 105ms late, after the waiter
> had timed out.
>
> Fix this by retrying futex_wake() every millisecond until it wakes the
> waiter, for up to 5s. Give the waiter a timeout of 10s, so that it
> outlasts the retries. The tests then wait for the waiter, instead of
> assuming when it runs.
>
> With this patch, private_futex passed 6000 runs of 6000 in the same VMs,
> and the three tests 2000 runs of 2000.
Self-nack. That's flaky as well. A bounded retry can still fail. This
needs a proper synchronization flag. Will respin a v2.
Thanks,
Mathieu
--
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com
prev parent reply other threads:[~2026-11-08 14:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-08 14:23 Mathieu Desnoyers
2026-11-08 14:34 ` Mathieu Desnoyers [this message]
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=7636700d-1aed-4e6f-adc6-720b1aa98501@efficios.com \
--to=mathieu.desnoyers@efficios.com \
--cc=andrealmeid@igalia.com \
--cc=dave@stgolabs.net \
--cc=dvhart@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=shuah@kernel.org \
--cc=tglx@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®