From: Ihor Solodrai <ihor.solodrai@linux.dev>
To: Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Martin KaFai Lau <martin.lau@linux.dev>,
Eduard Zingerman <eddyz87@gmail.com>
Cc: Mykyta Yatsenko <yatsenko@meta.com>, Tejun Heo <tj@kernel.org>,
Alan Maguire <alan.maguire@oracle.com>,
Benjamin Tissoires <bentiss@kernel.org>,
Jiri Kosina <jikos@kernel.org>, Amery Hung <ameryhung@gmail.com>,
bpf@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-input@vger.kernel.org, sched-ext@lists.linux.dev
Subject: [PATCH bpf-next v3 11/13] selftests/bpf: Migrate struct_ops_assoc test to KF_IMPLICIT_ARGS
Date: Tue, 20 Jan 2026 14:26:36 -0800 [thread overview]
Message-ID: <20260120222638.3976562-12-ihor.solodrai@linux.dev> (raw)
In-Reply-To: <20260120222638.3976562-1-ihor.solodrai@linux.dev>
A test kfunc named bpf_kfunc_multi_st_ops_test_1_impl() is a user of
__prog suffix. Subsequent patch removes __prog support in favor of
KF_IMPLICIT_ARGS, so migrate this kfunc to use implicit argument.
Signed-off-by: Ihor Solodrai <ihor.solodrai@linux.dev>
---
tools/testing/selftests/bpf/progs/struct_ops_assoc.c | 8 ++++----
.../selftests/bpf/progs/struct_ops_assoc_in_timer.c | 4 ++--
.../testing/selftests/bpf/progs/struct_ops_assoc_reuse.c | 6 +++---
tools/testing/selftests/bpf/test_kmods/bpf_testmod.c | 9 ++++-----
.../testing/selftests/bpf/test_kmods/bpf_testmod_kfunc.h | 6 ++++--
5 files changed, 17 insertions(+), 16 deletions(-)
diff --git a/tools/testing/selftests/bpf/progs/struct_ops_assoc.c b/tools/testing/selftests/bpf/progs/struct_ops_assoc.c
index 8f1097903e22..68842e3f936b 100644
--- a/tools/testing/selftests/bpf/progs/struct_ops_assoc.c
+++ b/tools/testing/selftests/bpf/progs/struct_ops_assoc.c
@@ -32,7 +32,7 @@ int BPF_PROG(sys_enter_prog_a, struct pt_regs *regs, long id)
if (!test_pid || task->pid != test_pid)
return 0;
- ret = bpf_kfunc_multi_st_ops_test_1_impl(&args, NULL);
+ ret = bpf_kfunc_multi_st_ops_test_1_assoc(&args);
if (ret != MAP_A_MAGIC)
test_err_a++;
@@ -45,7 +45,7 @@ int syscall_prog_a(void *ctx)
struct st_ops_args args = {};
int ret;
- ret = bpf_kfunc_multi_st_ops_test_1_impl(&args, NULL);
+ ret = bpf_kfunc_multi_st_ops_test_1_assoc(&args);
if (ret != MAP_A_MAGIC)
test_err_a++;
@@ -79,7 +79,7 @@ int BPF_PROG(sys_enter_prog_b, struct pt_regs *regs, long id)
if (!test_pid || task->pid != test_pid)
return 0;
- ret = bpf_kfunc_multi_st_ops_test_1_impl(&args, NULL);
+ ret = bpf_kfunc_multi_st_ops_test_1_assoc(&args);
if (ret != MAP_B_MAGIC)
test_err_b++;
@@ -92,7 +92,7 @@ int syscall_prog_b(void *ctx)
struct st_ops_args args = {};
int ret;
- ret = bpf_kfunc_multi_st_ops_test_1_impl(&args, NULL);
+ ret = bpf_kfunc_multi_st_ops_test_1_assoc(&args);
if (ret != MAP_B_MAGIC)
test_err_b++;
diff --git a/tools/testing/selftests/bpf/progs/struct_ops_assoc_in_timer.c b/tools/testing/selftests/bpf/progs/struct_ops_assoc_in_timer.c
index d5a2ea934284..0bed49e9f217 100644
--- a/tools/testing/selftests/bpf/progs/struct_ops_assoc_in_timer.c
+++ b/tools/testing/selftests/bpf/progs/struct_ops_assoc_in_timer.c
@@ -31,7 +31,7 @@ __noinline static int timer_cb(void *map, int *key, struct bpf_timer *timer)
struct st_ops_args args = {};
recur++;
- timer_test_1_ret = bpf_kfunc_multi_st_ops_test_1_impl(&args, NULL);
+ timer_test_1_ret = bpf_kfunc_multi_st_ops_test_1_assoc(&args);
recur--;
timer_cb_run++;
@@ -64,7 +64,7 @@ int syscall_prog(void *ctx)
struct st_ops_args args = {};
int ret;
- ret = bpf_kfunc_multi_st_ops_test_1_impl(&args, NULL);
+ ret = bpf_kfunc_multi_st_ops_test_1_assoc(&args);
if (ret != MAP_MAGIC)
test_err++;
diff --git a/tools/testing/selftests/bpf/progs/struct_ops_assoc_reuse.c b/tools/testing/selftests/bpf/progs/struct_ops_assoc_reuse.c
index 5bb6ebf5eed4..396b3e58c729 100644
--- a/tools/testing/selftests/bpf/progs/struct_ops_assoc_reuse.c
+++ b/tools/testing/selftests/bpf/progs/struct_ops_assoc_reuse.c
@@ -23,7 +23,7 @@ int BPF_PROG(test_1_a, struct st_ops_args *args)
if (!recur) {
recur++;
- ret = bpf_kfunc_multi_st_ops_test_1_impl(args, NULL);
+ ret = bpf_kfunc_multi_st_ops_test_1_assoc(args);
if (ret != -1)
test_err_a++;
recur--;
@@ -40,7 +40,7 @@ int syscall_prog_a(void *ctx)
struct st_ops_args args = {};
int ret;
- ret = bpf_kfunc_multi_st_ops_test_1_impl(&args, NULL);
+ ret = bpf_kfunc_multi_st_ops_test_1_assoc(&args);
if (ret != MAP_A_MAGIC)
test_err_a++;
@@ -62,7 +62,7 @@ int syscall_prog_b(void *ctx)
struct st_ops_args args = {};
int ret;
- ret = bpf_kfunc_multi_st_ops_test_1_impl(&args, NULL);
+ ret = bpf_kfunc_multi_st_ops_test_1_assoc(&args);
if (ret != MAP_A_MAGIC)
test_err_b++;
diff --git a/tools/testing/selftests/bpf/test_kmods/bpf_testmod.c b/tools/testing/selftests/bpf/test_kmods/bpf_testmod.c
index a996b816ecc4..0d542ba64365 100644
--- a/tools/testing/selftests/bpf/test_kmods/bpf_testmod.c
+++ b/tools/testing/selftests/bpf/test_kmods/bpf_testmod.c
@@ -1140,7 +1140,7 @@ __bpf_kfunc int bpf_kfunc_st_ops_inc10(struct st_ops_args *args)
}
__bpf_kfunc int bpf_kfunc_multi_st_ops_test_1(struct st_ops_args *args, u32 id);
-__bpf_kfunc int bpf_kfunc_multi_st_ops_test_1_impl(struct st_ops_args *args, void *aux_prog);
+__bpf_kfunc int bpf_kfunc_multi_st_ops_test_1_assoc(struct st_ops_args *args, struct bpf_prog_aux *aux);
__bpf_kfunc int bpf_kfunc_implicit_arg(int a, struct bpf_prog_aux *aux);
__bpf_kfunc int bpf_kfunc_implicit_arg_legacy(int a, int b, struct bpf_prog_aux *aux);
@@ -1187,7 +1187,7 @@ BTF_ID_FLAGS(func, bpf_kfunc_st_ops_test_epilogue, KF_SLEEPABLE)
BTF_ID_FLAGS(func, bpf_kfunc_st_ops_test_pro_epilogue, KF_SLEEPABLE)
BTF_ID_FLAGS(func, bpf_kfunc_st_ops_inc10)
BTF_ID_FLAGS(func, bpf_kfunc_multi_st_ops_test_1)
-BTF_ID_FLAGS(func, bpf_kfunc_multi_st_ops_test_1_impl)
+BTF_ID_FLAGS(func, bpf_kfunc_multi_st_ops_test_1_assoc, KF_IMPLICIT_ARGS)
BTF_ID_FLAGS(func, bpf_kfunc_implicit_arg, KF_IMPLICIT_ARGS)
BTF_ID_FLAGS(func, bpf_kfunc_implicit_arg_legacy, KF_IMPLICIT_ARGS)
BTF_ID_FLAGS(func, bpf_kfunc_implicit_arg_legacy_impl)
@@ -1669,13 +1669,12 @@ int bpf_kfunc_multi_st_ops_test_1(struct st_ops_args *args, u32 id)
}
/* Call test_1() of the associated struct_ops map */
-int bpf_kfunc_multi_st_ops_test_1_impl(struct st_ops_args *args, void *aux__prog)
+int bpf_kfunc_multi_st_ops_test_1_assoc(struct st_ops_args *args, struct bpf_prog_aux *aux)
{
- struct bpf_prog_aux *prog_aux = (struct bpf_prog_aux *)aux__prog;
struct bpf_testmod_multi_st_ops *st_ops;
int ret = -1;
- st_ops = (struct bpf_testmod_multi_st_ops *)bpf_prog_get_assoc_struct_ops(prog_aux);
+ st_ops = (struct bpf_testmod_multi_st_ops *)bpf_prog_get_assoc_struct_ops(aux);
if (st_ops)
ret = st_ops->test_1(args);
diff --git a/tools/testing/selftests/bpf/test_kmods/bpf_testmod_kfunc.h b/tools/testing/selftests/bpf/test_kmods/bpf_testmod_kfunc.h
index 2357a0340ffe..225ea30c4e3d 100644
--- a/tools/testing/selftests/bpf/test_kmods/bpf_testmod_kfunc.h
+++ b/tools/testing/selftests/bpf/test_kmods/bpf_testmod_kfunc.h
@@ -161,7 +161,9 @@ void bpf_kfunc_rcu_task_test(struct task_struct *ptr) __ksym;
struct task_struct *bpf_kfunc_ret_rcu_test(void) __ksym;
int *bpf_kfunc_ret_rcu_test_nostruct(int rdonly_buf_size) __ksym;
-int bpf_kfunc_multi_st_ops_test_1(struct st_ops_args *args, u32 id) __ksym;
-int bpf_kfunc_multi_st_ops_test_1_impl(struct st_ops_args *args, void *aux__prog) __ksym;
+#ifndef __KERNEL__
+extern int bpf_kfunc_multi_st_ops_test_1(struct st_ops_args *args, u32 id) __weak __ksym;
+extern int bpf_kfunc_multi_st_ops_test_1_assoc(struct st_ops_args *args) __weak __ksym;
+#endif
#endif /* _BPF_TESTMOD_KFUNC_H */
--
2.52.0
next prev parent reply other threads:[~2026-01-20 22:27 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-20 22:26 [PATCH bpf-next v3 00/13] bpf: Kernel functions with KF_IMPLICIT_ARGS Ihor Solodrai
2026-01-20 22:26 ` [PATCH bpf-next v3 01/13] bpf: Refactor btf_kfunc_id_set_contains Ihor Solodrai
2026-01-20 22:26 ` [PATCH bpf-next v3 02/13] bpf: Introduce struct bpf_kfunc_meta Ihor Solodrai
2026-01-20 22:26 ` [PATCH bpf-next v3 03/13] bpf: Verifier support for KF_IMPLICIT_ARGS Ihor Solodrai
2026-01-21 0:30 ` Alexei Starovoitov
2026-01-21 0:35 ` Ihor Solodrai
2026-01-20 22:26 ` [PATCH bpf-next v3 04/13] resolve_btfids: Introduce finalize_btf() step Ihor Solodrai
2026-01-20 22:26 ` [PATCH bpf-next v3 05/13] resolve_btfids: Support for KF_IMPLICIT_ARGS Ihor Solodrai
2026-01-20 22:26 ` [PATCH bpf-next v3 06/13] selftests/bpf: Add tests " Ihor Solodrai
2026-01-20 22:26 ` [PATCH bpf-next v3 07/13] bpf: Migrate bpf_wq_set_callback_impl() to KF_IMPLICIT_ARGS Ihor Solodrai
2026-01-20 22:55 ` bot+bpf-ci
2026-01-20 23:04 ` Ihor Solodrai
2026-01-20 22:26 ` [PATCH bpf-next v3 08/13] HID: Use bpf_wq_set_callback kernel function Ihor Solodrai
2026-01-20 22:26 ` [PATCH bpf-next v3 09/13] bpf: Migrate bpf_task_work_schedule_* kfuncs to KF_IMPLICIT_ARGS Ihor Solodrai
2026-01-21 0:28 ` Alexei Starovoitov
2026-01-20 22:26 ` [PATCH bpf-next v3 10/13] bpf: Migrate bpf_stream_vprintk() " Ihor Solodrai
2026-01-20 22:26 ` Ihor Solodrai [this message]
2026-01-20 22:26 ` [PATCH bpf-next v3 12/13] bpf: Remove __prog kfunc arg annotation Ihor Solodrai
2026-01-20 22:30 ` [PATCH bpf-next v3 13/13] bpf,docs: Document KF_IMPLICIT_ARGS flag Ihor Solodrai
2026-01-21 0:30 ` [PATCH bpf-next v3 00/13] bpf: Kernel functions with KF_IMPLICIT_ARGS patchwork-bot+netdevbpf
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=20260120222638.3976562-12-ihor.solodrai@linux.dev \
--to=ihor.solodrai@linux.dev \
--cc=alan.maguire@oracle.com \
--cc=ameryhung@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bentiss@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=jikos@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=sched-ext@lists.linux.dev \
--cc=tj@kernel.org \
--cc=yatsenko@meta.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox