From nobody Mon Jun 8 08:30:20 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 983AC48C401; Wed, 3 Jun 2026 14:25:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780496716; cv=none; b=OBvW/iehA8LYd8NmOj5O5UYAmGyaT+MbmAXHkcAFA1oFxJ+VcFYlYbwC5I56T9M1KL8F1ss8dFf6de7pm1/B1bsQdWJOGpFRKfRuTza1FXpMkJ1Jp1QjzYyDkPi3obvMjrZfRr2ntnQjcn1EBppq9gaEsvWWSQuiyz8niCm9ZfU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780496716; c=relaxed/simple; bh=6tuqUFpONRaaeukm2imvQEarElTj1eNaPjmYxd8iMnw=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=Ydk9wu+TiXYI87cstaqDGkTR1niVgah75+Zv4BjSB236JPkBhbFuWn8qHn360+tAnuV6DLzGrbYfziNPcEXX2r+m8x9oaFPScfxHLiL/WFkx/MxbDMXPso/vJJJHo2DkRwwUm0lfJyGfKGDvCkOqYEg9NW5rgTwZuDRJhAKCRbw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=qDTIHuC0; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=E7veOnqD; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="qDTIHuC0"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="E7veOnqD" Date: Wed, 03 Jun 2026 14:25:12 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1780496714; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tQSsQ2X75Pstzj29g57oSU4VcvSkn7C4FEecm63lAVs=; b=qDTIHuC0hdjjmBwHGVZjujsSUXLF44prpj+IriR9T/JLpAa5w1fsK0Wh/fw2WMxEOjIgz/ jNWMsJz95kNO8DBep4fTSPIRHEGSCOokCdmPf3+IYOWGUpJoezR1eYFP11v6TQdM8zzPhA o/OuKXliNPF1DOWc5hYf5EG3OR3Ali7q0aCJS48V75qS+o9AGdQO7E88gEQkeRQYtlZAzr lskFRgoG3qa9/6iLgMgdigVyIExdp2/ROjxdMPgAD6+W60v5vqw/udApLSiSY9VQn2cCrN /vcRU2X3zO27Lqg372ZoycLvNDs+3ANg7gVwnjPDev20lObanYnZJD9EQDILOg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1780496714; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tQSsQ2X75Pstzj29g57oSU4VcvSkn7C4FEecm63lAVs=; b=E7veOnqDpMZzaAxzQ4qF5E2wprIzwAw6UULOAe2YPT/zn7QZEj/iJo79qz+pUqnvIY3PA1 M6GAMSFA7zwV5dCA== From: "tip-bot2 for Karl Mehltretter" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: locking/core] lockdep/selftests: Restore sched_rt_mutex state on PREEMPT_RT Cc: Karl Mehltretter , "Peter Zijlstra (Intel)" , Sebastian Andrzej Siewior , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260523185123.17482-3-kmehltretter@gmail.com> References: <20260523185123.17482-3-kmehltretter@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <178049671287.710.4309145928567978148.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the locking/core branch of tip: Commit-ID: 06961d60a0e410bf8df69ccff7eb1bd824912b8f Gitweb: https://git.kernel.org/tip/06961d60a0e410bf8df69ccff7eb1bd82= 4912b8f Author: Karl Mehltretter AuthorDate: Sat, 23 May 2026 20:51:23 +02:00 Committer: Peter Zijlstra CommitterDate: Wed, 03 Jun 2026 11:38:47 +02:00 lockdep/selftests: Restore sched_rt_mutex state on PREEMPT_RT The WW-mutex selftests deliberately exercise failing lock paths. On PREEMPT_RT, some of those paths enter the RT-mutex scheduler helpers. The change referenced by the Fixes tag made those helpers track RT-mutex scheduling state in current->sched_rt_mutex. The bit is normally cleared by the matching post-schedule helper, but some WW-mutex selftests disable the runtime debug_locks flag before that happens. With debug_locks cleared, lockdep_assert() does not evaluate the expression that clears the bit, leaving stale state for the next testcase. With CONFIG_PREEMPT_RT=3Dy and CONFIG_DEBUG_LOCKING_API_SELFTESTS=3Dy, that stale state produces warnings such as: WARNING: kernel/sched/core.c:7557 at rt_mutex_pre_schedule+0x26/0x2d RIP: 0010:rt_mutex_pre_schedule+0x26/0x2d Save and restore current->sched_rt_mutex around each testcase, matching the existing PREEMPT_RT cleanup for task-local migration and RCU state. Fixes: d14f9e930b90 ("locking/rtmutex: Use rt_mutex specific scheduler help= ers") Assisted-by: Codex:gpt-5 Signed-off-by: Karl Mehltretter Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Sebastian Andrzej Siewior Link: https://patch.msgid.link/20260523185123.17482-3-kmehltretter@gmail.com --- lib/locking-selftest.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/locking-selftest.c b/lib/locking-selftest.c index cb806b6..bfafe12 100644 --- a/lib/locking-selftest.c +++ b/lib/locking-selftest.c @@ -1433,6 +1433,7 @@ static void dotest(void (*testcase_fn)(void), int exp= ected, int lockclass_mask) #ifdef CONFIG_PREEMPT_RT int saved_mgd_count =3D current->migration_disabled; int saved_rcu_count =3D current->rcu_read_lock_nesting; + int saved_sched_rt_mutex =3D current->sched_rt_mutex; #endif =20 WARN_ON(irqs_disabled()); @@ -1469,6 +1470,8 @@ static void dotest(void (*testcase_fn)(void), int exp= ected, int lockclass_mask) preempt_count_set(saved_preempt_count); =20 #ifdef CONFIG_PREEMPT_RT + current->sched_rt_mutex =3D saved_sched_rt_mutex; + while (current->migration_disabled > saved_mgd_count) migrate_enable(); =20