Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sched_ext: define missing cfi stubs for sched_ext

`__bpf_ops_sched_ext_ops` was missing the initialization of some struct
attributes. With

https://lore.kernel.org/all/20240722183049.2254692-4-martin.lau@linux.dev/

every single attributes need to be initialized programs (like scx_layered)
will fail to load.

05:26:48 [INFO] libbpf: struct_ops layered: member cgroup_init not found in kernel, skipping it as it's set to zero
05:26:48 [INFO] libbpf: struct_ops layered: member cgroup_exit not found in kernel, skipping it as it's set to zero
05:26:48 [INFO] libbpf: struct_ops layered: member cgroup_prep_move not found in kernel, skipping it as it's set to zero
05:26:48 [INFO] libbpf: struct_ops layered: member cgroup_move not found in kernel, skipping it as it's set to zero
05:26:48 [INFO] libbpf: struct_ops layered: member cgroup_cancel_move not found in kernel, skipping it as it's set to zero
05:26:48 [INFO] libbpf: struct_ops layered: member cgroup_set_weight not found in kernel, skipping it as it's set to zero
05:26:48 [WARN] libbpf: prog 'layered_dump': BPF program load failed: unknown error (-524)
05:26:48 [WARN] libbpf: prog 'layered_dump': -- BEGIN PROG LOAD LOG --
attach to unsupported member dump of struct sched_ext_ops
processed 0 insns (limit 1000000) max_states_per_insn 0 total_states 0 peak_states 0 mark_read 0
-- END PROG LOAD LOG --
05:26:48 [WARN] libbpf: prog 'layered_dump': failed to load: -524
05:26:48 [WARN] libbpf: failed to load object 'bpf_bpf'
05:26:48 [WARN] libbpf: failed to load BPF skeleton 'bpf_bpf': -524
Error: Failed to load BPF program

Signed-off-by: Manu Bretelle <chantr4@gmail.com>
Signed-off-by: Tejun Heo <tj@kernel.org>

authored by

Manu Bretelle and committed by
Tejun Heo
33d031ec 344576fa

+6
+6
kernel/sched/ext.c
··· 5111 5111 static void cpu_offline_stub(s32 cpu) {} 5112 5112 static s32 init_stub(void) { return -EINVAL; } 5113 5113 static void exit_stub(struct scx_exit_info *info) {} 5114 + static void dump_stub(struct scx_dump_ctx *ctx) {} 5115 + static void dump_cpu_stub(struct scx_dump_ctx *ctx, s32 cpu, bool idle) {} 5116 + static void dump_task_stub(struct scx_dump_ctx *ctx, struct task_struct *p) {} 5114 5117 5115 5118 static struct sched_ext_ops __bpf_ops_sched_ext_ops = { 5116 5119 .select_cpu = select_cpu_stub, ··· 5139 5136 .cpu_offline = cpu_offline_stub, 5140 5137 .init = init_stub, 5141 5138 .exit = exit_stub, 5139 + .dump = dump_stub, 5140 + .dump_cpu = dump_cpu_stub, 5141 + .dump_task = dump_task_stub, 5142 5142 }; 5143 5143 5144 5144 static struct bpf_struct_ops bpf_sched_ext_ops = {