Re: [PATCH v2 5/5] locking/ww_mutex/test: Time an ABBA with both owners running

From: Sebastian Andrzej Siewior

Date: Wed Nov 18 2026 - 13:45:43 EST


On 2026-11-18 12:29:55 [-0500], Mathieu Desnoyers wrote:
> Hi Sebastian,
Hi Mathieu,

> > This is the ww_mutex equivalent of the futex case on PREEMPT_RT. I got
> > lightly distracted by the -35/-EDEADLK error it always returns.
> > Something that we might have since v5.16-rc1…
>
> Where do you see it? In this case, the younger context gets -EDEADLK
> from ww_mutex_lock(A). That is the wound: it backs off and retries, and
> the case returns 0. In our PREEMPT_RT VMs, test-ww_mutex loads with 0.
> If a case of the module returns -35 on your setup, I can look into it.
> Which case prints it?

The timeout that was introduced in commit cfa92b6d52071
("locking/ww_mutex/test: Make sure we bail out instead of livelock")
triggers. That is not related to your patch. Increasing the timeout
makes it go away. It takes ~7sec to complete. It is not related to your
changes.
According to the history it hangs on real hardware and passes in kvm.

> > Since both (ww-mutex and futex) use the same code I am tempted to say
> > that one test case might be enough.
>
> The two take different wakeups through the same spin. A timeout or a
> signal wakes the futex waiter, and its cases fail with and without
> PREEMPT_RT. The wound wakes this one, and it fails only with
> PREEMPT_RT. I would keep it, but I can drop it if you prefer.

The testsuite changes, without the fixes I get
| [ 0.810516][ T1] Beginning ww (wound) mutex selftests
| [ 7.388445][ T143] stress (stress_inorder_work) failed with -35
| [ 7.410548][ T1] Beginning ww (die) mutex selftests
| [ 13.994648][ T1] All ww mutex selftests passed

The ww_mutex testsuite complains only on PREEMPT_RT. The route cause is
the same. I don't see a difference on !PREEMPT_RT here nor do the
patches touch anything.

I don't call the shots here, I just explained why I don't see this
needed. We might want to cover this code path if the paths divert in
future. I don't know.

> > But in case we want this,
> > Tested-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
>
> Thanks!
>
> Mathieu

Sebastian