diff options
| author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2026-08-13 09:38:55 +0200 |
|---|---|---|
| committer | Peter Zijlstra <peterz@infradead.org> | 2026-08-20 11:01:34 +0200 |
| commit | 666a32836c8f9daf9b0067c49b04d5201fb8f3ba (patch) | |
| tree | e705f71383c4115eb59ed9b8bb969c3f365e90b2 /include/linux | |
| parent | a4ff2be345d0abc943da8dd8da98151843b750dc (diff) | |
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
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/cpuset.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h index 9db2d4fcead1..6a3f4d4d3978 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); } |
