Re: [PATCH 10/11] selftests/sched_ext: Add test for sched_ext dl_server

Andrea Righi
2025-10-30T16:57:44Z

Hi Christian,

On Thu, Oct 30, 2025 at 04:49:48PM +0000, Christian Loehle wrote:
> On 10/29/25 19:08, Andrea Righi wrote:
> > Add a selftest to validate the correct behavior of the deadline server
> > for the ext_sched_class.
> >
> > v3: - add a comment to explain the 4% threshold (Emil Tsalapatis)
> > v2: - replaced occurences of CFS in the test with EXT (Joel Fernandes)
> >
> > Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com>
> > Co-developed-by: Joel Fernandes <joelagnelf@nvidia.com>
> > Signed-off-by: Joel Fernandes <joelagnelf@nvidia.com>
> > Signed-off-by: Andrea Righi <arighi@nvidia.com>
> > ---
...
> I'd still prefer something like the below to also test if the
> fair_server stop -> ext_server start -> fair_server start -> ext_server stop
> flow works correctly, but FWIW
> Tested-by: Christian Loehle <christian.loehle@arm.com>

Ack, I'll also run some tests on my side with this applied.

And yes, this definitely improves the selftest. I think we can also apply
it as a follow-up patch later.

Thanks,
-Andrea

>
>
> ------8<------
> @@ -188,19 +188,24 @@ static bool sched_stress_test(void)
> static enum scx_test_status run(void *ctx)
> {
> struct rt_stall *skel = ctx;
> - struct bpf_link *link;
> + struct bpf_link *link = NULL;
> bool res;
>
> - link = bpf_map__attach_struct_ops(skel->maps.rt_stall_ops);
> - SCX_FAIL_IF(!link, "Failed to attach scheduler");
> -
> - res = sched_stress_test();
> -
> - SCX_EQ(skel->data->uei.kind, EXIT_KIND(SCX_EXIT_NONE));
> - bpf_link__destroy(link);
> -
> - if (!res)
> - ksft_exit_fail();
> + for (int i = 0; i < 4; i++) {
> + if (i % 2) {
> + memset(&skel->data->uei, 0, sizeof(skel->data->uei));
> + link = bpf_map__attach_struct_ops(skel->maps.rt_stall_ops);
> + SCX_FAIL_IF(!link, "Failed to attach scheduler");
> + }
> + res = sched_stress_test();
> + if (i % 2) {
> + SCX_EQ(skel->data->uei.kind, EXIT_KIND(SCX_EXIT_NONE));
> + bpf_link__destroy(link);
> + }
> +
> + if (!res)
> + ksft_exit_fail();
> + }
>
> return SCX_TEST_PASS;
> }
>