Skip to content

Commit 2e2006c

Browse files
kchuyizhouhtejun
authored andcommitted
sched_ext: Fix the incorrect bpf_list kfunc API in common.bpf.h.
Now BPF only supports bpf_list_push_{front,back}_impl kfunc, not bpf_list_ push_{front,back}. This patch fix this issue. Without this patch, if we use bpf_list kfunc in scx, the BPF verifier would complain: libbpf: extern (func ksym) 'bpf_list_push_back': not found in kernel or module BTFs libbpf: failed to load object 'scx_foo' libbpf: failed to load BPF skeleton 'scx_foo': -EINVAL With this patch, the bpf list kfunc will work as expected. Signed-off-by: Chuyi Zhou <zhouchuyi@bytedance.com> Fixes: 2a52ca7 ("sched_ext: Add scx_simple and scx_example_qmap example schedulers") Signed-off-by: Tejun Heo <tj@kernel.org>
1 parent 0760d62 commit 2e2006c

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

tools/sched_ext/include/scx/common.bpf.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,16 @@ void bpf_obj_drop_impl(void *kptr, void *meta) __ksym;
270270
#define bpf_obj_new(type) ((type *)bpf_obj_new_impl(bpf_core_type_id_local(type), NULL))
271271
#define bpf_obj_drop(kptr) bpf_obj_drop_impl(kptr, NULL)
272272

273-
void bpf_list_push_front(struct bpf_list_head *head, struct bpf_list_node *node) __ksym;
274-
void bpf_list_push_back(struct bpf_list_head *head, struct bpf_list_node *node) __ksym;
273+
int bpf_list_push_front_impl(struct bpf_list_head *head,
274+
struct bpf_list_node *node,
275+
void *meta, __u64 off) __ksym;
276+
#define bpf_list_push_front(head, node) bpf_list_push_front_impl(head, node, NULL, 0)
277+
278+
int bpf_list_push_back_impl(struct bpf_list_head *head,
279+
struct bpf_list_node *node,
280+
void *meta, __u64 off) __ksym;
281+
#define bpf_list_push_back(head, node) bpf_list_push_back_impl(head, node, NULL, 0)
282+
275283
struct bpf_list_node *bpf_list_pop_front(struct bpf_list_head *head) __ksym;
276284
struct bpf_list_node *bpf_list_pop_back(struct bpf_list_head *head) __ksym;
277285
struct bpf_rb_node *bpf_rbtree_remove(struct bpf_rb_root *root,

0 commit comments

Comments
 (0)