From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mta0.migadu.com (out-205.mta0.migadu.com [91.218.175.205]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8C76B443AB0 for ; Thu, 13 Aug 2026 09:43:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.205 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786614209; cv=none; b=d5JS2Zyt1akEpY1TcSFUQyUgL8WqrSK6UfT5w/9DZZOuWVBBjKyBR30zRwPC9YC0ba8W1of+R7R44k3AKzH08YYWsXCaR+WVV5MReOu5r3zs1zMHAj3P3pHld7lyh3E8QV4oNif0TmX6oo/J+pOpmxWVB2/ZrLtpejfgAe7qnSc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786614209; c=relaxed/simple; bh=OTRzmvvffm7aT3+VVHP4OIpeoThkQTqhAzsCjj7zWxE=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=WGyL+26vrljQEBicjpVYcxp6wob9jkUV6RKqgPRIckZLI2chTzU5rabXOSzRFz2hl7DnNem9ZuUZiRN/i3XLsoDngRxW0Iz4pAgFu5J+8A3cwHDr2W6ifCEWMPI7jGdSrMk9GhUKJUu8rMaQ4HyYs/9Pc27bbOxUHuopgKOZeNA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=gpH0mqv7; arc=none smtp.client-ip=91.218.175.205 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="gpH0mqv7" X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=OTRzmvvffm7aT3+VVHP4OIpeoThkQTqhAzsCjj7zWxE=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1786614205; v=1; x=1787219005; b=gpH0mqv7x/0iqCsLCRd9IBpIikS1AegSaNn/pgGUr+do8Yx4zl3D8aNuR0u1IPmbhvIIYgdN 2QB6YRWCOm63lYmfpP8Al8ktOvUEFoEFHclmmE8Pc6WW7xMS8+BiqAOJ0+uFFJTlFyrKXczwSbp rMN7Jg/1uhqMyEAENnBNKspg= X-Envelope-To: linux-kernel@vger.kernel.org Received: from [10.63.123.245] (14.29.108.90) by smtp.migadu.com with ESMTPS id f185781b4bc5a6ac; Thu, 13 Aug 2026 09:43:25 +0000 X-Migadu-Flow: FLOW_OUT Message-ID: Date: Thu, 13 Aug 2026 17:43:13 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] sched/topology: Add a cpus_read_lock to rebuild_sched_domains() To: Sebastian Andrzej Siewior , linux-kernel@vger.kernel.org, cgroups@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" , Waiman Long References: <20260813073855.ji2UrtVh@linutronix.de> <20260813074817.t8IQTgfx@linutronix.de> From: Ridong Chen In-Reply-To: <20260813074817.t8IQTgfx@linutronix.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 8/13/2026 3:48 PM, Sebastian Andrzej Siewior wrote: > + CPUSET maintainer which I missed because re-used the CCs from v1. > > On 2026-08-13 09:38:56 [+0200], To linux-kernel@vger.kernel.org wrote: >> A read from /proc/sys/kernel/sched_rt_runtime_us leads to backtrace due >> to missing cpu_hotplug_lock with CONFIG_CPUSETS=n. 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=n because in the =y 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=n case. >> >> Fixes: a7660ce1590fc ("sched/cache: Fix has_multi_llcs iff at least one partition has multiple LLCs") >> Signed-off-by: Sebastian Andrzej Siewior >> --- >> v1…v2: https://lore.kernel.org/all/20260812095800.gl06ANul@linutronix.de/ >> - Move the lock from partition_sched_domains() to >> rebuild_sched_domains() in the CONFIG_CPUSETS=n 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) >> >> static inline void rebuild_sched_domains(void) >> { >> + guard(cpus_read_lock)(); >> partition_sched_domains(1, NULL, NULL); >> } >> >> -- >> 2.55.0 >> LGTM. Thanks. Reivewed-by: Ridong Chen -- Best regards Ridong