Skip to contentSkip to conversation

tools/sched_ext: Add error logging for DSQ creation failures

PATCH In review Cheng-Yang Chou 2 participants 2 messages Mar 18 – Mar 19

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools/sched_ext: Add error logging for DSQ creation failures

Add scx_bpf_error() calls to scx_qmap and dequeue selftests to improve debugging when scx_bpf_create_dsq() fails.

---
 tools/sched_ext/scx_qmap.bpf.c                  | 4 +++-
 tools/testing/selftests/sched_ext/dequeue.bpf.c | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)
tools/sched_ext/scx_qmap.bpf.c +3 -1
index f3587fb709c9..a2412be12763 100644
@@ -919,8 +919,10 @@ s32 BPF_STRUCT_OPS_SLEEPABLE(qmap_init)
 	}
 
 	ret = scx_bpf_create_dsq(LOWPRI_DSQ, -1);
-	if (ret)
+	if (ret) {
+		scx_bpf_error("failed to create DSQ %d (%d)", LOWPRI_DSQ, ret);
 		return ret;
+	}
 
 	timer = bpf_map_lookup_elem(&monitor_timer, &key);
 	if (!timer)
tools/testing/selftests/sched_ext/dequeue.bpf.c +3 -1
index 624e2ccb0688..c7d4fbeeef3d 100644
@@ -364,8 +364,10 @@ s32 BPF_STRUCT_OPS_SLEEPABLE(dequeue_init)
 	s32 ret;
 
 	ret = scx_bpf_create_dsq(SHARED_DSQ, -1);
-	if (ret)
+	if (ret) {
+		scx_bpf_error("failed to create DSQ %d (%d)", SHARED_DSQ, ret);
 		return ret;
+	}
 
 	return 0;
 }
Signature · 1 line
2.48.1
reviewer
#1 lore raw
Quoted 4 lines · Cheng-Yang Chou

Add scx_bpf_error() calls to scx_qmap and dequeue selftests to improve debugging when scx_bpf_create_dsq() fails.

Was this actually useful to you in some way? Did you actually hit DSQ creation failure? If so, how? If not, I don't think it's a useful thing to go around and add error messages to whatever that may fail. In general, I think it'd be far more useful for everyone if the development effort is guided by some actual problems rather than just scanning the source code for trivial things.

Thanks.

Signature · 1 line
tejun