[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<AM6PR03MB508024584949BB503B9BC44399F72@AM6PR03MB5080.eurprd03.prod.outlook.com>
Date: Wed, 5 Feb 2025 19:30:17 +0000
From: Juntong Deng <juntong.deng@...look.com>
To: ast@...nel.org,
daniel@...earbox.net,
john.fastabend@...il.com,
andrii@...nel.org,
martin.lau@...ux.dev,
eddyz87@...il.com,
song@...nel.org,
yonghong.song@...ux.dev,
kpsingh@...nel.org,
sdf@...ichev.me,
haoluo@...gle.com,
jolsa@...nel.org,
memxor@...il.com,
tj@...nel.org,
void@...ifault.com,
arighi@...dia.com,
changwoo@...lia.com
Cc: bpf@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [RFC PATCH bpf-next 5/8] sched_ext: Add filter for scx_kfunc_ids_cpu_release
This patch adds filter for scx_kfunc_ids_cpu_release.
The kfuncs in the scx_kfunc_ids_cpu_release set can be used in
cpu_release and other rq-locked operations.
Signed-off-by: Juntong Deng <juntong.deng@...look.com>
---
kernel/sched/ext.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
index caddcf41e5f1..7f039a32f137 100644
--- a/kernel/sched/ext.c
+++ b/kernel/sched/ext.c
@@ -7026,9 +7026,25 @@ BTF_KFUNCS_START(scx_kfunc_ids_cpu_release)
BTF_ID_FLAGS(func, scx_bpf_reenqueue_local)
BTF_KFUNCS_END(scx_kfunc_ids_cpu_release)
+static int scx_kfunc_ids_cpu_release_filter(const struct bpf_prog *prog, u32 kfunc_id)
+{
+ u32 moff;
+
+ if (!btf_id_set8_contains(&scx_kfunc_ids_cpu_release, kfunc_id) ||
+ prog->aux->st_ops != &bpf_sched_ext_ops)
+ return 0;
+
+ moff = prog->aux->attach_st_ops_member_off;
+ if (moff == offsetof(struct sched_ext_ops, cpu_release))
+ return 0;
+
+ return scx_kfunc_ids_other_rqlocked_filter(prog, kfunc_id);
+}
+
static const struct btf_kfunc_id_set scx_kfunc_set_cpu_release = {
.owner = THIS_MODULE,
.set = &scx_kfunc_ids_cpu_release,
+ .filter = scx_kfunc_ids_cpu_release_filter,
};
__bpf_kfunc_start_defs();
--
2.39.5
Powered by blists - more mailing lists