From nobody Mon Jun 8 08:36:18 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 0B05748C8B0; Wed, 3 Jun 2026 14:25:17 +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=1780496718; cv=none; b=fxg9bHcjguHvlOC8LpdewPDRtqQLSWUhJVoLG787ihSaDXfm0R/3LU5Z5afoN5tFYKd5rCep/W2e81z8QuGQNhTSRnNf71rSTqLrucDsC5NXEro01Y9zF2oyG4T4HDQ6OPxl4NxmS5PBdfbMBh8S5cNT2m3Rv8kBJFC6hpjwzZs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780496718; c=relaxed/simple; bh=Laqv2U+YkfCyTo1ZFUd4NLHkPS+RAfVi8l8I4E9hJYU=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=McqJjnJi0OfiESUvUVruP/f7v2+56Yl8CmAlnxwYHulRdfJD3OlX5ENNYvgfxpSVvWJB3UgX4NLIHKTswfj/ZGj1k14X8hV3+vcrQPLzaycZ0+O1SxsXsubEA6IYwJZNvhuQJz5fNAh/sB6kefn1ZslU3Df0wQA+IynhRLKQAew= 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=MLkdxZxV; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=0yFU6oQY; 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="MLkdxZxV"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="0yFU6oQY" Date: Wed, 03 Jun 2026 14:25:14 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1780496715; 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=CyZPneAvMIHxI09hzwnxEUJ1otLIwzzdtdKAong+TWw=; b=MLkdxZxVdBZZIPpBFvF/u/hRSAiJ3ExEijsvLOyMjtkqYudXCbrcdbf7b8TDHhaRSik+wA RfCqJUG0HnFIwXn7yeeidfgGTvqveBa/Wf/XHjXi+XtfvSuIOGPUc81JyA72r+GMbtm0iu Ms4dAF9nsBtqW+mA5a9FEJhwhU4SnevcXrsq3hFqYqYVB5vKjKjrHTlGLis8zb5Zz487Et vDA9ICTfYsb+zTBh3VJ/TWkctcVuSVY1OZlB6sMaGCA9bP2wSgNAwxqE7vVY0pSedZOqxy NHTinIFAnjvLn/oxGHU9QSuO4p61RnejkOgMPZY88GSyxzaSD+q4SpUdggIyzw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1780496715; 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=CyZPneAvMIHxI09hzwnxEUJ1otLIwzzdtdKAong+TWw=; b=0yFU6oQYXFsrnwBOPcXqeHgdffh4g3mEm/7IO9pqdw/1h/9zJaDG7i2EUqQfkj1flxarFW l+4Yayq7elUOhnBw== 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 migrate_disable() 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-2-kmehltretter@gmail.com> References: <20260523185123.17482-2-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: <178049671424.710.9993597816881772724.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: d8c897b20bf4d4cbb1e935a8ceb666bcc0f82580 Gitweb: https://git.kernel.org/tip/d8c897b20bf4d4cbb1e935a8ceb666bcc= 0f82580 Author: Karl Mehltretter AuthorDate: Sat, 23 May 2026 20:51:22 +02:00 Committer: Peter Zijlstra CommitterDate: Wed, 03 Jun 2026 11:38:47 +02:00 lockdep/selftests: Restore migrate_disable() state on PREEMPT_RT The lockdep selftests deliberately run unbalanced locking patterns. dotest() restores the task state they leave behind before running the next testcase. On PREEMPT_RT, spin_lock() uses migrate_disable() instead of disabling preemption. dotest() cleans up the resulting migration-disabled state, but that cleanup is still guarded by CONFIG_SMP. That used to match the scheduler data model, where migration_disabled was also CONFIG_SMP-only. The commit referenced below made SMP scheduler state unconditional, so CONFIG_SMP=3Dn PREEMPT_RT kernels with CONFIG_DEBUG_LOCKING_API_SELFTESTS=3Dy report success from the selftests and then trip over stale current->migration_disabled state: releasing a pinned lock bad: scheduling from the idle thread! Kernel panic - not syncing: Fatal exception Save and restore current->migration_disabled for every PREEMPT_RT build. Fixes: cac5cefbade9 ("sched/smp: Make SMP unconditional") 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-2-kmehltretter@gmail.com --- lib/locking-selftest.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/locking-selftest.c b/lib/locking-selftest.c index d939403..cb806b6 100644 --- a/lib/locking-selftest.c +++ b/lib/locking-selftest.c @@ -1431,9 +1431,7 @@ static void dotest(void (*testcase_fn)(void), int exp= ected, int lockclass_mask) { int saved_preempt_count =3D preempt_count(); #ifdef CONFIG_PREEMPT_RT -#ifdef CONFIG_SMP int saved_mgd_count =3D current->migration_disabled; -#endif int saved_rcu_count =3D current->rcu_read_lock_nesting; #endif =20 @@ -1471,10 +1469,8 @@ static void dotest(void (*testcase_fn)(void), int ex= pected, int lockclass_mask) preempt_count_set(saved_preempt_count); =20 #ifdef CONFIG_PREEMPT_RT -#ifdef CONFIG_SMP while (current->migration_disabled > saved_mgd_count) migrate_enable(); -#endif =20 while (current->rcu_read_lock_nesting > saved_rcu_count) rcu_read_unlock();