diff --git a/tools/sched_ext/include/scx/compat.h b/tools/sched_ext/include/scx/compat.h index b6f30e012c61..47ec920f8776 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 df692dc0ccb1..1e0568624ccc 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 1143d5eb389a..5d24ca9c29d9 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 91a2c294a0ac..e10ceb170793 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 b88c058090b6..76d83199545c 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];