From: menglong8.dong@gmail.com
To: olsajiri@gmail.com
Cc: davem@davemloft.net, dsahern@kernel.org, ast@kernel.org,
daniel@iogearbox.net, andrii@kernel.org, martin.lau@linux.dev,
song@kernel.org, yhs@fb.com, john.fastabend@gmail.com,
kpsingh@kernel.org, sdf@google.com, haoluo@google.com,
jolsa@kernel.org, tglx@linutronix.de, mingo@redhat.com,
bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org,
hpa@zytor.com, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, mykolal@fb.com, shuah@kernel.org,
benbjiang@tencent.com, iii@linux.ibm.com, imagedong@tencent.com,
xukuohai@huawei.com, chantr4@gmail.com, zwisler@google.com,
eddyz87@gmail.com, netdev@vger.kernel.org, bpf@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org
Subject: [PATCH bpf-next v2 4/5] selftests/bpf: rename bpf_fentry_test{7,8,9} to bpf_fentry_test_ptr*
Date: Fri, 2 Jun 2023 14:59:57 +0800 [thread overview]
Message-ID: <20230602065958.2869555-5-imagedong@tencent.com> (raw)
In-Reply-To: <20230602065958.2869555-1-imagedong@tencent.com>
From: Menglong Dong <imagedong@tencent.com>
To make it more clear, let's make the N in bpf_fentry_testN as the count
of target function arguments. Therefore, let's rename
bpf_fentry_test{7,8,9} to bpf_fentry_test_ptr{1,2,3}.
Meanwhile, to stop the checkpatch complaining, move the "noinline" ahead
of "int".
Reviewed-by: Jiang Biao <benbjiang@tencent.com>
Signed-off-by: Menglong Dong <imagedong@tencent.com>
---
net/bpf/test_run.c | 12 +++++-----
.../selftests/bpf/prog_tests/bpf_cookie.c | 24 +++++++++----------
.../bpf/prog_tests/kprobe_multi_test.c | 16 ++++++-------
.../testing/selftests/bpf/progs/fentry_test.c | 16 ++++++-------
.../testing/selftests/bpf/progs/fexit_test.c | 16 ++++++-------
.../selftests/bpf/progs/get_func_ip_test.c | 2 +-
.../selftests/bpf/progs/kprobe_multi.c | 12 +++++-----
.../bpf/progs/verifier_btf_ctx_access.c | 2 +-
.../selftests/bpf/verifier/atomic_fetch_add.c | 4 ++--
9 files changed, 52 insertions(+), 52 deletions(-)
diff --git a/net/bpf/test_run.c b/net/bpf/test_run.c
index 2321bd2f9964..c73f246a706f 100644
--- a/net/bpf/test_run.c
+++ b/net/bpf/test_run.c
@@ -540,17 +540,17 @@ struct bpf_fentry_test_t {
struct bpf_fentry_test_t *a;
};
-int noinline bpf_fentry_test7(struct bpf_fentry_test_t *arg)
+noinline int bpf_fentry_test_ptr1(struct bpf_fentry_test_t *arg)
{
return (long)arg;
}
-int noinline bpf_fentry_test8(struct bpf_fentry_test_t *arg)
+noinline int bpf_fentry_test_ptr2(struct bpf_fentry_test_t *arg)
{
return (long)arg->a;
}
-__bpf_kfunc u32 bpf_fentry_test9(u32 *a)
+__bpf_kfunc u32 bpf_fentry_test_ptr3(u32 *a)
{
return *a;
}
@@ -655,9 +655,9 @@ int bpf_prog_test_run_tracing(struct bpf_prog *prog,
bpf_fentry_test4((void *)7, 8, 9, 10) != 34 ||
bpf_fentry_test5(11, (void *)12, 13, 14, 15) != 65 ||
bpf_fentry_test6(16, (void *)17, 18, 19, (void *)20, 21) != 111 ||
- bpf_fentry_test7((struct bpf_fentry_test_t *)0) != 0 ||
- bpf_fentry_test8(&arg) != 0 ||
- bpf_fentry_test9(&retval) != 0)
+ bpf_fentry_test_ptr1((struct bpf_fentry_test_t *)0) != 0 ||
+ bpf_fentry_test_ptr2(&arg) != 0 ||
+ bpf_fentry_test_ptr3(&retval) != 0)
goto out;
break;
case BPF_MODIFY_RETURN:
diff --git a/tools/testing/selftests/bpf/prog_tests/bpf_cookie.c b/tools/testing/selftests/bpf/prog_tests/bpf_cookie.c
index 26b2d1bffdfd..320003b96c86 100644
--- a/tools/testing/selftests/bpf/prog_tests/bpf_cookie.c
+++ b/tools/testing/selftests/bpf/prog_tests/bpf_cookie.c
@@ -125,9 +125,9 @@ static void kprobe_multi_link_api_subtest(void)
GET_ADDR("bpf_fentry_test4", addrs[2]);
GET_ADDR("bpf_fentry_test5", addrs[3]);
GET_ADDR("bpf_fentry_test6", addrs[4]);
- GET_ADDR("bpf_fentry_test7", addrs[5]);
+ GET_ADDR("bpf_fentry_test_ptr1", addrs[5]);
GET_ADDR("bpf_fentry_test2", addrs[6]);
- GET_ADDR("bpf_fentry_test8", addrs[7]);
+ GET_ADDR("bpf_fentry_test_ptr2", addrs[7]);
#undef GET_ADDR
@@ -136,9 +136,9 @@ static void kprobe_multi_link_api_subtest(void)
cookies[2] = 3; /* bpf_fentry_test4 */
cookies[3] = 4; /* bpf_fentry_test5 */
cookies[4] = 5; /* bpf_fentry_test6 */
- cookies[5] = 6; /* bpf_fentry_test7 */
+ cookies[5] = 6; /* bpf_fentry_test_ptr1 */
cookies[6] = 7; /* bpf_fentry_test2 */
- cookies[7] = 8; /* bpf_fentry_test8 */
+ cookies[7] = 8; /* bpf_fentry_test_ptr2 */
opts.kprobe_multi.addrs = (const unsigned long *) &addrs;
opts.kprobe_multi.cnt = ARRAY_SIZE(addrs);
@@ -154,9 +154,9 @@ static void kprobe_multi_link_api_subtest(void)
cookies[2] = 6; /* bpf_fentry_test4 */
cookies[3] = 5; /* bpf_fentry_test5 */
cookies[4] = 4; /* bpf_fentry_test6 */
- cookies[5] = 3; /* bpf_fentry_test7 */
+ cookies[5] = 3; /* bpf_fentry_test_ptr1 */
cookies[6] = 2; /* bpf_fentry_test2 */
- cookies[7] = 1; /* bpf_fentry_test8 */
+ cookies[7] = 1; /* bpf_fentry_test_ptr2 */
opts.kprobe_multi.flags = BPF_F_KPROBE_MULTI_RETURN;
prog_fd = bpf_program__fd(skel->progs.test_kretprobe);
@@ -185,9 +185,9 @@ static void kprobe_multi_attach_api_subtest(void)
"bpf_fentry_test4",
"bpf_fentry_test5",
"bpf_fentry_test6",
- "bpf_fentry_test7",
+ "bpf_fentry_test_ptr1",
"bpf_fentry_test2",
- "bpf_fentry_test8",
+ "bpf_fentry_test_ptr2",
};
__u64 cookies[8];
@@ -203,9 +203,9 @@ static void kprobe_multi_attach_api_subtest(void)
cookies[2] = 3; /* bpf_fentry_test4 */
cookies[3] = 4; /* bpf_fentry_test5 */
cookies[4] = 5; /* bpf_fentry_test6 */
- cookies[5] = 6; /* bpf_fentry_test7 */
+ cookies[5] = 6; /* bpf_fentry_test_ptr1 */
cookies[6] = 7; /* bpf_fentry_test2 */
- cookies[7] = 8; /* bpf_fentry_test8 */
+ cookies[7] = 8; /* bpf_fentry_test_ptr2 */
opts.syms = syms;
opts.cnt = ARRAY_SIZE(syms);
@@ -221,9 +221,9 @@ static void kprobe_multi_attach_api_subtest(void)
cookies[2] = 6; /* bpf_fentry_test4 */
cookies[3] = 5; /* bpf_fentry_test5 */
cookies[4] = 4; /* bpf_fentry_test6 */
- cookies[5] = 3; /* bpf_fentry_test7 */
+ cookies[5] = 3; /* bpf_fentry_test_ptr1 */
cookies[6] = 2; /* bpf_fentry_test2 */
- cookies[7] = 1; /* bpf_fentry_test8 */
+ cookies[7] = 1; /* bpf_fentry_test_ptr2 */
opts.retprobe = true;
diff --git a/tools/testing/selftests/bpf/prog_tests/kprobe_multi_test.c b/tools/testing/selftests/bpf/prog_tests/kprobe_multi_test.c
index 2173c4bb555e..15c77fe9fc16 100644
--- a/tools/testing/selftests/bpf/prog_tests/kprobe_multi_test.c
+++ b/tools/testing/selftests/bpf/prog_tests/kprobe_multi_test.c
@@ -105,8 +105,8 @@ static void test_link_api_addrs(void)
GET_ADDR("bpf_fentry_test4", addrs[3]);
GET_ADDR("bpf_fentry_test5", addrs[4]);
GET_ADDR("bpf_fentry_test6", addrs[5]);
- GET_ADDR("bpf_fentry_test7", addrs[6]);
- GET_ADDR("bpf_fentry_test8", addrs[7]);
+ GET_ADDR("bpf_fentry_test_ptr1", addrs[6]);
+ GET_ADDR("bpf_fentry_test_ptr2", addrs[7]);
opts.kprobe_multi.addrs = (const unsigned long*) addrs;
opts.kprobe_multi.cnt = ARRAY_SIZE(addrs);
@@ -123,8 +123,8 @@ static void test_link_api_syms(void)
"bpf_fentry_test4",
"bpf_fentry_test5",
"bpf_fentry_test6",
- "bpf_fentry_test7",
- "bpf_fentry_test8",
+ "bpf_fentry_test_ptr1",
+ "bpf_fentry_test_ptr2",
};
opts.kprobe_multi.syms = syms;
@@ -183,8 +183,8 @@ static void test_attach_api_addrs(void)
GET_ADDR("bpf_fentry_test4", addrs[3]);
GET_ADDR("bpf_fentry_test5", addrs[4]);
GET_ADDR("bpf_fentry_test6", addrs[5]);
- GET_ADDR("bpf_fentry_test7", addrs[6]);
- GET_ADDR("bpf_fentry_test8", addrs[7]);
+ GET_ADDR("bpf_fentry_test_ptr1", addrs[6]);
+ GET_ADDR("bpf_fentry_test_ptr2", addrs[7]);
opts.addrs = (const unsigned long *) addrs;
opts.cnt = ARRAY_SIZE(addrs);
@@ -201,8 +201,8 @@ static void test_attach_api_syms(void)
"bpf_fentry_test4",
"bpf_fentry_test5",
"bpf_fentry_test6",
- "bpf_fentry_test7",
- "bpf_fentry_test8",
+ "bpf_fentry_test_ptr1",
+ "bpf_fentry_test_ptr2",
};
opts.syms = syms;
diff --git a/tools/testing/selftests/bpf/progs/fentry_test.c b/tools/testing/selftests/bpf/progs/fentry_test.c
index 52a550d281d9..558a5f1d3d5c 100644
--- a/tools/testing/selftests/bpf/progs/fentry_test.c
+++ b/tools/testing/selftests/bpf/progs/fentry_test.c
@@ -60,20 +60,20 @@ struct bpf_fentry_test_t {
struct bpf_fentry_test_t *a;
};
-__u64 test7_result = 0;
-SEC("fentry/bpf_fentry_test7")
-int BPF_PROG(test7, struct bpf_fentry_test_t *arg)
+__u64 test_ptr1_result = 0;
+SEC("fentry/bpf_fentry_test_ptr1")
+int BPF_PROG(test_ptr1, struct bpf_fentry_test_t *arg)
{
if (!arg)
- test7_result = 1;
+ test_ptr1_result = 1;
return 0;
}
-__u64 test8_result = 0;
-SEC("fentry/bpf_fentry_test8")
-int BPF_PROG(test8, struct bpf_fentry_test_t *arg)
+__u64 test_ptr2_result = 0;
+SEC("fentry/bpf_fentry_test_ptr2")
+int BPF_PROG(test_ptr2, struct bpf_fentry_test_t *arg)
{
if (arg->a == 0)
- test8_result = 1;
+ test_ptr2_result = 1;
return 0;
}
diff --git a/tools/testing/selftests/bpf/progs/fexit_test.c b/tools/testing/selftests/bpf/progs/fexit_test.c
index 8f1ccb7302e1..f57886e6d918 100644
--- a/tools/testing/selftests/bpf/progs/fexit_test.c
+++ b/tools/testing/selftests/bpf/progs/fexit_test.c
@@ -61,20 +61,20 @@ struct bpf_fentry_test_t {
struct bpf_fentry_test *a;
};
-__u64 test7_result = 0;
-SEC("fexit/bpf_fentry_test7")
-int BPF_PROG(test7, struct bpf_fentry_test_t *arg)
+__u64 test_ptr1_result = 0;
+SEC("fexit/bpf_fentry_test_ptr1")
+int BPF_PROG(test_ptr1, struct bpf_fentry_test_t *arg)
{
if (!arg)
- test7_result = 1;
+ test_ptr1_result = 1;
return 0;
}
-__u64 test8_result = 0;
-SEC("fexit/bpf_fentry_test8")
-int BPF_PROG(test8, struct bpf_fentry_test_t *arg)
+__u64 test_ptr2_result = 0;
+SEC("fexit/bpf_fentry_test_ptr2")
+int BPF_PROG(test_ptr2, struct bpf_fentry_test_t *arg)
{
if (!arg->a)
- test8_result = 1;
+ test_ptr2_result = 1;
return 0;
}
diff --git a/tools/testing/selftests/bpf/progs/get_func_ip_test.c b/tools/testing/selftests/bpf/progs/get_func_ip_test.c
index 8559e698b40d..7fffe2b563fa 100644
--- a/tools/testing/selftests/bpf/progs/get_func_ip_test.c
+++ b/tools/testing/selftests/bpf/progs/get_func_ip_test.c
@@ -12,7 +12,7 @@ extern const void bpf_fentry_test3 __ksym;
extern const void bpf_fentry_test4 __ksym;
extern const void bpf_modify_return_test __ksym;
extern const void bpf_fentry_test6 __ksym;
-extern const void bpf_fentry_test7 __ksym;
+extern const void bpf_fentry_test_ptr1 __ksym;
extern bool CONFIG_X86_KERNEL_IBT __kconfig __weak;
diff --git a/tools/testing/selftests/bpf/progs/kprobe_multi.c b/tools/testing/selftests/bpf/progs/kprobe_multi.c
index 9e1ca8e34913..e676fb195595 100644
--- a/tools/testing/selftests/bpf/progs/kprobe_multi.c
+++ b/tools/testing/selftests/bpf/progs/kprobe_multi.c
@@ -12,8 +12,8 @@ extern const void bpf_fentry_test3 __ksym;
extern const void bpf_fentry_test4 __ksym;
extern const void bpf_fentry_test5 __ksym;
extern const void bpf_fentry_test6 __ksym;
-extern const void bpf_fentry_test7 __ksym;
-extern const void bpf_fentry_test8 __ksym;
+extern const void bpf_fentry_test_ptr1 __ksym;
+extern const void bpf_fentry_test_ptr2 __ksym;
int pid = 0;
bool test_cookie = false;
@@ -57,8 +57,8 @@ static void kprobe_multi_check(void *ctx, bool is_return)
SET(kretprobe_test4_result, &bpf_fentry_test4, 6);
SET(kretprobe_test5_result, &bpf_fentry_test5, 5);
SET(kretprobe_test6_result, &bpf_fentry_test6, 4);
- SET(kretprobe_test7_result, &bpf_fentry_test7, 3);
- SET(kretprobe_test8_result, &bpf_fentry_test8, 1);
+ SET(kretprobe_test7_result, &bpf_fentry_test_ptr1, 3);
+ SET(kretprobe_test8_result, &bpf_fentry_test_ptr2, 1);
} else {
SET(kprobe_test1_result, &bpf_fentry_test1, 1);
SET(kprobe_test2_result, &bpf_fentry_test2, 7);
@@ -66,8 +66,8 @@ static void kprobe_multi_check(void *ctx, bool is_return)
SET(kprobe_test4_result, &bpf_fentry_test4, 3);
SET(kprobe_test5_result, &bpf_fentry_test5, 4);
SET(kprobe_test6_result, &bpf_fentry_test6, 5);
- SET(kprobe_test7_result, &bpf_fentry_test7, 6);
- SET(kprobe_test8_result, &bpf_fentry_test8, 8);
+ SET(kprobe_test7_result, &bpf_fentry_test_ptr1, 6);
+ SET(kprobe_test8_result, &bpf_fentry_test_ptr2, 8);
}
#undef SET
diff --git a/tools/testing/selftests/bpf/progs/verifier_btf_ctx_access.c b/tools/testing/selftests/bpf/progs/verifier_btf_ctx_access.c
index a570e48b917a..b90b8a3bf169 100644
--- a/tools/testing/selftests/bpf/progs/verifier_btf_ctx_access.c
+++ b/tools/testing/selftests/bpf/progs/verifier_btf_ctx_access.c
@@ -17,7 +17,7 @@ __naked void btf_ctx_access_accept(void)
" ::: __clobber_all);
}
-SEC("fentry/bpf_fentry_test9")
+SEC("fentry/bpf_fentry_test_ptr3")
__description("btf_ctx_access u32 pointer accept")
__success __retval(0)
__naked void ctx_access_u32_pointer_accept(void)
diff --git a/tools/testing/selftests/bpf/verifier/atomic_fetch_add.c b/tools/testing/selftests/bpf/verifier/atomic_fetch_add.c
index a91de8cd9def..23d70b11ab80 100644
--- a/tools/testing/selftests/bpf/verifier/atomic_fetch_add.c
+++ b/tools/testing/selftests/bpf/verifier/atomic_fetch_add.c
@@ -88,7 +88,7 @@
* kernel function being called. Load first arg into R2.
*/
BPF_LDX_MEM(BPF_DW, BPF_REG_2, BPF_REG_1, 0),
- /* First arg of bpf_fentry_test7 is a pointer to a struct.
+ /* First arg of bpf_fentry_test_ptr1 is a pointer to a struct.
* Attempt to modify that struct. Verifier shouldn't let us
* because it's kernel memory.
*/
@@ -100,7 +100,7 @@
},
.prog_type = BPF_PROG_TYPE_TRACING,
.expected_attach_type = BPF_TRACE_FENTRY,
- .kfunc = "bpf_fentry_test7",
+ .kfunc = "bpf_fentry_test_ptr1",
.result = REJECT,
.errstr = "only read is supported",
},
--
2.40.1
next prev parent reply other threads:[~2023-06-02 7:03 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-02 6:59 [PATCH bpf-next v2 0/5] bpf, x86: allow function arguments up to 14 for TRACING menglong8.dong
2023-06-02 6:59 ` [PATCH bpf-next v2 1/5] bpf: make MAX_BPF_FUNC_ARGS 14 menglong8.dong
2023-06-02 18:17 ` Alexei Starovoitov
2023-06-05 2:49 ` Menglong Dong
2023-06-03 14:13 ` Simon Horman
2023-06-05 2:54 ` Menglong Dong
2023-06-02 6:59 ` [PATCH bpf-next v2 2/5] bpf, x86: allow function arguments up to 14 for TRACING menglong8.dong
2023-06-02 7:40 ` Menglong Dong
2023-06-02 18:31 ` Alexei Starovoitov
2023-06-05 2:40 ` Menglong Dong
2023-06-05 20:10 ` Jiri Olsa
2023-06-06 2:02 ` Menglong Dong
2023-06-02 6:59 ` [PATCH bpf-next v2 3/5] libbpf: make BPF_PROG support 15 function arguments menglong8.dong
2023-06-02 6:59 ` menglong8.dong [this message]
2023-06-02 9:44 ` [PATCH bpf-next v2 4/5] selftests/bpf: rename bpf_fentry_test{7,8,9} to bpf_fentry_test_ptr* Menglong Dong
2023-06-02 6:59 ` [PATCH bpf-next v2 5/5] selftests/bpf: add testcase for FENTRY/FEXIT with 6+ arguments menglong8.dong
2023-06-02 8:24 ` Ilya Leoshkevich
2023-06-02 8:47 ` Menglong Dong
2023-06-02 18:32 ` Alexei Starovoitov
2023-06-05 2:55 ` Menglong Dong
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=20230602065958.2869555-5-imagedong@tencent.com \
--to=menglong8.dong@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=benbjiang@tencent.com \
--cc=bp@alien8.de \
--cc=bpf@vger.kernel.org \
--cc=chantr4@gmail.com \
--cc=daniel@iogearbox.net \
--cc=dave.hansen@linux.intel.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=eddyz87@gmail.com \
--cc=edumazet@google.com \
--cc=haoluo@google.com \
--cc=hpa@zytor.com \
--cc=iii@linux.ibm.com \
--cc=imagedong@tencent.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=mingo@redhat.com \
--cc=mykolal@fb.com \
--cc=netdev@vger.kernel.org \
--cc=olsajiri@gmail.com \
--cc=pabeni@redhat.com \
--cc=sdf@google.com \
--cc=shuah@kernel.org \
--cc=song@kernel.org \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
--cc=xukuohai@huawei.com \
--cc=yhs@fb.com \
--cc=zwisler@google.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;
as well as URLs for NNTP newsgroup(s).