Linux cgroups development
 help / color / mirror / Atom feed
From: Tim Chen <tim.c.chen@linux.intel.com>
To: Ridong Chen <ridong.chen@linux.dev>,
	Sebastian Andrzej Siewior	 <bigeasy@linutronix.de>,
	linux-kernel@vger.kernel.org, cgroups@vger.kernel.org
Cc: Ben Segall <bsegall@google.com>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	 Ingo Molnar <mingo@redhat.com>,
	Juri Lelli <juri.lelli@redhat.com>,
	K Prateek Nayak <kprateek.nayak@amd.com>,
	 Mel Gorman <mgorman@suse.de>,
	Peter Zijlstra <peterz@infradead.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	 Valentin Schneider	 <vschneid@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	 "chen.yu@linux.dev"	 <chen.yu@linux.dev>,
	"Chen, Yu C" <yu.c.chen@intel.com>,
	Waiman Long	 <longman@redhat.com>
Subject: Re: [PATCH v2] sched/topology: Add a cpus_read_lock to rebuild_sched_domains()
Date: Wed, 19 Aug 2026 10:14:38 -0700	[thread overview]
Message-ID: <ac36ff70f74b5e071e80a5df89d9979afa7b9956.camel@linux.intel.com> (raw)
In-Reply-To: <d7129d5a-c9ec-421c-84e9-d227cd10ec32@linux.dev>

On Thu, 2026-08-13 at 17:43 +0800, Ridong Chen wrote:
> 
> 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 <bigeasy@linutronix.de>
> > > ---
> > > 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 <ridong.chen@linux.dev>

Thanks for the  patch.

Reviewed-by: Tim Chen <tim.c.chen@linux.intel.com>

  reply	other threads:[~2026-08-19 17:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260813073855.ji2UrtVh@linutronix.de>
2026-08-13  7:48 ` [PATCH v2] sched/topology: Add a cpus_read_lock to rebuild_sched_domains() Sebastian Andrzej Siewior
2026-08-13  9:20   ` Chen Yu
2026-08-13  9:43   ` Ridong Chen
2026-08-19 17:14     ` Tim Chen [this message]
2026-08-19 18:52   ` Waiman Long

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ac36ff70f74b5e071e80a5df89d9979afa7b9956.camel@linux.intel.com \
    --to=tim.c.chen@linux.intel.com \
    --cc=bigeasy@linutronix.de \
    --cc=bsegall@google.com \
    --cc=cgroups@vger.kernel.org \
    --cc=chen.yu@linux.dev \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=kprateek.nayak@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=ridong.chen@linux.dev \
    --cc=rostedt@goodmis.org \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.com \
    --cc=yu.c.chen@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox