Re: [PATCH 4/4] test-ww_mutex: Retry lock acquisition after timeout if deadlocked

From: Haakon Bugge

Date: Thu Jul 09 2026 - 13:02:09 EST




> On 8 Jul 2026, at 22:01, John Stultz <jstultz@xxxxxxxxxx> wrote:
>
> On Mon, Jun 22, 2026 at 6:48 AM Haakon Bugge <haakon.bugge@xxxxxxxxxx> wrote:

[snip]

>> <quote>
>> It is worth mentioning that the last patch retries up to 10,000 lock
>> acquisitions after timeout. This value was determined empirically: 10
>> and 100 retries were insufficient on the test systems, while 10,000
>> provided stable results and avoided false negatives.
>> </quote>
>>
>> Shall I add that to the commit message?
>
> That would be great.
>
>>> If the deadlock resolution takes
>>> longer then we expect in time,
>>
>> That is not the case. When we terminate due to timeout, we have no
>> resolution of the deadlock. I view it as there is a probability we run
>> into deadlock, let's say 10%, for each iteration. Now, if we terminate
>> due to timeout - and - we are unlucky and the last iteration
>> deadlocked, we cannot just return -EDEADLK, as that will mark the test
>> as failed. Instead, we retry some more iterations in order to resolve
>> the deadlock.
>
> But with the retry count needing to be set to 10,000 it seems like
> more then just being unlucky on the last iteration, no?

Good observation. Very unlucky may be?

> I'm still a bit wary on this change, but I am very eager to see these
> occasional failures be sorted out, so thank you for your efforts here!

Another way, if the last iteration fails, it to, let's say, double the timeout and continue, but return on the first successful iteration. But, it is the same fix in new wrapping.

Let me add some statistics in a v2, to see if that could ease your caution here.


Thxs, Håkon