BPF List
 help / color / mirror / Atom feed
* [PATCH bpf-next] selftests/bpf: Fix bpf_cookie and find_vma in nested VM
@ 2024-06-04  7:07 Song Liu
  2024-06-04 18:20 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Song Liu @ 2024-06-04  7:07 UTC (permalink / raw)
  To: bpf; +Cc: kernel-team, andrii, eddyz87, ast, daniel, martin.lau, Song Liu

bpf_cookie and find_vma are flaky in nested VMs, which is used by some CI
systems. It turns out these failures are caused by unreliable perf event
in nested VM. Fix these by:

  1. Use PERF_COUNT_SW_CPU_CLOCK in find_vma;
  2. Increase sample_freq in bpf_cookie.

Signed-off-by: Song Liu <song@kernel.org>
---
 tools/testing/selftests/bpf/prog_tests/bpf_cookie.c | 2 +-
 tools/testing/selftests/bpf/prog_tests/find_vma.c   | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/bpf/prog_tests/bpf_cookie.c b/tools/testing/selftests/bpf/prog_tests/bpf_cookie.c
index 4407ea428e77..070c52c312e5 100644
--- a/tools/testing/selftests/bpf/prog_tests/bpf_cookie.c
+++ b/tools/testing/selftests/bpf/prog_tests/bpf_cookie.c
@@ -451,7 +451,7 @@ static void pe_subtest(struct test_bpf_cookie *skel)
 	attr.type = PERF_TYPE_SOFTWARE;
 	attr.config = PERF_COUNT_SW_CPU_CLOCK;
 	attr.freq = 1;
-	attr.sample_freq = 1000;
+	attr.sample_freq = 10000;
 	pfd = syscall(__NR_perf_event_open, &attr, -1, 0, -1, PERF_FLAG_FD_CLOEXEC);
 	if (!ASSERT_GE(pfd, 0, "perf_fd"))
 		goto cleanup;
diff --git a/tools/testing/selftests/bpf/prog_tests/find_vma.c b/tools/testing/selftests/bpf/prog_tests/find_vma.c
index 5165b38f0e59..f7619e0ade10 100644
--- a/tools/testing/selftests/bpf/prog_tests/find_vma.c
+++ b/tools/testing/selftests/bpf/prog_tests/find_vma.c
@@ -29,8 +29,8 @@ static int open_pe(void)
 
 	/* create perf event */
 	attr.size = sizeof(attr);
-	attr.type = PERF_TYPE_HARDWARE;
-	attr.config = PERF_COUNT_HW_CPU_CYCLES;
+	attr.type = PERF_TYPE_SOFTWARE;
+	attr.config = PERF_COUNT_SW_CPU_CLOCK;
 	attr.freq = 1;
 	attr.sample_freq = 1000;
 	pfd = syscall(__NR_perf_event_open, &attr, 0, -1, -1, PERF_FLAG_FD_CLOEXEC);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH bpf-next] selftests/bpf: Fix bpf_cookie and find_vma in nested VM
  2024-06-04  7:07 [PATCH bpf-next] selftests/bpf: Fix bpf_cookie and find_vma in nested VM Song Liu
@ 2024-06-04 18:20 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-06-04 18:20 UTC (permalink / raw)
  To: Song Liu; +Cc: bpf, kernel-team, andrii, eddyz87, ast, daniel, martin.lau

Hello:

This patch was applied to bpf/bpf-next.git (master)
by Andrii Nakryiko <andrii@kernel.org>:

On Tue,  4 Jun 2024 00:07:00 -0700 you wrote:
> bpf_cookie and find_vma are flaky in nested VMs, which is used by some CI
> systems. It turns out these failures are caused by unreliable perf event
> in nested VM. Fix these by:
> 
>   1. Use PERF_COUNT_SW_CPU_CLOCK in find_vma;
>   2. Increase sample_freq in bpf_cookie.
> 
> [...]

Here is the summary with links:
  - [bpf-next] selftests/bpf: Fix bpf_cookie and find_vma in nested VM
    https://git.kernel.org/bpf/bpf-next/c/61ce0ea7591f

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] 2+ messages in thread

end of thread, other threads:[~2024-06-04 18:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-04  7:07 [PATCH bpf-next] selftests/bpf: Fix bpf_cookie and find_vma in nested VM Song Liu
2024-06-04 18:20 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox