sched_ext: Add error logging for dsq creation failures
PATCH v2 1/1 sched_ext: Add error logging for dsq creation failures
From: George Guo <[email protected]>
Add scx_bpf_error() calls when scx_bpf_create_dsq() fails in multiple schedulers to improve debuggability:
- scx_central.bpf.c: central_init()
- scx_flatcg.bpf.c: fcg_cgroup_init() and fcg_init()
- scx_qmap.bpf.c: qmap_init()
--- tools/sched_ext/scx_central.bpf.c | 4 +++- tools/sched_ext/scx_flatcg.bpf.c | 4 +++- tools/sched_ext/scx_qmap.bpf.c | 8 ++++++-- 3 files changed, 12 insertions(+), 4 deletions(-)
tools/sched_ext/scx_central.bpf.c +3 -1
@@ -301,8 +301,10 @@ int BPF_STRUCT_OPS_SLEEPABLE(central_init)int ret; ret =scx_bpf_create_dsq (FALLBACK_DSQ_ID ,-1 ); -if (ret) +if (ret) { +scx_bpf_error ("scx_bpf_create_dsq failed (%d)" , ret);return ret; + } timer =bpf_map_lookup_elem (¢ral_timer, &key);if (!timer)
tools/sched_ext/scx_flatcg.bpf.c +3 -1
@@ -842,8 +842,10 @@ int BPF_STRUCT_OPS_SLEEPABLE(fcg_cgroup_init, struct cgroup *cgrp,* unlikely case that it breaks. */ ret =scx_bpf_create_dsq (cgid,-1 ); -if (ret) +if (ret) { +scx_bpf_error ("scx_bpf_create_dsq failed (%d)" , ret);return ret; + } cgc =bpf_cgrp_storage_get (&cgrp_ctx, cgrp,0 ,BPF_LOCAL_STORAGE_GET_F_CREATE );
tools/sched_ext/scx_qmap.bpf.c +6 -2
@@ -866,12 +866,16 @@ s32 BPF_STRUCT_OPS_SLEEPABLE(qmap_init)print_cpus (); ret =scx_bpf_create_dsq (SHARED_DSQ ,-1 ); -if (ret) +if (ret) { +scx_bpf_error ("scx_bpf_create_dsq failed (%d)" , ret);return ret; + } ret =scx_bpf_create_dsq (HIGHPRI_DSQ ,-1 ); -if (ret) +if (ret) { +scx_bpf_error ("scx_bpf_create_dsq failed (%d)" , ret);return ret; + } timer =bpf_map_lookup_elem (&monitor_timer, &key);if (!timer)
Signature · 1 line
2.49.0
Andrea Righi
reviewerQuoted 10 lines · George Guo
From: George Guo <[email protected]>
Add
scx_bpf_error()calls whenscx_bpf_create_dsq()fails in multiple schedulers to improve debuggability:-
scx_central.bpf.c:central_init()
-scx_flatcg.bpf.c:fcg_cgroup_init()andfcg_init()
-scx_qmap.bpf.c:qmap_init()Signed-off-by George Guo <[email protected]>
Huh? No, we already get an error message both in dmesg and in stdout when scx_bpf_create_dsq() fails, so I don't think this is required.
Are you sure you were not hitting other issues when your scheduler failed to load silently?
Thanks,
-Andrea
Quoted 64 lines
--- tools/sched_ext/scx_central.bpf.c | 4 +++- tools/sched_ext/scx_flatcg.bpf.c | 4 +++- tools/sched_ext/scx_qmap.bpf.c | 8 ++++++-- 3 files changed, 12 insertions(+), 4 deletions(-)tools/sched_ext/scx_central.bpf.c +3
-1@@ -301,8 +301,10 @@ int BPF_STRUCT_OPS_SLEEPABLE(central_init)int ret; ret =scx_bpf_create_dsq (FALLBACK_DSQ_ID ,-1 ); -if (ret) +if (ret) { +scx_bpf_error ("scx_bpf_create_dsq failed (%d)" , ret);return ret; + } timer =bpf_map_lookup_elem (¢ral_timer, &key);if (!timer)tools/sched_ext/scx_flatcg.bpf.c +3
-1@@ -842,8 +842,10 @@ int BPF_STRUCT_OPS_SLEEPABLE(fcg_cgroup_init, struct cgroup *cgrp,* unlikely case that it breaks. */ ret =scx_bpf_create_dsq (cgid,-1 ); -if (ret) +if (ret) { +scx_bpf_error ("scx_bpf_create_dsq failed (%d)" , ret);return ret; + } cgc =bpf_cgrp_storage_get (&cgrp_ctx, cgrp,0 ,BPF_LOCAL_STORAGE_GET_F_CREATE );tools/sched_ext/scx_qmap.bpf.c +6
-2@@ -866,12 +866,16 @@ s32 BPF_STRUCT_OPS_SLEEPABLE(qmap_init)print_cpus (); ret =scx_bpf_create_dsq (SHARED_DSQ ,-1 ); -if (ret) +if (ret) { +scx_bpf_error ("scx_bpf_create_dsq failed (%d)" , ret);return ret; + } ret =scx_bpf_create_dsq (HIGHPRI_DSQ ,-1 ); -if (ret) +if (ret) { +scx_bpf_error ("scx_bpf_create_dsq failed (%d)" , ret);return ret; + } timer =bpf_map_lookup_elem (&monitor_timer, &key);if (!timer)Signature · 1 line
2.49.0
Quoted 5 lines
Huh? No, we already get an error message both in dmesg and in stdout when
scx_bpf_create_dsq()fails, so I don't think this is required.Are you sure you were not hitting other issues when your scheduler failed to load silently?
Hi Andrea,
Here take an instance.
You need add bpf_printk in BPF_STRUCT_OPS_SLEEPABLE(central_init), even with dmesg when central_init fails, as central_init have multiply error return.
Thanks!
Andrea Righi
reviewerQuoted 7 lines · George Guo
Quoted 5 lines
Huh? No, we already get an error message both in dmesg and in stdout when
scx_bpf_create_dsq()fails, so I don't think this is required.Are you sure you were not hitting other issues when your scheduler failed to load silently?
Quoted 5 lines
Hi Andrea,
Here take an instance.
You need addbpf_printkinBPF_STRUCT_OPS_SLEEPABLE(central_init), even with dmesg whencentral_initfails, ascentral_inithave multiply error return.
Ok, then maybe we can add a bit more information to the error message, printing which DSQ failed to be created, for example:
scx_bpf_error("failed to create DSQ %d (%d)", SHARED_DSQ, ret);
This would be more helpful I think.
Thanks,
-Andrea