1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright (c) 2024 Meta Platforms, Inc. and affiliates.
4 * Copyright (c) 2024 David Vernet <dvernet@meta.com>
5 * Copyright (c) 2024 Tejun Heo <tj@kernel.org>
8 #include <scx/common.h>
11 #include "select_cpu_vtime.bpf.skel.h"
14 static enum scx_test_status
setup(void **ctx
)
16 struct select_cpu_vtime
*skel
;
18 skel
= select_cpu_vtime__open_and_load();
19 SCX_FAIL_IF(!skel
, "Failed to open and load skel");
25 static enum scx_test_status
run(void *ctx
)
27 struct select_cpu_vtime
*skel
= ctx
;
28 struct bpf_link
*link
;
30 SCX_ASSERT(!skel
->bss
->consumed
);
32 link
= bpf_map__attach_struct_ops(skel
->maps
.select_cpu_vtime_ops
);
33 SCX_FAIL_IF(!link
, "Failed to attach scheduler");
37 SCX_ASSERT(skel
->bss
->consumed
);
39 bpf_link__destroy(link
);
44 static void cleanup(void *ctx
)
46 struct select_cpu_vtime
*skel
= ctx
;
48 select_cpu_vtime__destroy(skel
);
51 struct scx_test select_cpu_vtime
= {
52 .name
= "select_cpu_vtime",
53 .description
= "Test doing direct vtime-dispatching from "
54 "ops.select_cpu(), to a non-built-in DSQ",
59 REGISTER_SCX_TEST(&select_cpu_vtime
)