* [PATCH] sched/isolation: Fix suspicious RCU usage without CONFIG_CPUSETS
@ 2026-11-08 18:51 Mathieu Desnoyers
0 siblings, 0 replies; only message in thread
From: Mathieu Desnoyers @ 2026-11-08 18:51 UTC (permalink / raw)
To: frederic, peterz, mingo, juri.lelli, vincent.guittot
Cc: Mathieu Desnoyers, longman, ridong.chen, dietmar.eggemann,
rostedt, bsegall, mgorman, vschneid, kprateek.nayak, bigeasy,
cgroups, linux-kernel
Since commit 03ff73510169 ("cpuset: Update HK_TYPE_DOMAIN cpumask from
cpuset"), cpuset can change the HK_TYPE_DOMAIN mask at run time. Readers
use RCU. housekeeping_dereference_check() also accepts readers that hold
a lock which keeps cpuset partitions from changing: the CPU hotplug
write lock or cpuset_mutex. During boot, before cpuset is writable, it
accepts all readers.
Without CONFIG_CPUSETS, nothing changes the mask after boot. But the
check still asks for one of these locks. In that configuration,
rebuild_sched_domains() holds only cpus_read_lock(). It calls
partition_sched_domains(1, NULL, NULL). That reads
housekeeping_cpumask(HK_TYPE_DOMAIN). sched_rt_handler() calls
rebuild_sched_domains() on each read or write of sched_rt_period_us and
sched_rt_runtime_us. So with isolcpus=domain, a read of
/proc/sys/kernel/sched_rt_runtime_us gives:
WARNING: suspicious RCU usage
kernel/sched/isolation.c:62 suspicious rcu_dereference_check() usage!
[...]
locks held by cat/91: 3, last CPU#3:
[...]
#1: (cpu_hotplug_lock){++++}-{0:0}, at: sched_rt_handler+0xb5/0xf0
#2: (sched_domains_mutex){+.+.}-{4:4}, at: partition_sched_domains+0x37/0x990
[...]
Call Trace:
lockdep_rcu_suspicious.cold+0x4e/0x9f
housekeeping_cpumask+0xaa/0xb0
partition_sched_domains+0x8e6/0x990
sched_rt_handler+0xc3/0xf0
proc_sys_call_handler+0x1cf/0x250
The report is a false positive. It needs CONFIG_PROVE_RCU and isolcpus=
with the domain flag, which is also the default when no flag is given.
Test runs that check the kernel log for lockdep reports flag it.
Fix this by accepting all readers when CONFIG_CPUSETS is off.
This change was developed with assistance from an LLM.
Fixes: 03ff73510169 ("cpuset: Update HK_TYPE_DOMAIN cpumask from cpuset")
Link: https://lore.kernel.org/all/20261108145931.1532447-1-mathieu.desnoyers@efficios.com/
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Reviewed-by: Waiman Long <longman@redhat.com>
---
This patch was first posted inside the bug report linked above. Since
then, it has Waiman's Reviewed-by. The code is unchanged.
kernel/sched/isolation.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/kernel/sched/isolation.c b/kernel/sched/isolation.c
index 156025ef81b7..dac9a1735198 100644
--- a/kernel/sched/isolation.c
+++ b/kernel/sched/isolation.c
@@ -43,6 +43,10 @@ static bool housekeeping_dereference_check(enum hk_type type)
if (system_state <= SYSTEM_SCHEDULING)
return true;
+ /* No cpuset, so the mask never changes after boot */
+ if (!IS_ENABLED(CONFIG_CPUSETS))
+ return true;
+
/* CPU hotplug write locked, so cpuset partition can't be overwritten */
if (IS_ENABLED(CONFIG_HOTPLUG_CPU) && lockdep_is_cpus_write_held())
return true;
base-commit: 006991aa89974378ee579416dba87adc22cd60fd
--
2.47.3
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-08 18:51 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-08 18:51 [PATCH] sched/isolation: Fix suspicious RCU usage without CONFIG_CPUSETS Mathieu Desnoyers
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®