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 - 11:38:41 EST
On 2026-11-08 09:13:47 [-0500], Mathieu Desnoyers wrote:
> In the ABBA cases of test-ww_mutex, an owner never keeps running while
> the other context blocks on it. With PREEMPT_RT, a ww_mutex waiter
> spins while its owner runs. The wound that resolves an ABBA reaches the
> waiter through a wakeup.
>
> Add a wound-wait case where both contexts keep running. Each one runs
> on its own CPU at SCHED_FIFO. The younger context holds B and blocks on
> A. The older context holds A, then blocks on B, which wounds the
> younger one. The older context must get B within 10ms on average, over
> 10 rounds.
>
> On v7.4-rc1 with PREEMPT_RT, the case fails every time. The two
> contexts spin on each other until the fair server preempts them, after
> 950ms by default. With "locking/rtmutex: Stop spinning on the owner
> when the waiter is woken", earlier in this series, the older context
> gets B in microseconds. Without PREEMPT_RT, the case passes with or
> without that fix.
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…
Anyway.
Since both (ww-mutex and futex) use the same code I am tempted to say
that one test case might be enough.
But in case we want this,
Tested-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxxxx>
Sebastian