mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "tip-bot2 for Sebastian Andrzej Siewior" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	"Peter Zijlstra (Intel)" <peterz@infradead.org>,
	Chen Yu <yu.c.chen@intel.com>,
	Tim Chen <tim.c.chen@linux.intel.com>,
	Waiman Long <longman@redhat.com>,
	Valentin Schneider <vschneid@redhat.com>,
	Shrikanth Hegde <sshegde@linux.ibm.com>,
	Aaron Tomlin <atomlin@atomlin.com>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: sched/urgent] sched/topology: Add a cpus_read_lock to rebuild_sched_domains()
Date: Thu, 20 Aug 2026 09:10:04 -0000	[thread overview]
Message-ID: <178721700441.1542179.7625037542827854652.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20260813073855.ji2UrtVh@linutronix.de>

The following commit has been merged into the sched/urgent branch of tip:

Commit-ID:     666a32836c8f9daf9b0067c49b04d5201fb8f3ba
Gitweb:        https://git.kernel.org/tip/666a32836c8f9daf9b0067c49b04d5201fb8f3ba
Author:        Sebastian Andrzej Siewior <bigeasy@linutronix.de>
AuthorDate:    Thu, 13 Aug 2026 09:38:55 +02:00
Committer:     Peter Zijlstra <peterz@infradead.org>
CommitterDate: Thu, 20 Aug 2026 11:01:34 +02:00

sched/topology: Add a cpus_read_lock to rebuild_sched_domains()

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>
Reivewed-by: Ridong Chen <ridong.chen@linux.dev>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Chen Yu <yu.c.chen@intel.com>
Reviewed-by: Tim Chen <tim.c.chen@linux.intel.com>
Reviewed-by: Waiman Long <longman@redhat.com>
Reviewed-by: Valentin Schneider <vschneid@redhat.com>
Reviewed-by: Shrikanth Hegde <sshegde@linux.ibm.com>
Reviewed-by: Aaron Tomlin <atomlin@atomlin.com>
Tested-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Link: https://patch.msgid.link/20260813073855.ji2UrtVh@linutronix.de
---
 include/linux/cpuset.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index 9db2d4f..6a3f4d4 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -279,6 +279,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);
 }
 

      parent reply	other threads:[~2026-08-20  9:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-13  7:38 [PATCH v2] " Sebastian Andrzej Siewior
2026-08-13  7:48 ` Sebastian Andrzej Siewior
2026-08-13  9:20   ` Chen Yu
2026-08-13  9:43   ` Ridong Chen
2026-08-19 17:14     ` Tim Chen
2026-08-19 18:52   ` Waiman Long
2026-08-14 14:46 ` Valentin Schneider
2026-08-19 10:19 ` Dietmar Eggemann
2026-08-19 17:54 ` Shrikanth Hegde
2026-08-19 18:22   ` Shrikanth Hegde
2026-08-19 21:29 ` Aaron Tomlin
2026-08-20  9:10 ` tip-bot2 for Sebastian Andrzej Siewior [this message]

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=178721700441.1542179.7625037542827854652.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=atomlin@atomlin.com \
    --cc=bigeasy@linutronix.de \
    --cc=dietmar.eggemann@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=peterz@infradead.org \
    --cc=sshegde@linux.ibm.com \
    --cc=tim.c.chen@linux.intel.com \
    --cc=vschneid@redhat.com \
    --cc=x86@kernel.org \
    --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

all inboxes | Powered by JetHome®