From ddd689bba1b93c4896a2aa23d3ca15091301e6b8 Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Fri, 17 May 2024 14:23:34 -1000 Subject: [PATCH] scx: Sync from the SCx repo Receive the skel.attach() fix. --- tools/sched_ext/include/scx/compat.h | 3 ++- tools/sched_ext/scx_central.c | 2 +- tools/sched_ext/scx_flatcg.c | 2 +- tools/sched_ext/scx_qmap.c | 2 +- tools/sched_ext/scx_simple.c | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/tools/sched_ext/include/scx/compat.h b/tools/sched_ext/include/scx/compat.h index b6f30e012c617..47ec920f8776d 100644 --- a/tools/sched_ext/include/scx/compat.h +++ b/tools/sched_ext/include/scx/compat.h @@ -197,8 +197,9 @@ static inline long scx_hotplug_seq(void) SCX_BUG_ON(__scx_name##__load((__skel)), "Failed to load skel"); \ }) -#define SCX_OPS_ATTACH(__skel, __ops_name) ({ \ +#define SCX_OPS_ATTACH(__skel, __ops_name, __scx_name) ({ \ struct bpf_link *__link; \ + SCX_BUG_ON(__scx_name##__attach((__skel)), "Failed to attach skel"); \ __link = bpf_map__attach_struct_ops((__skel)->maps.__ops_name); \ SCX_BUG_ON(!__link, "Failed to attach struct_ops"); \ __link; \ diff --git a/tools/sched_ext/scx_central.c b/tools/sched_ext/scx_central.c index df692dc0ccb10..1e0568624ccc2 100644 --- a/tools/sched_ext/scx_central.c +++ b/tools/sched_ext/scx_central.c @@ -102,7 +102,7 @@ int main(int argc, char **argv) skel->rodata->central_cpu, skel->rodata->nr_cpu_ids - 1); CPU_FREE(cpuset); - link = SCX_OPS_ATTACH(skel, central_ops); + link = SCX_OPS_ATTACH(skel, central_ops, scx_central); if (!skel->data->timer_pinned) printf("WARNING : BPF_F_TIMER_CPU_PIN not available, timer not pinned to central\n"); diff --git a/tools/sched_ext/scx_flatcg.c b/tools/sched_ext/scx_flatcg.c index 1143d5eb389af..5d24ca9c29d9e 100644 --- a/tools/sched_ext/scx_flatcg.c +++ b/tools/sched_ext/scx_flatcg.c @@ -173,7 +173,7 @@ int main(int argc, char **argv) dump_cgrps); SCX_OPS_LOAD(skel, flatcg_ops, scx_flatcg, uei); - link = SCX_OPS_ATTACH(skel, flatcg_ops); + link = SCX_OPS_ATTACH(skel, flatcg_ops, scx_flatcg); while (!exit_req && !UEI_EXITED(skel, uei)) { __u64 acc_stats[FCG_NR_STATS]; diff --git a/tools/sched_ext/scx_qmap.c b/tools/sched_ext/scx_qmap.c index 91a2c294a0ac8..e10ceb170793d 100644 --- a/tools/sched_ext/scx_qmap.c +++ b/tools/sched_ext/scx_qmap.c @@ -121,7 +121,7 @@ int main(int argc, char **argv) fprintf(stderr, "kernel doesn't support DSQ iteration\n"); SCX_OPS_LOAD(skel, qmap_ops, scx_qmap, uei); - link = SCX_OPS_ATTACH(skel, qmap_ops); + link = SCX_OPS_ATTACH(skel, qmap_ops, scx_qmap); while (!exit_req && !UEI_EXITED(skel, uei)) { long nr_enqueued = skel->bss->nr_enqueued; diff --git a/tools/sched_ext/scx_simple.c b/tools/sched_ext/scx_simple.c index b88c058090b6c..76d83199545cb 100644 --- a/tools/sched_ext/scx_simple.c +++ b/tools/sched_ext/scx_simple.c @@ -86,7 +86,7 @@ int main(int argc, char **argv) } SCX_OPS_LOAD(skel, simple_ops, scx_simple, uei); - link = SCX_OPS_ATTACH(skel, simple_ops); + link = SCX_OPS_ATTACH(skel, simple_ops, scx_simple); while (!exit_req && !UEI_EXITED(skel, uei)) { __u64 stats[2];