[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260107062851.82471-1-dongtai.guo@linux.dev>
Date: Wed, 7 Jan 2026 14:28:51 +0800
From: George Guo <dongtai.guo@...ux.dev>
To: tj@...nel.org,
void@...ifault.com,
arighi@...dia.com,
changwoo@...lia.com
Cc: sched-ext@...ts.linux.dev,
linux-kernel@...r.kernel.org,
George Guo <guodongtai@...inos.cn>
Subject: [PATCH 1/1] sched_ext: Add error logging for dsq creation failures
From: George Guo <guodongtai@...inos.cn>
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()
- scx_simple.bpf.c: simple_init()
Signed-off-by: George Guo <guodongtai@...inos.cn>
---
tools/sched_ext/scx_central.bpf.c | 4 +++-
tools/sched_ext/scx_flatcg.bpf.c | 12 ++++++++++--
tools/sched_ext/scx_qmap.bpf.c | 8 ++++++--
tools/sched_ext/scx_simple.bpf.c | 8 +++++++-
4 files changed, 26 insertions(+), 6 deletions(-)
diff --git a/tools/sched_ext/scx_central.bpf.c b/tools/sched_ext/scx_central.bpf.c
index 55df8b798865..1c2376b75b5d 100644
--- a/tools/sched_ext/scx_central.bpf.c
+++ b/tools/sched_ext/scx_central.bpf.c
@@ -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)
diff --git a/tools/sched_ext/scx_flatcg.bpf.c b/tools/sched_ext/scx_flatcg.bpf.c
index 2c720e3ecad5..f7830e14b9af 100644
--- a/tools/sched_ext/scx_flatcg.bpf.c
+++ b/tools/sched_ext/scx_flatcg.bpf.c
@@ -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);
@@ -927,7 +929,13 @@ void BPF_STRUCT_OPS(fcg_cgroup_move, struct task_struct *p,
s32 BPF_STRUCT_OPS_SLEEPABLE(fcg_init)
{
- return scx_bpf_create_dsq(FALLBACK_DSQ, -1);
+ s32 ret;
+
+ ret = scx_bpf_create_dsq(FALLBACK_DSQ, -1);
+ if (ret)
+ scx_bpf_error("scx_bpf_create_dsq failed (%d)", ret);
+
+ return ret;
}
void BPF_STRUCT_OPS(fcg_exit, struct scx_exit_info *ei)
diff --git a/tools/sched_ext/scx_qmap.bpf.c b/tools/sched_ext/scx_qmap.bpf.c
index 3072b593f898..16ed8f867ad9 100644
--- a/tools/sched_ext/scx_qmap.bpf.c
+++ b/tools/sched_ext/scx_qmap.bpf.c
@@ -852,12 +852,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)
diff --git a/tools/sched_ext/scx_simple.bpf.c b/tools/sched_ext/scx_simple.bpf.c
index e6de99dba7db..50e4555459de 100644
--- a/tools/sched_ext/scx_simple.bpf.c
+++ b/tools/sched_ext/scx_simple.bpf.c
@@ -131,7 +131,13 @@ void BPF_STRUCT_OPS(simple_enable, struct task_struct *p)
s32 BPF_STRUCT_OPS_SLEEPABLE(simple_init)
{
- return scx_bpf_create_dsq(SHARED_DSQ, -1);
+ s32 ret;
+
+ ret = scx_bpf_create_dsq(SHARED_DSQ, -1);
+ if (ret)
+ scx_bpf_error("scx_bpf_create_dsq failed (%d)", ret);
+
+ return ret;
}
void BPF_STRUCT_OPS(simple_exit, struct scx_exit_info *ei)
--
2.43.0
Powered by blists - more mailing lists