From: Andrea Righi <arighi@nvidia.com>
To: Fuyu Zhao <zhaofuyu@vivo.com>
Cc: tj@kernel.org, void@manifault.com, changwoo@igalia.com,
sched-ext@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] tools/sched_ext: Add SCX_OPS_OPEN_OPTS for schedulers using open opts
Date: Mon, 28 Sep 2026 08:26:19 +0200 [thread overview]
Message-ID: <aroIi7aE6wdJH3Tv@gpd4> (raw)
In-Reply-To: <20260928030955.12353-1-zhaofuyu@vivo.com>
On Mon, Sep 28, 2026 at 11:09:55AM +0800, Fuyu Zhao wrote:
> Add SCX_OPS_OPEN_OPTS() and SCX_OPS_CID_OPEN_OPTS() to allow sched_ext
> schedulers to pass bpf_object_open_opts when opening BPF skeletons.
>
> This allows sched_ext schedulers using open opts to retain the existing
> compatibility handling instead of bypassing it.
>
> Signed-off-by: Fuyu Zhao <zhaofuyu@vivo.com>
Reviewed-by: Andrea Righi <arighi@nvidia.com>
Thanks,
-Andrea
> ---
> v3:
> - Add SCX_OPS_CID_OPEN_OPTS() to support open opts for
> SCX_OPS_CID_OPEN() (Tejun).
>
> v2:
> - Link: https://lore.kernel.org/sched-ext/20260923035613.20099-1-zhaofuyu@vivo.com/
> - Make SCX_OPS_OPEN() call SCX_OPS_OPEN_OPTS() with 0 as the opts
> argument (Tejun).
>
> v1:
> - Link: https://lore.kernel.org/sched-ext/20260922031618.2858-1-zhaofuyu@vivo.com/
> ---
> tools/sched_ext/include/scx/compat.h | 16 +++++++++++-----
> 1 file changed, 11 insertions(+), 5 deletions(-)
>
> diff --git a/tools/sched_ext/include/scx/compat.h b/tools/sched_ext/include/scx/compat.h
> index d2e4384df..3ae6e0ef1 100644
> --- a/tools/sched_ext/include/scx/compat.h
> +++ b/tools/sched_ext/include/scx/compat.h
> @@ -177,23 +177,23 @@ static inline long scx_hotplug_seq(void)
> * - v7.1: ops.sub_attach(), ops.sub_detach(), ops.sub_cgroup_id
> * - v7.3: ops.rescue_bandwidth_ppt, ops.rescue_quantum_us
> */
> -#define __SCX_OPS_OPEN(__ops_name, __scx_name, __ops_struct) ({ \
> +#define __SCX_OPS_OPEN(__ops_name, __scx_name, __ops_struct, __opts) ({ \
> struct __scx_name *__oskel; \
> \
> SCX_BUG_ON(!__COMPAT_struct_has_field(__ops_struct, "dump"), \
> __ops_struct ".dump() missing, kernel too old?"); \
> \
> - __oskel = __scx_name##__open(); \
> + __oskel = __scx_name##__open_opts(__opts); \
> SCX_BUG_ON(!__oskel, "Could not open " #__scx_name); \
> __oskel->struct_ops.__ops_name->hotplug_seq = scx_hotplug_seq(); \
> SCX_ENUM_INIT(__oskel); \
> __oskel; \
> })
>
> -#define SCX_OPS_OPEN(__ops_name, __scx_name) ({ \
> +#define SCX_OPS_OPEN_OPTS(__ops_name, __scx_name, __opts) ({ \
> struct __scx_name *__skel; \
> \
> - __skel = __SCX_OPS_OPEN(__ops_name, __scx_name, "sched_ext_ops"); \
> + __skel = __SCX_OPS_OPEN(__ops_name, __scx_name, "sched_ext_ops", __opts); \
> if (__skel->struct_ops.__ops_name->cgroup_set_bandwidth && \
> !__COMPAT_struct_has_field("sched_ext_ops", "cgroup_set_bandwidth")) { \
> fprintf(stderr, "WARNING: kernel doesn't support ops.cgroup_set_bandwidth()\n"); \
> @@ -232,12 +232,18 @@ static inline long scx_hotplug_seq(void)
> __skel; \
> })
>
> +#define SCX_OPS_OPEN(__ops_name, __scx_name) \
> + SCX_OPS_OPEN_OPTS(__ops_name, __scx_name, 0)
> +
> /*
> * Open a cid-form (struct sched_ext_ops_cid) skeleton. The cid form postdates
> * every op the load-time fix-ups above handle, so none of them apply.
> */
> +#define SCX_OPS_CID_OPEN_OPTS(__ops_name, __scx_name, __opts) \
> + __SCX_OPS_OPEN(__ops_name, __scx_name, "sched_ext_ops_cid", __opts)
> +
> #define SCX_OPS_CID_OPEN(__ops_name, __scx_name) \
> - __SCX_OPS_OPEN(__ops_name, __scx_name, "sched_ext_ops_cid")
> + SCX_OPS_CID_OPEN_OPTS(__ops_name, __scx_name, 0)
>
> /*
> * Associate non-struct_ops BPF programs with the scheduler's struct_ops map so
> --
> 2.34.1
>
next prev parent reply other threads:[~2026-09-28 6:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-28 3:09 [PATCH v3] tools/sched_ext: Add SCX_OPS_OPEN_OPTS for schedulers using open opts Fuyu Zhao
2026-09-28 6:26 ` Andrea Righi [this message]
2026-09-28 17:26 ` 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=aroIi7aE6wdJH3Tv@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 \
--cc=zhaofuyu@vivo.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.