* [PATCH] sched_ext: Validate cid override before updating tables
@ 2026-07-14 2:47 zhidao su (Xiaomi)
2026-07-14 23:56 ` Tejun Heo
0 siblings, 1 reply; 2+ messages in thread
From: zhidao su (Xiaomi) @ 2026-07-14 2:47 UTC (permalink / raw)
To: Tejun Heo
Cc: David Vernet, Andrea Righi, Changwoo Min, Ingo Molnar,
Peter Zijlstra, Juri Lelli, Vincent Guittot, Dietmar Eggemann,
Steven Rostedt, Ben Segall, Mel Gorman, Valentin Schneider,
K Prateek Nayak, sched-ext, linux-kernel, bpf, zhidao su (Xiaomi)
scx_bpf_cid_override() currently updates the cid lookup tables as it
walks the user supplied mapping. If validation fails midway, earlier
entries may remain installed.
Split validation and table updates so a failed override leaves the
existing mapping unchanged.
Signed-off-by: zhidao su (Xiaomi) <soolaugust@gmail.com>
---
kernel/sched/ext/cid.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/kernel/sched/ext/cid.c b/kernel/sched/ext/cid.c
index f31113b080e9..9e3a466f296f 100644
--- a/kernel/sched/ext/cid.c
+++ b/kernel/sched/ext/cid.c
@@ -329,6 +329,11 @@ __bpf_kfunc void scx_bpf_cid_override(const s32 *cpu_to_cid, u32 cpu_to_cid__sz,
scx_error(sch, "cid %d assigned to multiple cpus", c);
return;
}
+ }
+
+ for_each_possible_cpu(cpu) {
+ s32 c = cpu_to_cid[cpu];
+
scx_cpu_to_cid_tbl[cpu] = c;
scx_cid_to_cpu_tbl[c] = cpu;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] sched_ext: Validate cid override before updating tables
2026-07-14 2:47 [PATCH] sched_ext: Validate cid override before updating tables zhidao su (Xiaomi)
@ 2026-07-14 23:56 ` Tejun Heo
0 siblings, 0 replies; 2+ messages in thread
From: Tejun Heo @ 2026-07-14 23:56 UTC (permalink / raw)
To: zhidao su
Cc: David Vernet, Andrea Righi, Changwoo Min, Ingo Molnar,
Peter Zijlstra, Juri Lelli, Vincent Guittot, Dietmar Eggemann,
Steven Rostedt, Ben Segall, Mel Gorman, Valentin Schneider,
K Prateek Nayak, sched-ext, linux-kernel, bpf
Hello.
for-7.3 already does this. scx_bpf_cid_override() validates the whole
mapping first (cid_valid() and the duplicate check) and only writes
scx_cpu_to_cid_tbl/scx_cid_to_cpu_tbl in a second pass, so a failed
override leaves the tables untouched. It also kmemdup()s the input up
front to avoid a concurrent-mutation race.
The patch is against an older cid.c and no longer applies, so no respin
is needed.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-14 23:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-14 2:47 [PATCH] sched_ext: Validate cid override before updating tables zhidao su (Xiaomi)
2026-07-14 23:56 ` Tejun Heo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox