selftests/sched_ext: fix build after renames in sched_ext API
[ Upstream commit ef7009decc30eb2515a64253791d61b72229c119 ] The selftests are falining to build on current tip of bpf-next and sched_ext [1]. This has broken BPF CI [2] after merge from upstream. Use appropriate function names in the selftests according to the recent changes in the sched_ext API [3]. [1] https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?id=fc39fb56917bb3cb53e99560ca3612a84456ada2 [2] https://github.com/kernel-patches/bpf/actions/runs/11959327258/job/33340923745 [3] https://lore.kernel.org/all/20241109194853.580310-1-tj@kernel.org/ Signed-off-by: Ihor Solodrai <ihor.solodrai@pm.me> Acked-by: Andrea Righi <arighi@nvidia.com> Acked-by: David Vernet <void@manifault.com> Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
621f95fa0b
commit
fc20e87419
@@ -20,7 +20,7 @@ s32 BPF_STRUCT_OPS(ddsp_bogus_dsq_fail_select_cpu, struct task_struct *p,
|
|||||||
* If we dispatch to a bogus DSQ that will fall back to the
|
* If we dispatch to a bogus DSQ that will fall back to the
|
||||||
* builtin global DSQ, we fail gracefully.
|
* builtin global DSQ, we fail gracefully.
|
||||||
*/
|
*/
|
||||||
scx_bpf_dispatch_vtime(p, 0xcafef00d, SCX_SLICE_DFL,
|
scx_bpf_dsq_insert_vtime(p, 0xcafef00d, SCX_SLICE_DFL,
|
||||||
p->scx.dsq_vtime, 0);
|
p->scx.dsq_vtime, 0);
|
||||||
return cpu;
|
return cpu;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ s32 BPF_STRUCT_OPS(ddsp_vtimelocal_fail_select_cpu, struct task_struct *p,
|
|||||||
|
|
||||||
if (cpu >= 0) {
|
if (cpu >= 0) {
|
||||||
/* Shouldn't be allowed to vtime dispatch to a builtin DSQ. */
|
/* Shouldn't be allowed to vtime dispatch to a builtin DSQ. */
|
||||||
scx_bpf_dispatch_vtime(p, SCX_DSQ_LOCAL, SCX_SLICE_DFL,
|
scx_bpf_dsq_insert_vtime(p, SCX_DSQ_LOCAL, SCX_SLICE_DFL,
|
||||||
p->scx.dsq_vtime, 0);
|
p->scx.dsq_vtime, 0);
|
||||||
return cpu;
|
return cpu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ void BPF_STRUCT_OPS(dsp_local_on_dispatch, s32 cpu, struct task_struct *prev)
|
|||||||
|
|
||||||
target = bpf_get_prandom_u32() % nr_cpus;
|
target = bpf_get_prandom_u32() % nr_cpus;
|
||||||
|
|
||||||
scx_bpf_dispatch(p, SCX_DSQ_LOCAL_ON | target, SCX_SLICE_DFL, 0);
|
scx_bpf_dsq_insert(p, SCX_DSQ_LOCAL_ON | target, SCX_SLICE_DFL, 0);
|
||||||
bpf_task_release(p);
|
bpf_task_release(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ void BPF_STRUCT_OPS(enq_select_cpu_fails_enqueue, struct task_struct *p,
|
|||||||
/* Can only call from ops.select_cpu() */
|
/* Can only call from ops.select_cpu() */
|
||||||
scx_bpf_select_cpu_dfl(p, 0, 0, &found);
|
scx_bpf_select_cpu_dfl(p, 0, 0, &found);
|
||||||
|
|
||||||
scx_bpf_dispatch(p, SCX_DSQ_GLOBAL, SCX_SLICE_DFL, enq_flags);
|
scx_bpf_dsq_insert(p, SCX_DSQ_GLOBAL, SCX_SLICE_DFL, enq_flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
SEC(".struct_ops.link")
|
SEC(".struct_ops.link")
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ void BPF_STRUCT_OPS(exit_enqueue, struct task_struct *p, u64 enq_flags)
|
|||||||
if (exit_point == EXIT_ENQUEUE)
|
if (exit_point == EXIT_ENQUEUE)
|
||||||
EXIT_CLEANLY();
|
EXIT_CLEANLY();
|
||||||
|
|
||||||
scx_bpf_dispatch(p, DSQ_ID, SCX_SLICE_DFL, enq_flags);
|
scx_bpf_dsq_insert(p, DSQ_ID, SCX_SLICE_DFL, enq_flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BPF_STRUCT_OPS(exit_dispatch, s32 cpu, struct task_struct *p)
|
void BPF_STRUCT_OPS(exit_dispatch, s32 cpu, struct task_struct *p)
|
||||||
@@ -41,7 +41,7 @@ void BPF_STRUCT_OPS(exit_dispatch, s32 cpu, struct task_struct *p)
|
|||||||
if (exit_point == EXIT_DISPATCH)
|
if (exit_point == EXIT_DISPATCH)
|
||||||
EXIT_CLEANLY();
|
EXIT_CLEANLY();
|
||||||
|
|
||||||
scx_bpf_consume(DSQ_ID);
|
scx_bpf_dsq_move_to_local(DSQ_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BPF_STRUCT_OPS(exit_enable, struct task_struct *p)
|
void BPF_STRUCT_OPS(exit_enable, struct task_struct *p)
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ s32 BPF_STRUCT_OPS(maximal_select_cpu, struct task_struct *p, s32 prev_cpu,
|
|||||||
|
|
||||||
void BPF_STRUCT_OPS(maximal_enqueue, struct task_struct *p, u64 enq_flags)
|
void BPF_STRUCT_OPS(maximal_enqueue, struct task_struct *p, u64 enq_flags)
|
||||||
{
|
{
|
||||||
scx_bpf_dispatch(p, SCX_DSQ_GLOBAL, SCX_SLICE_DFL, enq_flags);
|
scx_bpf_dsq_insert(p, SCX_DSQ_GLOBAL, SCX_SLICE_DFL, enq_flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BPF_STRUCT_OPS(maximal_dequeue, struct task_struct *p, u64 deq_flags)
|
void BPF_STRUCT_OPS(maximal_dequeue, struct task_struct *p, u64 deq_flags)
|
||||||
@@ -28,7 +28,7 @@ void BPF_STRUCT_OPS(maximal_dequeue, struct task_struct *p, u64 deq_flags)
|
|||||||
|
|
||||||
void BPF_STRUCT_OPS(maximal_dispatch, s32 cpu, struct task_struct *prev)
|
void BPF_STRUCT_OPS(maximal_dispatch, s32 cpu, struct task_struct *prev)
|
||||||
{
|
{
|
||||||
scx_bpf_consume(SCX_DSQ_GLOBAL);
|
scx_bpf_dsq_move_to_local(SCX_DSQ_GLOBAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BPF_STRUCT_OPS(maximal_runnable, struct task_struct *p, u64 enq_flags)
|
void BPF_STRUCT_OPS(maximal_runnable, struct task_struct *p, u64 enq_flags)
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ void BPF_STRUCT_OPS(select_cpu_dfl_enqueue, struct task_struct *p,
|
|||||||
}
|
}
|
||||||
scx_bpf_put_idle_cpumask(idle_mask);
|
scx_bpf_put_idle_cpumask(idle_mask);
|
||||||
|
|
||||||
scx_bpf_dispatch(p, SCX_DSQ_GLOBAL, SCX_SLICE_DFL, enq_flags);
|
scx_bpf_dsq_insert(p, SCX_DSQ_GLOBAL, SCX_SLICE_DFL, enq_flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
SEC(".struct_ops.link")
|
SEC(".struct_ops.link")
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ void BPF_STRUCT_OPS(select_cpu_dfl_nodispatch_enqueue, struct task_struct *p,
|
|||||||
saw_local = true;
|
saw_local = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
scx_bpf_dispatch(p, dsq_id, SCX_SLICE_DFL, enq_flags);
|
scx_bpf_dsq_insert(p, dsq_id, SCX_SLICE_DFL, enq_flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 BPF_STRUCT_OPS(select_cpu_dfl_nodispatch_init_task,
|
s32 BPF_STRUCT_OPS(select_cpu_dfl_nodispatch_init_task,
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ s32 BPF_STRUCT_OPS(select_cpu_dispatch_select_cpu, struct task_struct *p,
|
|||||||
cpu = prev_cpu;
|
cpu = prev_cpu;
|
||||||
|
|
||||||
dispatch:
|
dispatch:
|
||||||
scx_bpf_dispatch(p, dsq_id, SCX_SLICE_DFL, 0);
|
scx_bpf_dsq_insert(p, dsq_id, SCX_SLICE_DFL, 0);
|
||||||
return cpu;
|
return cpu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ s32 BPF_STRUCT_OPS(select_cpu_dispatch_bad_dsq_select_cpu, struct task_struct *p
|
|||||||
s32 prev_cpu, u64 wake_flags)
|
s32 prev_cpu, u64 wake_flags)
|
||||||
{
|
{
|
||||||
/* Dispatching to a random DSQ should fail. */
|
/* Dispatching to a random DSQ should fail. */
|
||||||
scx_bpf_dispatch(p, 0xcafef00d, SCX_SLICE_DFL, 0);
|
scx_bpf_dsq_insert(p, 0xcafef00d, SCX_SLICE_DFL, 0);
|
||||||
|
|
||||||
return prev_cpu;
|
return prev_cpu;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ s32 BPF_STRUCT_OPS(select_cpu_dispatch_dbl_dsp_select_cpu, struct task_struct *p
|
|||||||
s32 prev_cpu, u64 wake_flags)
|
s32 prev_cpu, u64 wake_flags)
|
||||||
{
|
{
|
||||||
/* Dispatching twice in a row is disallowed. */
|
/* Dispatching twice in a row is disallowed. */
|
||||||
scx_bpf_dispatch(p, SCX_DSQ_GLOBAL, SCX_SLICE_DFL, 0);
|
scx_bpf_dsq_insert(p, SCX_DSQ_GLOBAL, SCX_SLICE_DFL, 0);
|
||||||
scx_bpf_dispatch(p, SCX_DSQ_GLOBAL, SCX_SLICE_DFL, 0);
|
scx_bpf_dsq_insert(p, SCX_DSQ_GLOBAL, SCX_SLICE_DFL, 0);
|
||||||
|
|
||||||
return prev_cpu;
|
return prev_cpu;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
/*
|
/*
|
||||||
* A scheduler that validates that enqueue flags are properly stored and
|
* A scheduler that validates that enqueue flags are properly stored and
|
||||||
* applied at dispatch time when a task is directly dispatched from
|
* applied at dispatch time when a task is directly dispatched from
|
||||||
* ops.select_cpu(). We validate this by using scx_bpf_dispatch_vtime(), and
|
* ops.select_cpu(). We validate this by using scx_bpf_dsq_insert_vtime(),
|
||||||
* making the test a very basic vtime scheduler.
|
* and making the test a very basic vtime scheduler.
|
||||||
*
|
*
|
||||||
* Copyright (c) 2024 Meta Platforms, Inc. and affiliates.
|
* Copyright (c) 2024 Meta Platforms, Inc. and affiliates.
|
||||||
* Copyright (c) 2024 David Vernet <dvernet@meta.com>
|
* Copyright (c) 2024 David Vernet <dvernet@meta.com>
|
||||||
@@ -47,13 +47,13 @@ s32 BPF_STRUCT_OPS(select_cpu_vtime_select_cpu, struct task_struct *p,
|
|||||||
cpu = prev_cpu;
|
cpu = prev_cpu;
|
||||||
scx_bpf_test_and_clear_cpu_idle(cpu);
|
scx_bpf_test_and_clear_cpu_idle(cpu);
|
||||||
ddsp:
|
ddsp:
|
||||||
scx_bpf_dispatch_vtime(p, VTIME_DSQ, SCX_SLICE_DFL, task_vtime(p), 0);
|
scx_bpf_dsq_insert_vtime(p, VTIME_DSQ, SCX_SLICE_DFL, task_vtime(p), 0);
|
||||||
return cpu;
|
return cpu;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BPF_STRUCT_OPS(select_cpu_vtime_dispatch, s32 cpu, struct task_struct *p)
|
void BPF_STRUCT_OPS(select_cpu_vtime_dispatch, s32 cpu, struct task_struct *p)
|
||||||
{
|
{
|
||||||
if (scx_bpf_consume(VTIME_DSQ))
|
if (scx_bpf_dsq_move_to_local(VTIME_DSQ))
|
||||||
consumed = true;
|
consumed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user