From: Andrea Righi <arighi@nvidia.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: Juntong Deng <juntong.deng@outlook.com>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
John Fastabend <john.fastabend@gmail.com>,
Andrii Nakryiko <andrii@kernel.org>,
Martin KaFai Lau <martin.lau@linux.dev>,
Eddy Z <eddyz87@gmail.com>, Song Liu <song@kernel.org>,
Yonghong Song <yonghong.song@linux.dev>,
KP Singh <kpsingh@kernel.org>,
Stanislav Fomichev <sdf@fomichev.me>, Hao Luo <haoluo@google.com>,
Jiri Olsa <jolsa@kernel.org>,
Kumar Kartikeya Dwivedi <memxor@gmail.com>,
Tejun Heo <tj@kernel.org>, David Vernet <void@manifault.com>,
Changwoo Min <changwoo@igalia.com>, bpf <bpf@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH bpf-next v2 3/5] sched_ext: Add scx_kfunc_ids_ops_context for unified filtering of context-sensitive SCX kfuncs
Date: Wed, 26 Feb 2025 15:46:44 +0100 [thread overview]
Message-ID: <Z78pVPKTEIh-utFE@gpd3> (raw)
In-Reply-To: <CAADnVQKnJCdW5OCs338W4ts_mn6JVw7fD5U6w5o6dtc4DSJQrA@mail.gmail.com>
On Tue, Feb 25, 2025 at 09:24:27PM -0800, Alexei Starovoitov wrote:
> On Fri, Feb 14, 2025 at 12:13 PM Juntong Deng <juntong.deng@outlook.com> wrote:
> > +static int scx_kfunc_ids_ops_context_filter(const struct bpf_prog *prog, u32 kfunc_id)
> > +{
> > + u32 moff, flags;
> > +
> > + if (!btf_id_set8_contains(&scx_kfunc_ids_ops_context, kfunc_id))
> > + return 0;
> > +
> > + if (prog->type == BPF_PROG_TYPE_SYSCALL &&
> > + btf_id_set8_contains(&scx_kfunc_ids_unlocked, kfunc_id))
> > + return 0;
> > +
> > + if (prog->type == BPF_PROG_TYPE_STRUCT_OPS &&
> > + prog->aux->st_ops != &bpf_sched_ext_ops)
> > + return 0;
> > +
> > + /* prog->type == BPF_PROG_TYPE_STRUCT_OPS && prog->aux->st_ops == &bpf_sched_ext_ops*/
> > +
> > + moff = prog->aux->attach_st_ops_member_off;
> > + flags = scx_ops_context_flags[SCX_MOFF_IDX(moff)];
> > +
> > + if ((flags & SCX_OPS_KF_UNLOCKED) &&
> > + btf_id_set8_contains(&scx_kfunc_ids_unlocked, kfunc_id))
> > + return 0;
> > +
> > + if ((flags & SCX_OPS_KF_CPU_RELEASE) &&
> > + btf_id_set8_contains(&scx_kfunc_ids_cpu_release, kfunc_id))
> > + return 0;
> > +
> > + if ((flags & SCX_OPS_KF_DISPATCH) &&
> > + btf_id_set8_contains(&scx_kfunc_ids_dispatch, kfunc_id))
> > + return 0;
> > +
> > + if ((flags & SCX_OPS_KF_ENQUEUE) &&
> > + btf_id_set8_contains(&scx_kfunc_ids_enqueue_dispatch, kfunc_id))
> > + return 0;
> > +
> > + if ((flags & SCX_OPS_KF_SELECT_CPU) &&
> > + btf_id_set8_contains(&scx_kfunc_ids_select_cpu, kfunc_id))
> > + return 0;
> > +
> > + return -EACCES;
> > +}
>
> This looks great.
> Very good cleanup and run-time speed up.
> Please resend without RFC tag, so sched-ext folks can review.
>
> From bpf pov, pls add my Ack to patch 1 when you respin.
> The set can probably target sched-ext tree too.
Thanks for this work Juntong! I'll do a more detailed review later (with
this one or the next patch set without the RFC).
Just a heads up, if you decide to target the sched-ext tree, you may want
to consider sched_ext/for-6.15, since we moved some code around (no big
changes, but some functions are now in ext_idle.c):
https://git.kernel.org/pub/scm/linux/kernel/git/tj/sched_ext.git/log/?h=for-6.15
Thanks!
-Andrea
next prev parent reply other threads:[~2025-02-26 14:46 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-14 20:03 [RFC PATCH bpf-next v2 0/5] bpf, sched_ext: Make kfunc filters support struct_ops context to reduce runtime overhead Juntong Deng
2025-02-14 20:09 ` [RFC PATCH bpf-next v2 1/5] bpf: Add struct_ops context information to struct bpf_prog_aux Juntong Deng
2025-02-14 20:09 ` [RFC PATCH bpf-next v2 2/5] sched_ext: Declare context-sensitive kfunc groups that can be used by different SCX operations Juntong Deng
2025-02-14 20:09 ` [RFC PATCH bpf-next v2 3/5] sched_ext: Add scx_kfunc_ids_ops_context for unified filtering of context-sensitive SCX kfuncs Juntong Deng
2025-02-26 5:24 ` Alexei Starovoitov
2025-02-26 14:46 ` Andrea Righi [this message]
2025-02-26 19:39 ` Juntong Deng
2025-02-14 20:09 ` [RFC PATCH bpf-next v2 4/5] sched_ext: Removed mask-based runtime restrictions on calling kfuncs in different contexts Juntong Deng
2025-02-14 20:09 ` [RFC PATCH bpf-next v2 5/5] selftests/sched_ext: Update enq_select_cpu_fails to adapt to struct_ops context filter Juntong Deng
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=Z78pVPKTEIh-utFE@gpd3 \
--to=arighi@nvidia.com \
--cc=alexei.starovoitov@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=changwoo@igalia.com \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=juntong.deng@outlook.com \
--cc=kpsingh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=sdf@fomichev.me \
--cc=song@kernel.org \
--cc=tj@kernel.org \
--cc=void@manifault.com \
--cc=yonghong.song@linux.dev \
/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.