1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright (c) 2023 Meta Platforms, Inc. and affiliates.
4 * Copyright (c) 2023 David Vernet <dvernet@meta.com>
5 * Copyright (c) 2023 Tejun Heo <tj@kernel.org>
8 #include <scx/common.h>
11 #include "select_cpu_dispatch_dbl_dsp.bpf.skel.h"
14 static enum scx_test_status
setup(void **ctx
)
16 struct select_cpu_dispatch_dbl_dsp
*skel
;
18 skel
= select_cpu_dispatch_dbl_dsp__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_dispatch_dbl_dsp
*skel
= ctx
;
28 struct bpf_link
*link
;
30 link
= bpf_map__attach_struct_ops(skel
->maps
.select_cpu_dispatch_dbl_dsp_ops
);
31 SCX_FAIL_IF(!link
, "Failed to attach scheduler");
35 SCX_EQ(skel
->data
->uei
.kind
, EXIT_KIND(SCX_EXIT_ERROR
));
36 bpf_link__destroy(link
);
41 static void cleanup(void *ctx
)
43 struct select_cpu_dispatch_dbl_dsp
*skel
= ctx
;
45 select_cpu_dispatch_dbl_dsp__destroy(skel
);
48 struct scx_test select_cpu_dispatch_dbl_dsp
= {
49 .name
= "select_cpu_dispatch_dbl_dsp",
50 .description
= "Verify graceful failure if we dispatch twice to a "
51 "DSQ in ops.select_cpu()",
56 REGISTER_SCX_TEST(&select_cpu_dispatch_dbl_dsp
)