From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: peterz@infradead.org, tglx@kernel.org, mingo@redhat.com
Cc: linux-kernel@vger.kernel.org,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
will@kernel.org, boqun@kernel.org, longman@redhat.com,
rostedt@goodmis.org, bigeasy@linutronix.de, clrkwllms@kernel.org,
dvhart@infradead.org, dave@stgolabs.net, andrealmeid@igalia.com,
shuah@kernel.org, juri.lelli@redhat.com,
linux-rt-devel@lists.linux.dev, linux-kselftest@vger.kernel.org
Subject: [PATCH 0/5] locking/rtmutex: priority inheritance fixes and tests
Date: Fri, 6 Nov 2026 18:59:26 -0500 [thread overview]
Message-ID: <20261106235931.1478800-1-mathieu.desnoyers@efficios.com> (raw)
Hi Peter, Thomas,
Three fixes to rt_mutex priority inheritance on v7.4-rc1, and two tests
that catch them. They came out of v4 of "sched/deadline: bandwidth
accounting fixes and selftests", posted alongside, which applies on top
of this series: its patch 8 takes a deadline boost from the waiter's
rt_mutex node, which patch 3 here keeps current.
The three fixes, by patch number:
1 the top waiter spins on a running owner past its own wakeups:
behind the owner of a PI futex spinning in userspace, a 1ms timed
lock returns up to 1.4s late and a signal waits as long, and with
PREEMPT_RT two ww_mutex contexts in an ABBA spin on each other. The
spin stops when the waiter is woken.
2 with PREEMPT_RT, the chain walk reads the ww_mutex context that
rt_mutex_init_waiter() leaves uninitialized, the debug poison on the
waiters of PI futexes, and reports neither a deadlock on PI futexes
nor a chain deeper than max_lock_depth. The context is initialized
with the rest of the waiter.
3 a waiter whose priority changes while another is ahead of it enters
its owner's pi_waiters with stale sort keys once promoted, and the
owner inherits from the wrong waiter. The keys are copied as it
enters.
Patch 4 adds futex_lock_pi_inherit to the futex selftests. It checks the
priority an owner runs at as its waiters block, time out, get a signal,
change their priority or are promoted to the top of their lock, along
chains of owners; that FUTEX_LOCK_PI refuses a lock cycle, and a chain
deeper than max_lock_depth, with EDEADLK; and how late a timeout or a
signal ends a wait behind an owner that runs. Patch 5 adds to
test-ww_mutex an ABBA with both owners running. v7.4-rc1 fails the cases
of each fix, and the series passes them, with and without PREEMPT_RT,
along with the locking API selftests, the ww_mutex selftest,
locktorture's rtmutex_lock and the futex selftests. Each message has its
numbers.
These patches, their messages and the tests were written by an LLM
coding assistant under my direction and review. Patch 1 came out of a
stress test of the deadline boost, patch 3 out of a review of the
deadline fix by a second model, and patch 2 out of futex_lock_pi_inherit
on its first run with PREEMPT_RT. Each patch went through a local run of
Sashiko AI before posting, which changed the two tests only.
Based on v7.4-rc1, 6628e7d4c6b2.
Mathieu Desnoyers (5):
locking/rtmutex: Stop spinning on the owner when the waiter is woken
locking/rtmutex: Initialize the ww_mutex context of a waiter
locking/rtmutex: Clone a waiter's sort keys as it enters pi_waiters
selftests/futex: Test priority inheritance on PI futexes
locking/ww_mutex/test: Time an ABBA with both owners running
kernel/locking/rtmutex.c | 15 +-
kernel/locking/rtmutex_common.h | 1 +
kernel/locking/test-ww_mutex.c | 213 +++++
.../selftests/futex/functional/.gitignore | 1 +
.../selftests/futex/functional/Makefile | 3 +-
.../futex/functional/futex_lock_pi_inherit.c | 744 ++++++++++++++++++
.../testing/selftests/futex/functional/run.sh | 3 +
7 files changed, 976 insertions(+), 4 deletions(-)
create mode 100644 tools/testing/selftests/futex/functional/futex_lock_pi_inherit.c
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
--
2.47.3
next reply other threads:[~2026-11-06 23:59 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-06 23:59 Mathieu Desnoyers [this message]
2026-11-06 23:59 ` [PATCH 1/5] locking/rtmutex: Stop spinning on the owner when the waiter is woken Mathieu Desnoyers
2026-11-06 23:59 ` [PATCH 2/5] locking/rtmutex: Initialize the ww_mutex context of a waiter Mathieu Desnoyers
2026-11-06 23:59 ` [PATCH 3/5] locking/rtmutex: Clone a waiter's sort keys as it enters pi_waiters Mathieu Desnoyers
2026-11-06 23:59 ` [PATCH 4/5] selftests/futex: Test priority inheritance on PI futexes Mathieu Desnoyers
2026-11-06 23:59 ` [PATCH 5/5] locking/ww_mutex/test: Time an ABBA with both owners running Mathieu Desnoyers
2026-11-07 0:11 ` sashiko-bot
2026-11-07 0:27 ` Mathieu Desnoyers
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=20261106235931.1478800-1-mathieu.desnoyers@efficios.com \
--to=mathieu.desnoyers@efficios.com \
--cc=andrealmeid@igalia.com \
--cc=bigeasy@linutronix.de \
--cc=boqun@kernel.org \
--cc=clrkwllms@kernel.org \
--cc=dave@stgolabs.net \
--cc=dvhart@infradead.org \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-rt-devel@lists.linux.dev \
--cc=longman@redhat.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=shuah@kernel.org \
--cc=tglx@kernel.org \
--cc=will@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®