From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 B8FDC440636 for ; Wed, 19 Aug 2026 18:52:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787165539; cv=none; b=WxjmRnpy61EkbozQXTz/m8OnarRPBBhInSvzM5W5kY4PMfT8EcbieGdz1cUXd6LzN6L3gqr56E87TAfdTmMEJEW8euuphX9mWmOJdyezZHOWCdG+lcrGIHXGqRmAI6G6+2fD/djoyFatBFsYEHkapW7/i6IBVb7DXjP+NBDO8yE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787165539; c=relaxed/simple; bh=6V7kSHDVdejjQ9J5MUmrLNxONHd+z1TilbT3my3as6g=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=NWgYOgaWw+EDWxlHVdGCLjgxFUaQXnaIuMxfB/PNCLT+pqJ3DD5vddpitCv5iBFEUU22zojcn5D+VC1rF87MflenMwbjjD0tMZUjgMeUCQzgXbN3ngFl2MI+BdOm+7A1lhEr1sjS1H7Yoxb71bmNJvB7LCyBavIatlOkGFfPt6k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=erTBeYKG; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="erTBeYKG" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787165536; 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: in-reply-to:in-reply-to:references:references; bh=fB55icsl4Xs/74ud6OFgLo3hi1STNoEUJRhf4EaiYYo=; b=erTBeYKGuoYGJhmgHGQ+yanQgZbrcdSJ9h/smsbBIi/yUVjcE9BzVUfj9i0eJv0LrDWQvV xGO14+G44dgN9CrYtP6gWgWJsN5ZuKUqHnmhBayAVgpkU/gkR6yonUlKf4Cy5wur3GwNLQ zlHIHoqoCm73r69a9t1PWX9Ffi4qj9U= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-634-GKFzCwnOMTOxqxqKTYBwGQ-1; Wed, 19 Aug 2026 14:52:11 -0400 X-MC-Unique: GKFzCwnOMTOxqxqKTYBwGQ-1 X-Mimecast-MFC-AGG-ID: GKFzCwnOMTOxqxqKTYBwGQ_1787165529 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 96BB71956096; Wed, 19 Aug 2026 18:52:08 +0000 (UTC) Received: from [100.91.18.181] (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 38DED1956044; Wed, 19 Aug 2026 18:52:03 +0000 (UTC) Message-ID: <042e0ea6-1e3e-4cb9-aa93-32f155e40fb3@redhat.com> Date: Wed, 19 Aug 2026 14:52:03 -0400 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" , Ridong Chen References: <20260813073855.ji2UrtVh@linutronix.de> <20260813074817.t8IQTgfx@linutronix.de> Content-Language: en-US From: Waiman Long In-Reply-To: <20260813074817.t8IQTgfx@linutronix.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 On 8/13/26 3:48 AM, 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 LKTM Reviewed-by:  Waiman Long