sched_ext: Make scx_bpf_cpuperf_set() @cpu arg signed
authorDavid Vernet <void@manifault.com>
Sun, 23 Jun 2024 08:10:36 +0000 (03:10 -0500)
committerTejun Heo <tj@kernel.org>
Sun, 23 Jun 2024 17:53:15 +0000 (07:53 -1000)
The scx_bpf_cpuperf_set() kfunc allows a BPF program to set the relative
performance target of a specified CPU. Commit d86adb4fc065 ("sched_ext: Add
cpuperf support") defined the @cpu argument to be unsigned. Let's update it
to be signed to match the norm for the rest of ext.c and the kernel.

Note that the kfunc declaration of scx_bpf_cpuperf_set() in the
common.bpf.h header in tools/sched_ext already listed the cpu as signed, so
this also fixes the build for tools/sched_ext and the sched_ext selftests
due to kfunc declarations now being emitted in vmlinux.h based on BTF (thus
causing the compiler to error due to observing conflicting types).

Fixes: d86adb4fc065 ("sched_ext: Add cpuperf support")
Signed-off-by: David Vernet <void@manifault.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
kernel/sched/ext.c

index 28f7a4266fde4a9e8548cc8e011b29879d54196d..8e8b44f2c74ad48652246331c51d23f2b1e9aa94 100644 (file)
@@ -5893,7 +5893,7 @@ __bpf_kfunc u32 scx_bpf_cpuperf_cur(s32 cpu)
  * use. Consult hardware and cpufreq documentation for more information. The
  * current performance level can be monitored using scx_bpf_cpuperf_cur().
  */
-__bpf_kfunc void scx_bpf_cpuperf_set(u32 cpu, u32 perf)
+__bpf_kfunc void scx_bpf_cpuperf_set(s32 cpu, u32 perf)
 {
        if (unlikely(perf > SCX_CPUPERF_ONE)) {
                scx_ops_error("Invalid cpuperf target %u for CPU %d", perf, cpu);