lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z78pVPKTEIh-utFE@gpd3>
Date: Wed, 26 Feb 2025 15:46:44 +0100
From: Andrea Righi <arighi@...dia.com>
To: Alexei Starovoitov <alexei.starovoitov@...il.com>
Cc: Juntong Deng <juntong.deng@...look.com>,
	Alexei Starovoitov <ast@...nel.org>,
	Daniel Borkmann <daniel@...earbox.net>,
	John Fastabend <john.fastabend@...il.com>,
	Andrii Nakryiko <andrii@...nel.org>,
	Martin KaFai Lau <martin.lau@...ux.dev>, Eddy Z <eddyz87@...il.com>,
	Song Liu <song@...nel.org>, Yonghong Song <yonghong.song@...ux.dev>,
	KP Singh <kpsingh@...nel.org>, Stanislav Fomichev <sdf@...ichev.me>,
	Hao Luo <haoluo@...gle.com>, Jiri Olsa <jolsa@...nel.org>,
	Kumar Kartikeya Dwivedi <memxor@...il.com>,
	Tejun Heo <tj@...nel.org>, David Vernet <void@...ifault.com>,
	Changwoo Min <changwoo@...lia.com>, bpf <bpf@...r.kernel.org>,
	LKML <linux-kernel@...r.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

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@...look.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ