All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrea Righi <arighi@nvidia.com>
To: Cui Jian <cjian720@163.com>
Cc: Tejun Heo <tj@kernel.org>, David Vernet <void@manifault.com>,
	Changwoo Min <changwoo@igalia.com>,
	sched-ext@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] sched_ext: Fix stale errno in scx_sub_enable_workfn()
Date: Wed, 22 Jul 2026 15:38:19 +0200	[thread overview]
Message-ID: <amDHy8Dw8c3B1ywg@gpd4> (raw)
In-Reply-To: <20260722100352.36627-1-cjian720@163.com>

Hi Cui,

On Wed, Jul 22, 2026 at 06:03:52PM +0800, Cui Jian wrote:
> The nesting depth check and the cgroup online check in
> scx_sub_enable_workfn() reach err_disable without setting ret, so
> the fallback error added by commit db4e9defd2e8 ("sched_ext: Record
> an error on errno-only sub-enable failure") reports
> "scx_sub_enable() failed (0)".
> 
> This is currently harmless because both paths record their own
> scx_error() first and the first error wins, but it leaves the
> fallback broken for these paths. Set -EINVAL and -ENODEV there
> so the fallback always reports a real errno.
> 
> v2: The validate_ops() path from v1 is already fixed in for-7.3
>     (sub.c already has ret = scx_validate_ops()), so only the two
>     remaining paths are addressed.
> 
> Signed-off-by: Cui Jian <cjian720@163.com>

Looks good to me now.

Reviewed-by: Andrea Righi <arighi@nvidia.com>

Thanks,
-Andrea

> ---
>  kernel/sched/ext/sub.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/kernel/sched/ext/sub.c b/kernel/sched/ext/sub.c
> index d7842a609d96..6da6c91e4287 100644
> --- a/kernel/sched/ext/sub.c
> +++ b/kernel/sched/ext/sub.c
> @@ -1331,6 +1331,7 @@ void scx_sub_enable_workfn(struct kthread_work *work)
>  	if (sch->level >= SCX_SUB_MAX_DEPTH) {
>  		scx_error(sch, "max nesting depth %d violated",
>  			  SCX_SUB_MAX_DEPTH);
> +		ret = -EINVAL;
>  		goto err_disable;
>  	}
>  
> @@ -1378,6 +1379,7 @@ void scx_sub_enable_workfn(struct kthread_work *work)
>  	set_cgroup_sched(sch_cgroup(sch), sch);
>  	if (!(cgrp->self.flags & CSS_ONLINE)) {
>  		scx_error(sch, "cgroup is not online");
> +		ret = -ENODEV;
>  		goto err_unlock_and_disable;
>  	}
>  
> -- 
> 2.34.1
> 

  reply	other threads:[~2026-07-22 13:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-18 20:17 [PATCH] sched_ext: Fix stale errno in scx_sub_enable_workfn() Cui Jian
2026-07-21 17:32 ` Andrea Righi
2026-07-22 10:03   ` [PATCH v2] " Cui Jian
2026-07-22 13:38     ` Andrea Righi [this message]
2026-07-22 18:35     ` Tejun Heo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=amDHy8Dw8c3B1ywg@gpd4 \
    --to=arighi@nvidia.com \
    --cc=changwoo@igalia.com \
    --cc=cjian720@163.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sched-ext@lists.linux.dev \
    --cc=tj@kernel.org \
    --cc=void@manifault.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.