* [PATCH v2] tools/sched_ext: Add SCX_OPS_OPEN_OPTS for schedulers using open opts
@ 2026-09-23 3:56 Fuyu Zhao
2026-09-24 15:50 ` Tejun Heo
0 siblings, 1 reply; 2+ messages in thread
From: Fuyu Zhao @ 2026-09-23 3:56 UTC (permalink / raw)
To: tj; +Cc: void, arighi, changwoo, sched-ext, linux-kernel, Fuyu Zhao
Add SCX_OPS_OPEN_OPTS() to allow sched_ext schedulers to pass
bpf_object_open_opts when opening BPF skeletons.
Using the *_open_opts() interface generated by bpftool directly would
bypass the compatibility checks performed by SCX_OPS_OPEN(). Use
SCX_OPS_OPEN_OPTS() instead to pass open opts while retaining the
existing compatibility handling.
Signed-off-by: Fuyu Zhao <zhaofuyu@vivo.com>
---
v2:
- 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 | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/tools/sched_ext/include/scx/compat.h b/tools/sched_ext/include/scx/compat.h
index d2e4384df..bd471c51f 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,15 @@ 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(__ops_name, __scx_name) \
- __SCX_OPS_OPEN(__ops_name, __scx_name, "sched_ext_ops_cid")
+ __SCX_OPS_OPEN(__ops_name, __scx_name, "sched_ext_ops_cid", 0)
/*
* Associate non-struct_ops BPF programs with the scheduler's struct_ops map so
--
2.34.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v2] tools/sched_ext: Add SCX_OPS_OPEN_OPTS for schedulers using open opts
2026-09-23 3:56 [PATCH v2] tools/sched_ext: Add SCX_OPS_OPEN_OPTS for schedulers using open opts Fuyu Zhao
@ 2026-09-24 15:50 ` Tejun Heo
0 siblings, 0 replies; 2+ messages in thread
From: Tejun Heo @ 2026-09-24 15:50 UTC (permalink / raw)
To: Fuyu Zhao; +Cc: void, arighi, changwoo, sched-ext, linux-kernel
Hello,
On Wed, Sep 23, 2026 at 11:56:13AM +0800, Fuyu Zhao wrote:
> #define SCX_OPS_CID_OPEN(__ops_name, __scx_name) \
> - __SCX_OPS_OPEN(__ops_name, __scx_name, "sched_ext_ops_cid")
> + __SCX_OPS_OPEN(__ops_name, __scx_name, "sched_ext_ops_cid", 0)
Can you add SCX_OPS_CID_OPEN_OPTS() too and have SCX_OPS_CID_OPEN() call it
with 0, the same way as SCX_OPS_OPEN()?
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-24 15:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-23 3:56 [PATCH v2] tools/sched_ext: Add SCX_OPS_OPEN_OPTS for schedulers using open opts Fuyu Zhao
2026-09-24 15:50 ` Tejun Heo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®