mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 06:44:00 -04:00
ops.cpu_acquire/release() are deprecated by commit a3f5d48222
("sched_ext: Allow scx_bpf_reenqueue_local() to be called from
anywhere") in favor of handling CPU preemption via the sched_switch
tracepoint.
In the maximal selftest, replace the cpu_acquire/release stubs with a
minimal sched_switch TP program. Attach all non-struct_ops programs
(including the new TP) via maximal__attach() after disabling auto-attach
for the maximal_ops struct_ops map, which is managed manually in run().
Apply the same fix to reload_loop, which also uses the maximal skeleton.
Signed-off-by: Cheng-Yang Chou <yphbchou0911@gmail.com>
Reviewed-by: Andrea Righi <arighi@nvidia.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
58 lines
1.2 KiB
C
58 lines
1.2 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/*
|
|
* Copyright (c) 2024 Meta Platforms, Inc. and affiliates.
|
|
* Copyright (c) 2024 David Vernet <dvernet@meta.com>
|
|
*/
|
|
#include <bpf/bpf.h>
|
|
#include <scx/common.h>
|
|
#include <sys/wait.h>
|
|
#include <unistd.h>
|
|
#include "maximal.bpf.skel.h"
|
|
#include "scx_test.h"
|
|
|
|
static enum scx_test_status setup(void **ctx)
|
|
{
|
|
struct maximal *skel;
|
|
|
|
skel = maximal__open();
|
|
SCX_FAIL_IF(!skel, "Failed to open");
|
|
SCX_ENUM_INIT(skel);
|
|
SCX_FAIL_IF(maximal__load(skel), "Failed to load skel");
|
|
|
|
bpf_map__set_autoattach(skel->maps.maximal_ops, false);
|
|
SCX_FAIL_IF(maximal__attach(skel), "Failed to attach skel");
|
|
|
|
*ctx = skel;
|
|
|
|
return SCX_TEST_PASS;
|
|
}
|
|
|
|
static enum scx_test_status run(void *ctx)
|
|
{
|
|
struct maximal *skel = ctx;
|
|
struct bpf_link *link;
|
|
|
|
link = bpf_map__attach_struct_ops(skel->maps.maximal_ops);
|
|
SCX_FAIL_IF(!link, "Failed to attach scheduler");
|
|
|
|
bpf_link__destroy(link);
|
|
|
|
return SCX_TEST_PASS;
|
|
}
|
|
|
|
static void cleanup(void *ctx)
|
|
{
|
|
struct maximal *skel = ctx;
|
|
|
|
maximal__destroy(skel);
|
|
}
|
|
|
|
struct scx_test maximal = {
|
|
.name = "maximal",
|
|
.description = "Verify we can load a scheduler with every callback defined",
|
|
.setup = setup,
|
|
.run = run,
|
|
.cleanup = cleanup,
|
|
};
|
|
REGISTER_SCX_TEST(&maximal)
|