From mboxrd@z Thu Jan 1 00:00:00 1970 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 DBBCA364EB0 for ; Thu, 13 Aug 2026 07:38:58 +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=1786606740; cv=none; b=tVzq2BG+Nf3LsD//aRV5ZbwNC/Kuw1FcEpmQYSgLk7ew69uTM7TklmaAr9DcY9ZJVjzmAKUjTVBze0WkOky7cEDZL0y7rrSOQu51zgthiVYLKXpVqEERvEQOEammUuKbdeWxGYY7mI/4P74VadrISFaZFSHqwJHY4Q2AYe8Wzso= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786606740; c=relaxed/simple; bh=Xxw6iQ18U5w54sh07LDYLHlqGXmVmHTcM3/H9aidVl8=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=N1aHh1SDXOxuR1nz34qZraOwEpzlv2UFJrdweuxWIYCUIte/ucuqjf44MVmJ6S2RIfUXnBlDtPXeJ5GhZGMPHFbW7YUxL06h14F1ORCgKW8XDJce4mg5YYiwnczkP2sTXvM7pDyYfLh8/uAfHx8ORcOgvkL7Knho2pF30KGWVQ0= 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=aiZES/zm; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=Czo8mwjw; 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="aiZES/zm"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Czo8mwjw" Date: Thu, 13 Aug 2026 09:38:55 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1786606736; h=from:from: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; bh=0Ngbu5tMW/n4HKhaFOWIAbBGUIiQQWCGeoOkI7KZy80=; b=aiZES/zm05uzQu1NRbhAyOttx6902NTnwDrKvuoz9NbUevtTDY4Udap/lCKL+Z5xq7RIoT VoJBYZWBxo63Pk6nHOV3ByQW1tIzxecM8Mi9wVBXVaXz/SmlMLMnIAVXLhPdKd5voA2cdV sFJMbiVkFbODgD9VafS61E4pxDuMcDH0Wxcf0zQhgG0YkKcf4gyec1zs0lwfPXCb7j8iir P+nHDfwiiWY3ioLuvYivcHcYr3vx0lnlu67zRO1F7DCxVP4lnDmtOFfsW8RPHlsU5w9rKm CpqmNEGQavtrfn4iMm9q7e5aI2RdFEBhO4GUKZQtTIKnpEfMq6bKVKpRl3GmLg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1786606736; h=from:from: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; bh=0Ngbu5tMW/n4HKhaFOWIAbBGUIiQQWCGeoOkI7KZy80=; b=Czo8mwjwYHxkYB8COGkJui9h/x/FYDtIE76gjX+VjDOsQbsKIWtfTOaB65BtysSQdtJA/m 6Ju4VAh1PydAtdAQ== From: Sebastian Andrzej Siewior To: linux-kernel@vger.kernel.org Cc: Ben Segall , Dietmar Eggemann , Ingo Molnar , Juri Lelli , K Prateek Nayak , Mel Gorman , Peter Zijlstra , Steven Rostedt , Tim Chen , Valentin Schneider , Vincent Guittot , "chen.yu@linux.dev" , "Chen, Yu C" Subject: [PATCH v2] sched/topology: Add a cpus_read_lock to rebuild_sched_domains() Message-ID: <20260813073855.ji2UrtVh@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable A read from /proc/sys/kernel/sched_rt_runtime_us leads to backtrace due to missing cpu_hotplug_lock with CONFIG_CPUSETS=3Dn. The callchain is sched_rt_handler() -> partition_sched_domains() -> sched_cache_set() -> static_key_enable_cpuslocked(&sched_cache_present). sched_cache_set() itself is also invoked from sched_init_domains() which is early during the boot, holding just the sched_domains_mutex_lock(). Here is no warning because it happens before user space is running (and hotplug operations are not possible). There is also sched_cache_active_set() which acquires the hotplug lock before invoking any of the _cpuslocked() functions. This is only a problem with CONFIG_CPUSETS=3Dn because in the =3Dy case the other implementation of rebuild_sched_domains acquires the CPU-hotplug lock. Acquire CPU hotplug lock before in rebuild_sched_domains(), before partition_sched_domains() is invoked for the CONFIG_CPUSETS=3Dn case. Fixes: a7660ce1590fc ("sched/cache: Fix has_multi_llcs iff at least one par= tition has multiple LLCs") Signed-off-by: Sebastian Andrzej Siewior --- v1=E2=80=A6v2: https://lore.kernel.org/all/20260812095800.gl06ANul@linutron= ix.de/ - Move the lock from partition_sched_domains() to rebuild_sched_domains() in the CONFIG_CPUSETS=3Dn since this is the only affected case. Noticed by Yu C Chen and Tim Chen. include/linux/cpuset.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h index 65d76a38974ba..bf3999daa080a 100644 --- a/include/linux/cpuset.h +++ b/include/linux/cpuset.h @@ -273,6 +273,7 @@ static inline void dl_rebuild_rd_accounting(void) =20 static inline void rebuild_sched_domains(void) { + guard(cpus_read_lock)(); partition_sched_domains(1, NULL, NULL); } =20 --=20 2.55.0