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 0598F347505 for ; Wed, 12 Aug 2026 09:58:09 +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=1786528691; cv=none; b=UPOS9TMJt6w5VrFAimnpIUFRFJGv0tonF/YOKY84mDTQFE2Pj6kd+eFolUL+QvIrQgblbALyRDYARjkUEa4t2o/QfYFnmiuAjH9ALbNve8BGYS2ngKCt5LSma60YDWoRWSiE3KdrsxdKSAjArH+8Yii4QOlh1sYfLgBtwluppFE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786528691; c=relaxed/simple; bh=fv+XIBzgA+76Ztdr6a9pHwqjM2MAHADp8pTsHaOBpgI=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=jGrVjqbYoznZBvVwIrIZ5rIcB+IUFL42t40fqEzB5/BPH83garwLwT+kG/s4H7S6dqGPCQpnDndAZmNAQC0FYyczF6ksQtTfAemfdlXrnDesakF+h2qXQCSC0nq4lAhAGtaEsrldL8JuNe9jvn44+G3gkp/2KXOkxWR0utNB/Uw= 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=4PbO61Ja; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=mdm5xNas; 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="4PbO61Ja"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="mdm5xNas" Date: Wed, 12 Aug 2026 11:58:00 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1786528681; 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; bh=TMNj3ssTve9JKerOh0e9U2Ms/o9+HTKuIU3A7yAjaFc=; b=4PbO61JaUul80uWB7ArsvpTD6sWca0FI19RZlJ4C4UkBg0HXA2CIyUSgEEukXEzZpHeepe GUFbp8W+urj4P7h74cemrV8lkONaTQlNrCMxeIuK8AdCdZWTsM/Jv6RyHkZ7y2cmDq/Gy7 OqF6ymI0l7LdRF6MwdsBMtJLDOwUhOvmO5riQA9+LmHTLQKJJfcPzFvqR5PBISrYWEVS9h XzEepH/66xFJy19lFBeZZKNNW+BmdTHnzVBopj+JRpA/0qpZuxt5XW1LtqG9ER0lRVIptx jLHbTTAiGimfrllfXwOT6eMOFtc4N5ncuUOXJ3qrNSZlpaP9ws4RSV2+wJDsbg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1786528681; 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; bh=TMNj3ssTve9JKerOh0e9U2Ms/o9+HTKuIU3A7yAjaFc=; b=mdm5xNasTWnB3CZrycAM3mMibC2upVGKWH9/RY7ErCEiz+BXvVp7VttjBYYA1nGszJpk2k tSw5nEnPyGg36eBw== From: Sebastian Andrzej Siewior To: linux-kernel@vger.kernel.org Cc: Ben Segall , Chen Yu , Dietmar Eggemann , Ingo Molnar , Juri Lelli , K Prateek Nayak , Mel Gorman , Peter Zijlstra , Steven Rostedt , Tim Chen , Valentin Schneider , Vincent Guittot Subject: [PATCH] sched/topology: Add a cpus_read_lock to partition_sched_domains() Message-ID: <20260812095800.gl06ANul@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 A read from /proc/sys/kernel/sched_rt_runtime_us leads to backtrace due to missing cpu_hotplug_lock. 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 via before invoking any of the _cpuslocked() functions. Acquire CPU hotplug lock before in partition_sched_domains(), before sched_domains_mutex before the _cpuslocked() functions are invoked. Fixes: a7660ce1590fc ("sched/cache: Fix has_multi_llcs iff at least one partition has multiple LLCs") Signed-off-by: Sebastian Andrzej Siewior --- kernel/sched/topology.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c index 622e2e01974c4..ef037d6664d98 100644 --- a/kernel/sched/topology.c +++ b/kernel/sched/topology.c @@ -3498,6 +3498,7 @@ static void partition_sched_domains_locked(int ndoms_new, cpumask_var_t doms_new void partition_sched_domains(int ndoms_new, cpumask_var_t doms_new[], struct sched_domain_attr *dattr_new) { + guard(cpus_read_lock)(); sched_domains_mutex_lock(); partition_sched_domains_locked(ndoms_new, doms_new, dattr_new); sched_domains_mutex_unlock(); -- 2.55.0