From: "Alexei Starovoitov" <alexei.starovoitov@gmail.com>
To: "Tiezhu Yang" <yangtiezhu@loongson.cn>,
"Daniel Borkmann" <daniel@iogearbox.net>,
"Andrii Nakryiko" <andrii@kernel.org>,
"Eduard Zingerman" <eddyz87@gmail.com>,
"Kumar Kartikeya Dwivedi" <memxor@gmail.com>
Cc: <bpf@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH bpf-next v2 1/2] selftests/bpf: Move FUNC_REG_ARG_CNT to bpf_arch_regs.h
Date: Sat, 28 Nov 2026 17:53:06 +0000 [thread overview]
Message-ID: <DN71AV8VDTH6.1S8NU2DSICAU0@gmail.com> (raw)
In-Reply-To: <20261128091007.25084-2-yangtiezhu@loongson.cn>
On Sat, Nov 28, 2026 at 01:10 AM Tiezhu Yang <yangtiezhu@loongson.cn> wrote:
> prog_tests/uprobe_autoattach.c and progs/test_uprobe_autoattach.c
> to fix silent assertion skips.
riscv still skips arg6, arg7 and arg8.
> +#elif defined(__TARGET_ARCH_riscv) || defined(__riscv__)
> +#define FUNC_REG_ARG_CNT 8
> +#else
> +/* default to 5 for others */
> +#define FUNC_REG_ARG_CNT 5
> +#endif
User space doesn't need this macro.
The skeleton takes the size of a[] from BTF.
No need for a new header and a Makefile.skel rule.
The diff replaces both patches.
diff --git a/tools/testing/selftests/bpf/prog_tests/uprobe_autoattach.c b/tools/testing/selftests/bpf/prog_tests/uprobe_autoattach.c
index d5b3377..5d9e016 100644
--- a/tools/testing/selftests/bpf/prog_tests/uprobe_autoattach.c
+++ b/tools/testing/selftests/bpf/prog_tests/uprobe_autoattach.c
@@ -17,7 +17,7 @@ void test_uprobe_autoattach(void)
{
const char *devnull_str = "/dev/null";
struct test_uprobe_autoattach *skel;
- int trigger_ret;
+ int trigger_ret, i;
FILE *devnull;
skel = test_uprobe_autoattach__open_and_load();
@@ -49,24 +49,8 @@ void test_uprobe_autoattach(void)
"check_uretprobe_byname2_rc");
ASSERT_EQ(skel->bss->uretprobe_byname2_ran, 4, "check_uretprobe_byname2_ran");
- ASSERT_EQ(skel->bss->a[0], 1, "arg1");
- ASSERT_EQ(skel->bss->a[1], 2, "arg2");
- ASSERT_EQ(skel->bss->a[2], 3, "arg3");
-#if FUNC_REG_ARG_CNT > 3
- ASSERT_EQ(skel->bss->a[3], 4, "arg4");
-#endif
-#if FUNC_REG_ARG_CNT > 4
- ASSERT_EQ(skel->bss->a[4], 5, "arg5");
-#endif
-#if FUNC_REG_ARG_CNT > 5
- ASSERT_EQ(skel->bss->a[5], 6, "arg6");
-#endif
-#if FUNC_REG_ARG_CNT > 6
- ASSERT_EQ(skel->bss->a[6], 7, "arg7");
-#endif
-#if FUNC_REG_ARG_CNT > 7
- ASSERT_EQ(skel->bss->a[7], 8, "arg8");
-#endif
+ for (i = 0; i < ARRAY_SIZE(skel->bss->a); i++)
+ ASSERT_EQ(skel->bss->a[i], i + 1, "arg");
fclose(devnull);
cleanup:
diff --git a/tools/testing/selftests/bpf/progs/bpf_misc.h b/tools/testing/selftests/bpf/progs/bpf_misc.h
index 6b930cb..8a30827 100644
--- a/tools/testing/selftests/bpf/progs/bpf_misc.h
+++ b/tools/testing/selftests/bpf/progs/bpf_misc.h
@@ -270,6 +270,8 @@
#define FUNC_REG_ARG_CNT 6
#elif defined(__TARGET_ARCH_riscv) || defined(__riscv__)
#define FUNC_REG_ARG_CNT 8
+#elif defined(__TARGET_ARCH_loongarch)
+#define FUNC_REG_ARG_CNT 8
#else
/* default to 5 for others */
#define FUNC_REG_ARG_CNT 5
diff --git a/tools/testing/selftests/bpf/progs/test_uprobe_autoattach.c b/tools/testing/selftests/bpf/progs/test_uprobe_autoattach.c
index da4bf89..e59a4b8 100644
--- a/tools/testing/selftests/bpf/progs/test_uprobe_autoattach.c
+++ b/tools/testing/selftests/bpf/progs/test_uprobe_autoattach.c
@@ -20,7 +20,7 @@ int uretprobe_byname2_ran = 0;
int test_pid;
-int a[8];
+int a[FUNC_REG_ARG_CNT];
/* This program cannot auto-attach, but that should not stop other
* programs from attaching.
pw-bot: cr
next prev parent reply other threads:[~2026-11-28 17:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-28 9:10 [PATCH bpf-next v2 0/2] selftests/bpf: Fix uprobe_autoattach test Tiezhu Yang
2026-11-28 9:10 ` [PATCH bpf-next v2 1/2] selftests/bpf: Move FUNC_REG_ARG_CNT to bpf_arch_regs.h Tiezhu Yang
2026-11-28 17:53 ` Alexei Starovoitov [this message]
2026-11-28 9:10 ` [PATCH bpf-next v2 2/2] selftests/bpf: Define FUNC_REG_ARG_CNT for LoongArch Tiezhu Yang
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=DN71AV8VDTH6.1S8NU2DSICAU0@gmail.com \
--to=alexei.starovoitov@gmail.com \
--cc=andrii@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=memxor@gmail.com \
--cc=yangtiezhu@loongson.cn \
/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