selftests/bpf: fix usdt_400 test case
Subsystems (3)
Andrii Nakryiko
maintainerPATCH 1/1 selftests/bpf: fix usdt_400 test case
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.
--- tools/testing/selftests/bpf/prog_tests/usdt.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
tools/testing/selftests/bpf/prog_tests/usdt.c +2 -4
@@ -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);
Signature · 1 line
2.30.2
Quoted 9 lines · Andrii Nakryiko
usdt_400test case relies on compiler using the same arg spec forusdt_400USDT. 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 <[email protected]>Signed-off-by Andrii Nakryiko <[email protected]>
This patch was applied to bpf/bpf-next.git (master) by Daniel Borkmann <[email protected]>:
Hello:
This patch was applied to bpf/bpf-next.git (master) by Daniel Borkmann <[email protected]>:
Quoted 11 lines · On Fri, 13 May 2022 10:37:03 -0700 you wrote:
usdt_400test case relies on compiler using the same arg spec forusdt_400USDT. 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 <[email protected]>Signed-off-by Andrii Nakryiko <[email protected]>[...]
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!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html