Re: Regression on linux-next (next-20260324 )
From: K Prateek Nayak
Date: Wed Apr 22 2026 - 08:07:32 EST
Hello Peter,
On 4/22/2026 2:53 PM, Peter Zijlstra wrote:
> On Tue, Apr 21, 2026 at 10:56:48PM +0200, Peter Zijlstra wrote:
>> Excellent, I'll write it up tomorrow.
>
> How's this? It 'passes' the ww_mutex selftest thing in so far as that I
> get the same:
>
> [ 2.312369] Beginning ww (wound) mutex selftests
> [ 4.853240] stress (stress_inorder_work) failed with -35
> [ 9.379572] Beginning ww (die) mutex selftests
> [ 16.435831] All ww mutex selftests passed
>
> before the offending commit and after this patch.
Yup I see pretty much the same. I think 4k ww-mutexes being fought
for by #CPUs threads with a short timeout doesn't sit too well with
stress_inorder_work but it does make some forward progress until
that timeout hits like before ;-)
>
> ---
> Subject: Subject: locking/mutex: Fix ww_mutex wait_list operations
> From: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
> Date: Wed Apr 22 10:38:41 CEST 2026
>
> Chaitanya and John reported commit 25500ba7e77c ("locking/mutex: Remove the
> list_head from struct mutex") wrecked ww_mutex.
>
> Specifically there were 2 issues:
>
> - __ww_waiter_prev() had the termination condition wrong; it would terminate
> when the previous entry was the first, which results in a truncated
> iteration: W3, W2, (no W1).
>
> - __mutex_add_waiter(@pos != NULL), as used by __ww_waiter_add() /
> __ww_mutex_add_waiter(); this inserts @waiter before @pos (which is what
> list_add_tail() does). But this should then also update lock->first_waiter.
>
> Much thanks to Prateek for spotting the __mutex_add_waiter() issue!
>
> Fixes: 25500ba7e77c ("locking/mutex: Remove the list_head from struct mutex")
> Reported-by: "Borah, Chaitanya Kumar" <chaitanya.kumar.borah@xxxxxxxxx>
> Closes: https://lore.kernel.org/r/af005996-05e9-4336-8450-d14ca652ba5d%40intel.com
> Reported-by: John Stultz <jstultz@xxxxxxxxxx>
> Closes: https://lore.kernel.org/r/CANDhNCq%3Doizzud3hH3oqGzTrcjB8OwGeineJ3mwZuGdDWG8fRQ%40mail.gmail.com
> Debugged-by: K Prateek Nayak <kprateek.nayak@xxxxxxx>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
Still runs as expected! Feel free to include:
Tested-by: K Prateek Nayak <kprateek.nayak@xxxxxxx>
--
Thanks and Regards,
Prateek