From: Andrea Righi <arighi@nvidia.com>
To: Tejun Heo <tj@kernel.org>
Cc: David Vernet <void@manifault.com>,
Changwoo Min <changwoo@igalia.com>,
linux-kernel@vger.kernel.org, sched-ext@lists.linux.dev
Subject: Re: [PATCH 5/7] sched_ext: Add SCX_EFLAG_INITIALIZED to indicate successful ops.init()
Date: Tue, 23 Sep 2025 10:08:08 +0200 [thread overview]
Message-ID: <aNJVaCvbUoDsMsJJ@gpd4> (raw)
In-Reply-To: <20250922013246.275031-5-tj@kernel.org>
On Sun, Sep 21, 2025 at 03:32:44PM -1000, Tejun Heo wrote:
> ops.exit() may be called even if the loading failed before ops.init()
> finishes successfully. This is because ops.exit() allows rich exit info
> communication. Add SCX_EFLAG_INITIALIZED flag to scx_exit_info.flags to
> indicate whether ops.init() finished successfully.
>
> This enables BPF schedulers to distinguish between exit scenarios and
> handle cleanup appropriately based on initialization state.
>
> Signed-off-by: Tejun Heo <tj@kernel.org>
This can be useful, we could update UEI_REPORT() to show the flag, but we
can also do it later in a separate patch.
Acked-by: Andrea Righi <arighi@nvidia.com>
> ---
> kernel/sched/ext.c | 1 +
> kernel/sched/ext_internal.h | 13 +++++++++++++
> 2 files changed, 14 insertions(+)
>
> diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
> index 5801ac676d59..d131e98156ac 100644
> --- a/kernel/sched/ext.c
> +++ b/kernel/sched/ext.c
> @@ -4554,6 +4554,7 @@ static int scx_enable(struct sched_ext_ops *ops, struct bpf_link *link)
> scx_error(sch, "ops.init() failed (%d)", ret);
> goto err_disable;
> }
> + sch->exit_info->flags |= SCX_EFLAG_INITIALIZED;
> }
>
> for (i = SCX_OPI_CPU_HOTPLUG_BEGIN; i < SCX_OPI_CPU_HOTPLUG_END; i++)
> diff --git a/kernel/sched/ext_internal.h b/kernel/sched/ext_internal.h
> index 1a80d01b1f0c..b3617abed510 100644
> --- a/kernel/sched/ext_internal.h
> +++ b/kernel/sched/ext_internal.h
> @@ -62,6 +62,16 @@ enum scx_exit_code {
> SCX_ECODE_ACT_RESTART = 1LLU << 48,
> };
>
> +enum scx_exit_flags {
> + /*
> + * ops.exit() may be called even if the loading failed before ops.init()
> + * finishes successfully. This is because ops.exit() allows rich exit
> + * info communication. The following flag indicates whether ops.init()
> + * finished successfully.
> + */
> + SCX_EFLAG_INITIALIZED,
> +};
> +
> /*
> * scx_exit_info is passed to ops.exit() to describe why the BPF scheduler is
> * being disabled.
> @@ -73,6 +83,9 @@ struct scx_exit_info {
> /* exit code if gracefully exiting */
> s64 exit_code;
>
> + /* %SCX_EFLAG_* */
> + u64 flags;
> +
> /* textual representation of the above */
> const char *reason;
>
> --
> 2.51.0
>
Thanks,
-Andrea
next prev parent reply other threads:[~2025-09-23 8:08 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-22 1:32 [PATCH 1/7] sched_ext: Use rhashtable_lookup() instead of rhashtable_lookup_fast() Tejun Heo
2025-09-22 1:32 ` [PATCH 2/7] sched_ext: Improve SCX_KF_DISPATCH comment Tejun Heo
2025-09-23 7:20 ` Andrea Righi
2025-09-22 1:32 ` [PATCH 3/7] sched_ext: Fix stray scx_root usage in task_can_run_on_remote_rq() Tejun Heo
2025-09-23 7:22 ` Andrea Righi
2025-09-22 1:32 ` [PATCH 4/7] sched_ext: Use bitfields for boolean warning flags Tejun Heo
2025-09-23 7:45 ` Andrea Righi
2025-09-23 16:00 ` Tejun Heo
2025-09-23 16:58 ` [PATCH v2 " Tejun Heo
2025-09-23 18:45 ` Andrea Righi
2025-09-22 1:32 ` [PATCH 5/7] sched_ext: Add SCX_EFLAG_INITIALIZED to indicate successful ops.init() Tejun Heo
2025-09-23 8:08 ` Andrea Righi [this message]
2025-09-22 1:32 ` [PATCH 6/7] sched_ext: Make qmap dump operation non-destructive Tejun Heo
2025-09-23 8:09 ` Andrea Righi
2025-09-22 1:32 ` [PATCH 7/7] tools/sched_ext: scx_qmap: Make debug output quieter by default Tejun Heo
2025-09-23 8:11 ` Andrea Righi
2025-09-23 7:18 ` [PATCH 1/7] sched_ext: Use rhashtable_lookup() instead of rhashtable_lookup_fast() Andrea Righi
2025-09-23 15:59 ` Tejun Heo
2025-09-23 18:47 ` Andrea Righi
2025-09-23 19:13 ` Tejun Heo
2025-09-24 6:14 ` Andrea Righi
2025-09-24 6:38 ` Tejun Heo
2025-09-24 8:26 ` Andrea Righi
2025-09-24 18:00 ` Tejun Heo
2025-10-22 21:37 ` Andrea Righi
2025-10-22 21:56 ` 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=aNJVaCvbUoDsMsJJ@gpd4 \
--to=arighi@nvidia.com \
--cc=changwoo@igalia.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox