diff options
| author | Tejun Heo <tj@kernel.org> | 2026-06-03 15:46:56 -1000 |
|---|---|---|
| committer | Tejun Heo <tj@kernel.org> | 2026-06-03 15:46:56 -1000 |
| commit | 70390da50c30cb22a8b19054f15df1b1bb38904c (patch) | |
| tree | 4e4c0e1f63653e1d9b7c05be487898d158b3f9d3 /kernel | |
| parent | 5839c07e89bbbc0542fcaae9491ae7970cdeebb8 (diff) | |
sched_ext: Make scx_bpf_kick_cid() return s32
Switch scx_bpf_kick_cid() from void to s32 so future cap enforcement can
surface failures. cid interface is introduced in this cycle and has no
external users, so the ABI change is safe. Subsequent patches will add
-EPERM returns when the calling sub-sched lacks the required cap on the
target cid.
v2: Return scx_cid_to_cpu()'s errno instead of -EINVAL. (Andrea)
Signed-off-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Andrea Righi <arighi@nvidia.com>
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/sched/ext.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c index 32ebbc351564..62769abb553a 100644 --- a/kernel/sched/ext.c +++ b/kernel/sched/ext.c @@ -9405,9 +9405,10 @@ __bpf_kfunc void scx_bpf_kick_cpu(s32 cpu, u64 flags, const struct bpf_prog_aux * @flags: %SCX_KICK_* flags * @aux: implicit BPF argument to access bpf_prog_aux hidden from BPF progs * - * cid-addressed equivalent of scx_bpf_kick_cpu(). + * cid-addressed equivalent of scx_bpf_kick_cpu(). Return 0 on success, + * -errno otherwise. */ -__bpf_kfunc void scx_bpf_kick_cid(s32 cid, u64 flags, const struct bpf_prog_aux *aux) +__bpf_kfunc s32 scx_bpf_kick_cid(s32 cid, u64 flags, const struct bpf_prog_aux *aux) { struct scx_sched *sch; s32 cpu; @@ -9415,10 +9416,12 @@ __bpf_kfunc void scx_bpf_kick_cid(s32 cid, u64 flags, const struct bpf_prog_aux guard(rcu)(); sch = scx_prog_sched(aux); if (unlikely(!sch)) - return; + return -ENODEV; cpu = scx_cid_to_cpu(sch, cid); - if (cpu >= 0) - scx_kick_cpu(sch, cpu, flags); + if (cpu < 0) + return cpu; + scx_kick_cpu(sch, cpu, flags); + return 0; } /** |
