* [PATCH bpf-next] selftests/bpf: fix usdt_400 test case
@ 2022-05-13 17:37 Andrii Nakryiko
2022-05-13 20:05 ` Yonghong Song
2022-05-13 20:10 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Andrii Nakryiko @ 2022-05-13 17:37 UTC (permalink / raw)
To: bpf, ast, daniel; +Cc: andrii, kernel-team, Mykola Lysenko
usdt_400 test case relies on compiler using the same arg spec for
usdt_400 USDT. This assumption breaks with Clang (Clang generates
different arg specs with varying offsets relative to %rbp), so simplify
this further and hard-code the constant which will guarantee that arg
spec is the same across all 400 inlinings.
Fixes: 630301b0d59d ("selftests/bpf: Add basic USDT selftests")
Reported-by: Mykola Lysenko <mykolal@fb.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
---
tools/testing/selftests/bpf/prog_tests/usdt.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/tools/testing/selftests/bpf/prog_tests/usdt.c b/tools/testing/selftests/bpf/prog_tests/usdt.c
index a71f51bdc08d..5f733d50b0d7 100644
--- a/tools/testing/selftests/bpf/prog_tests/usdt.c
+++ b/tools/testing/selftests/bpf/prog_tests/usdt.c
@@ -190,9 +190,7 @@ __weak void trigger_300_usdts(void)
static void __always_inline f400(int x __attribute__((unused)))
{
- static int y;
-
- STAP_PROBE1(test, usdt_400, y++);
+ STAP_PROBE1(test, usdt_400, 400);
}
/* this time we have 400 different USDT call sites, but they have uniform
@@ -299,7 +297,7 @@ static void subtest_multispec_usdt(void)
trigger_400_usdts();
ASSERT_EQ(bss->usdt_100_called, 400, "usdt_400_called");
- ASSERT_EQ(bss->usdt_100_sum, 399 * 400 / 2, "usdt_400_sum");
+ ASSERT_EQ(bss->usdt_100_sum, 400 * 400, "usdt_400_sum");
cleanup:
test_usdt__destroy(skel);
--
2.30.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH bpf-next] selftests/bpf: fix usdt_400 test case
2022-05-13 17:37 [PATCH bpf-next] selftests/bpf: fix usdt_400 test case Andrii Nakryiko
@ 2022-05-13 20:05 ` Yonghong Song
2022-05-13 20:10 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Yonghong Song @ 2022-05-13 20:05 UTC (permalink / raw)
To: Andrii Nakryiko, bpf, ast, daniel; +Cc: kernel-team, Mykola Lysenko
On 5/13/22 10:37 AM, Andrii Nakryiko wrote:
> usdt_400 test case relies on compiler using the same arg spec for
> usdt_400 USDT. This assumption breaks with Clang (Clang generates
> different arg specs with varying offsets relative to %rbp), so simplify
> this further and hard-code the constant which will guarantee that arg
> spec is the same across all 400 inlinings.
>
> Fixes: 630301b0d59d ("selftests/bpf: Add basic USDT selftests")
> Reported-by: Mykola Lysenko <mykolal@fb.com>
> Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Yonghong Song <yhs@fb.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH bpf-next] selftests/bpf: fix usdt_400 test case
2022-05-13 17:37 [PATCH bpf-next] selftests/bpf: fix usdt_400 test case Andrii Nakryiko
2022-05-13 20:05 ` Yonghong Song
@ 2022-05-13 20:10 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-05-13 20:10 UTC (permalink / raw)
To: Andrii Nakryiko; +Cc: bpf, ast, daniel, kernel-team, mykolal
Hello:
This patch was applied to bpf/bpf-next.git (master)
by Daniel Borkmann <daniel@iogearbox.net>:
On Fri, 13 May 2022 10:37:03 -0700 you wrote:
> usdt_400 test case relies on compiler using the same arg spec for
> usdt_400 USDT. This assumption breaks with Clang (Clang generates
> different arg specs with varying offsets relative to %rbp), so simplify
> this further and hard-code the constant which will guarantee that arg
> spec is the same across all 400 inlinings.
>
> Fixes: 630301b0d59d ("selftests/bpf: Add basic USDT selftests")
> Reported-by: Mykola Lysenko <mykolal@fb.com>
> Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
>
> [...]
Here is the summary with links:
- [bpf-next] selftests/bpf: fix usdt_400 test case
https://git.kernel.org/bpf/bpf-next/c/0d2d2648931b
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-05-13 20:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-13 17:37 [PATCH bpf-next] selftests/bpf: fix usdt_400 test case Andrii Nakryiko
2022-05-13 20:05 ` Yonghong Song
2022-05-13 20:10 ` patchwork-bot+netdevbpf
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.