All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/1] sched_ext: Add error logging for dsq creation failures
@ 2026-01-09 10:03 George Guo
  2026-01-09 10:11 ` Andrea Righi
  0 siblings, 1 reply; 4+ messages in thread
From: George Guo @ 2026-01-09 10:03 UTC (permalink / raw)
  To: arighi
  Cc: changwoo, dongtai.guo, etsal, guodongtai, linux-kernel, sched-ext,
	tj, void

From: George Guo <guodongtai@kylinos.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()

Signed-off-by: George Guo <guodongtai@kylinos.cn>
---
 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(-)

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(&central_timer, &key);
 	if (!timer)
diff --git a/tools/sched_ext/scx_flatcg.bpf.c b/tools/sched_ext/scx_flatcg.bpf.c
index 43126858b8e4..c216480c3ee0 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);
diff --git a/tools/sched_ext/scx_qmap.bpf.c b/tools/sched_ext/scx_qmap.bpf.c
index df21fad0c438..5fdd83769405 100644
--- a/tools/sched_ext/scx_qmap.bpf.c
+++ b/tools/sched_ext/scx_qmap.bpf.c
@@ -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)
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/1] sched_ext: Add error logging for dsq creation failures
  2026-01-09 10:03 [PATCH v2 1/1] sched_ext: Add error logging for dsq creation failures George Guo
@ 2026-01-09 10:11 ` Andrea Righi
  2026-01-09 10:39   ` George Guo
  0 siblings, 1 reply; 4+ messages in thread
From: Andrea Righi @ 2026-01-09 10:11 UTC (permalink / raw)
  To: George Guo; +Cc: changwoo, etsal, guodongtai, linux-kernel, sched-ext, tj, void

On Fri, Jan 09, 2026 at 06:03:58PM +0800, George Guo wrote:
> From: George Guo <guodongtai@kylinos.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()
> 
> Signed-off-by: George Guo <guodongtai@kylinos.cn>

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

> ---
>  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(-)
> 
> 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(&central_timer, &key);
>  	if (!timer)
> diff --git a/tools/sched_ext/scx_flatcg.bpf.c b/tools/sched_ext/scx_flatcg.bpf.c
> index 43126858b8e4..c216480c3ee0 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);
> diff --git a/tools/sched_ext/scx_qmap.bpf.c b/tools/sched_ext/scx_qmap.bpf.c
> index df21fad0c438..5fdd83769405 100644
> --- a/tools/sched_ext/scx_qmap.bpf.c
> +++ b/tools/sched_ext/scx_qmap.bpf.c
> @@ -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)
> -- 
> 2.49.0
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/1] sched_ext: Add error logging for dsq creation failures
  2026-01-09 10:11 ` Andrea Righi
@ 2026-01-09 10:39   ` George Guo
  2026-01-09 11:07     ` Andrea Righi
  0 siblings, 1 reply; 4+ messages in thread
From: George Guo @ 2026-01-09 10:39 UTC (permalink / raw)
  To: arighi
  Cc: changwoo, dongtai.guo, etsal, guodongtai, linux-kernel, sched-ext,
	tj, void

> 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!

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/1] sched_ext: Add error logging for dsq creation failures
  2026-01-09 10:39   ` George Guo
@ 2026-01-09 11:07     ` Andrea Righi
  0 siblings, 0 replies; 4+ messages in thread
From: Andrea Righi @ 2026-01-09 11:07 UTC (permalink / raw)
  To: George Guo; +Cc: changwoo, etsal, guodongtai, linux-kernel, sched-ext, tj, void

On Fri, Jan 09, 2026 at 06:39:16PM +0800, George Guo wrote:
> > 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.

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-01-09 11:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-09 10:03 [PATCH v2 1/1] sched_ext: Add error logging for dsq creation failures George Guo
2026-01-09 10:11 ` Andrea Righi
2026-01-09 10:39   ` George Guo
2026-01-09 11:07     ` Andrea Righi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.