[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID:
<AM6PR03MB508061A662E059CE3F76010399C22@AM6PR03MB5080.eurprd03.prod.outlook.com>
Date: Wed, 26 Feb 2025 19:39:56 +0000
From: Juntong Deng <juntong.deng@...look.com>
To: Andrea Righi <arighi@...dia.com>,
Alexei Starovoitov <alexei.starovoitov@...il.com>
Cc: 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 2025/2/26 14:46, Andrea Righi wrote:
> 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
Thanks for telling me this information.
I have sent the version 3 patch series [0], targeting
sched_ext/for-6.15.
[0]:
https://lore.kernel.org/bpf/AM6PR03MB50806070E3D56208DDB8131699C22@AM6PR03MB5080.eurprd03.prod.outlook.com/T/#u
Powered by blists - more mailing lists