From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) (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 6F691388E60 for ; Wed, 12 Aug 2026 18:05:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.19 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786557927; cv=none; b=IrjrxVnXUyICb8xHca8PmsoQd0lmWc7hIfUvDSMo63hR8KIeojtpNQ3zTecDy4W4tYoYYD9ahlJDvN2H+2jvO5TrjMZBNu6kQaSnmTMnicmyjWnk5UV9vOh1g1T8E3M3g6/rdM98iHI02TL/J4I12lm6D0TTIjeSHquflzQGn5k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786557927; c=relaxed/simple; bh=2I0xMGRn0te2CXT2GFnchaT34sE2VOfsOCTkpJj0fzw=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=oGOcWZarEZGlN3HZPK034RqakkcJHe5tTy75ky6Hb39mKEX0GPEpv1GuhQ4xdcv5OrjN4WY0dw8pmvfJAPYicoyaHXCTKhBKMpnRQGVO0hfDCocnLe228vuItnJ+m0rdL6MgiTyKiAttiWSDHDrccIAbdAMAVgMC75K6m7TzE9g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=jQAxw9H3; arc=none smtp.client-ip=192.198.163.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="jQAxw9H3" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1786557926; x=1818093926; h=message-id:subject:from:to:cc:date:in-reply-to: references:content-transfer-encoding:mime-version; bh=2I0xMGRn0te2CXT2GFnchaT34sE2VOfsOCTkpJj0fzw=; b=jQAxw9H3qS9bvbTqUoRcrjxX1W0Jk50zyCYZ/xlXB52AGsnV0qdRzn17 HpuAjyN1W3yAeEgS0wjWA/0Y7PdeDeM+7jHHfgY/lmXNDaeByLE5opB0b zWhHW18NLRoS1EN+rZDiy2/sjNnlMnOTzae34nrIX0FMgFErTIikCGp2F BQC+Nz79G8Q0v7wOh1Suf1w+7u2sJCT9PICng82vYhe0xUpH0GZHBJYFb LXeM5wzMEWfKAyb4Ar7go4dCjo4F0g2WIXxpLkW/lWNiLscL60QO35GV4 8DofxP7WqnTRYwuhSaVL0mhx/t9xMb/2vjzwG6l+BiiQEiLqv3dHDNvEL Q==; X-CSE-ConnectionGUID: jMjiS/vTQqW6NqjWMwqBaQ== X-CSE-MsgGUID: ayxeCLCDRiSQ4DyjIyuO7g== X-IronPort-AV: E=McAfee;i="6800,10657,11873"; a="86082170" X-IronPort-AV: E=Sophos;i="6.25,219,1779174000"; d="scan'208";a="86082170" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Aug 2026 11:05:25 -0700 X-CSE-ConnectionGUID: Jc7s2UfiQ7SY7l/g36/2jQ== X-CSE-MsgGUID: rPRgEr8rQaKG507a8C6QJA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.25,219,1779174000"; d="scan'208";a="267568237" Received: from unknown (HELO [10.241.243.185]) ([10.241.243.185]) by orviesa004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Aug 2026 11:05:24 -0700 Message-ID: <42b0af4923217f39bae45ec4c0eba9599ecdbf5c.camel@linux.intel.com> Subject: Re: [PATCH] sched/topology: Add a cpus_read_lock to partition_sched_domains() From: Tim Chen To: "Chen, Yu C" , Sebastian Andrzej Siewior Cc: Ben Segall , Dietmar Eggemann , Ingo Molnar , Juri Lelli , K Prateek Nayak , Mel Gorman , Peter Zijlstra , Steven Rostedt , Valentin Schneider , Vincent Guittot , linux-kernel@vger.kernel.org, "chen.yu@linux.dev" Date: Wed, 12 Aug 2026 11:05:24 -0700 In-Reply-To: <8c36c744-973a-4e33-a72a-eed0cffc05da@intel.com> References: <20260812095800.gl06ANul@linutronix.de> <8c36c744-973a-4e33-a72a-eed0cffc05da@intel.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.58.1 (3.58.1-1.fc43) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On Wed, 2026-08-12 at 20:54 +0800, Chen, Yu C wrote: > Hi Sebastian, >=20 > On 8/12/2026 5:58 PM, Sebastian Andrzej Siewior wrote: > > 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). > >=20 > > sched_cache_set() itself is also invoked from sched_init_domains() whic= h > > 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). > >=20 > > There is also sched_cache_active_set() which acquires the hotplug lock > > via before invoking any of the _cpuslocked() functions. > >=20 > > Acquire CPU hotplug lock before in partition_sched_domains(), before > > sched_domains_mutex before the _cpuslocked() functions are invoked. > >=20 > > 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(+) > >=20 > > 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 nd= oms_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(); >=20 > Thanks for taking a look at this issue. I found that there is a comment= =20 > around > partition_sched_domains() says: "Call with hotplug lock held" > Not sure if the caller of partition_sched_domains() rather than=20 > partition_sched_domains() > should grab the cpuhotplug lock? I guess the issue is triggered when > CONFIG_CPUSETS=3Dn, in this case rebuild_sched_domains() will not grab > cpuhotplug lock, should we add guard(cpus_read_lock) in=20 > rebuild_sched_domains() > instead? When CONFIG_CPUSETS=3Dn, rebuild_sched_domains() is stubbed to static inline void rebuild_sched_domains(void) { partition_sched_domains(1, NULL, NULL); } without cpus_read_lock. Are you suggesting adding the lock here? We do acquire the lock for CONFIG_CPUSETS=3Dy. If we do follow this convention, cpuset_reset_sched_domains() and cpuset_reset_sched_domains() also stubbed to partition_sched_domains(1, NULL, NULL); Probably should add cpus_read_lock there too for consistency. Tim >=20 > thanks, > Chenyu >=20