BPF List
 help / color / mirror / Atom feed
* [PATCH bpf-next 0/3] Fix a few selftest failure due to 64K page
@ 2026-01-13  6:10 Yonghong Song
  2026-01-13  6:10 ` [PATCH bpf-next 1/3] selftests/bpf: Fix dmabuf_iter/lots_of_buffers failure with " Yonghong Song
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Yonghong Song @ 2026-01-13  6:10 UTC (permalink / raw)
  To: bpf
  Cc: Alexei Starovoitov, Andrii Nakryiko, Daniel Borkmann, kernel-team,
	Martin KaFai Lau

Fix a few arm64 selftest failures due to 64K page. Please see each
indvidual patch for why the test failed and how the test gets fixed.

Yonghong Song (3):
  selftests/bpf: Fix dmabuf_iter/lots_of_buffers failure with 64K page
  selftests/bpf: Fix sk_bypass_prot_mem failure with 64K page
  selftests/bpf: Fix verifier_arena_globals1 failure with 64K page

 tools/testing/selftests/bpf/prog_tests/dmabuf_iter.c       | 2 +-
 .../testing/selftests/bpf/prog_tests/sk_bypass_prot_mem.c  | 7 ++++++-
 .../testing/selftests/bpf/progs/verifier_arena_globals1.c  | 2 +-
 3 files changed, 8 insertions(+), 3 deletions(-)

-- 
2.47.3


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

* [PATCH bpf-next 1/3] selftests/bpf: Fix dmabuf_iter/lots_of_buffers failure with 64K page
  2026-01-13  6:10 [PATCH bpf-next 0/3] Fix a few selftest failure due to 64K page Yonghong Song
@ 2026-01-13  6:10 ` Yonghong Song
  2026-01-13  6:10 ` [PATCH bpf-next 2/3] selftests/bpf: Fix sk_bypass_prot_mem " Yonghong Song
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Yonghong Song @ 2026-01-13  6:10 UTC (permalink / raw)
  To: bpf
  Cc: Alexei Starovoitov, Andrii Nakryiko, Daniel Borkmann, kernel-team,
	Martin KaFai Lau, T.J. Mercier

On arm64 with 64K page , I observed the following test failure:
  ...
  subtest_dmabuf_iter_check_lots_of_buffers:FAIL:total_bytes_read unexpected total_bytes_read:
      actual 4696 <= expected 65536
  #97/3    dmabuf_iter/lots_of_buffers:FAIL

With 4K page on x86, the total_bytes_read is 4593.
With 64K page on arm64, the total_byte_read is 4696.

In progs/dmabuf_iter.c, for each iteration, the output is
  BPF_SEQ_PRINTF(seq, "%lu\n%llu\n%s\n%s\n", inode, size, name, exporter);

The only difference between 4K and 64K page is 'size' in
the above BPF_SEQ_PRINTF. The 4K page will output '4096' and
the 64K page will output '65536'. So the total_bytes_read with 64K page
is slighter greater than 4K page.

Adjusting the total_bytes_read from 65536 to 4096 fixed the issue.

Cc: T.J. Mercier <tjmercier@google.com>
Signed-off-by: Yonghong Song <yonghong.song@linux.dev>
---
 tools/testing/selftests/bpf/prog_tests/dmabuf_iter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/bpf/prog_tests/dmabuf_iter.c b/tools/testing/selftests/bpf/prog_tests/dmabuf_iter.c
index e442be9dde7e..fb2cea710db3 100644
--- a/tools/testing/selftests/bpf/prog_tests/dmabuf_iter.c
+++ b/tools/testing/selftests/bpf/prog_tests/dmabuf_iter.c
@@ -233,7 +233,7 @@ static void subtest_dmabuf_iter_check_lots_of_buffers(struct dmabuf_iter *skel)
 	while ((bytes_read = read(iter_fd, buf, sizeof(buf))) > 0)
 		total_bytes_read += bytes_read;
 
-	ASSERT_GT(total_bytes_read, getpagesize(), "total_bytes_read");
+	ASSERT_GT(total_bytes_read, 4096, "total_bytes_read");
 
 	close(iter_fd);
 }
-- 
2.47.3


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

* [PATCH bpf-next 2/3] selftests/bpf: Fix sk_bypass_prot_mem failure with 64K page
  2026-01-13  6:10 [PATCH bpf-next 0/3] Fix a few selftest failure due to 64K page Yonghong Song
  2026-01-13  6:10 ` [PATCH bpf-next 1/3] selftests/bpf: Fix dmabuf_iter/lots_of_buffers failure with " Yonghong Song
@ 2026-01-13  6:10 ` Yonghong Song
  2026-01-13  6:10 ` [PATCH bpf-next 3/3] selftests/bpf: Fix verifier_arena_globals1 " Yonghong Song
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Yonghong Song @ 2026-01-13  6:10 UTC (permalink / raw)
  To: bpf
  Cc: Alexei Starovoitov, Andrii Nakryiko, Daniel Borkmann, kernel-team,
	Martin KaFai Lau, Kuniyuki Iwashima

The current selftest sk_bypass_prot_mem only supports 4K page.
When running with 64K page on arm64, the following failure happens:
  ...
  check_bypass:FAIL:no bypass unexpected no bypass: actual 3 <= expected 32
  ...
  #385/1   sk_bypass_prot_mem/TCP  :FAIL
  ...
  check_bypass:FAIL:no bypass unexpected no bypass: actual 4 <= expected 32
  ...
  #385/2   sk_bypass_prot_mem/UDP  :FAIL
  ...

Adding support to 64K page as well fixed the failure.

Cc: Kuniyuki Iwashima <kuniyu@google.com>
Signed-off-by: Yonghong Song <yonghong.song@linux.dev>
---
 .../testing/selftests/bpf/prog_tests/sk_bypass_prot_mem.c  | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/bpf/prog_tests/sk_bypass_prot_mem.c b/tools/testing/selftests/bpf/prog_tests/sk_bypass_prot_mem.c
index e4940583924b..e2c867fd5244 100644
--- a/tools/testing/selftests/bpf/prog_tests/sk_bypass_prot_mem.c
+++ b/tools/testing/selftests/bpf/prog_tests/sk_bypass_prot_mem.c
@@ -5,9 +5,14 @@
 #include "sk_bypass_prot_mem.skel.h"
 #include "network_helpers.h"
 
+#ifndef PAGE_SIZE
+#include <unistd.h>
+#define PAGE_SIZE getpagesize()
+#endif
+
 #define NR_PAGES	32
 #define NR_SOCKETS	2
-#define BUF_TOTAL	(NR_PAGES * 4096 / NR_SOCKETS)
+#define BUF_TOTAL	(NR_PAGES * PAGE_SIZE / NR_SOCKETS)
 #define BUF_SINGLE	1024
 #define NR_SEND		(BUF_TOTAL / BUF_SINGLE)
 
-- 
2.47.3


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

* [PATCH bpf-next 3/3] selftests/bpf: Fix verifier_arena_globals1 failure with 64K page
  2026-01-13  6:10 [PATCH bpf-next 0/3] Fix a few selftest failure due to 64K page Yonghong Song
  2026-01-13  6:10 ` [PATCH bpf-next 1/3] selftests/bpf: Fix dmabuf_iter/lots_of_buffers failure with " Yonghong Song
  2026-01-13  6:10 ` [PATCH bpf-next 2/3] selftests/bpf: Fix sk_bypass_prot_mem " Yonghong Song
@ 2026-01-13  6:10 ` Yonghong Song
  2026-01-13 17:04   ` Emil Tsalapatis
  2026-01-13 10:32 ` [PATCH bpf-next 0/3] Fix a few selftest failure due to " Alan Maguire
  2026-01-13 18:17 ` patchwork-bot+netdevbpf
  4 siblings, 1 reply; 7+ messages in thread
From: Yonghong Song @ 2026-01-13  6:10 UTC (permalink / raw)
  To: bpf
  Cc: Alexei Starovoitov, Andrii Nakryiko, Daniel Borkmann, kernel-team,
	Martin KaFai Lau, Emil Tsalapatis

With 64K page on arm64, verifier_arena_globals1 failed like below:
  ...
  libbpf: map 'arena': failed to create: -E2BIG
  ...
  #509/1   verifier_arena_globals1/check_reserve1:FAIL
  ...

For 64K page, if the number of arena pages is (1UL << 20), the total
memory will exceed 4G and this will cause map creation failure.
Adjusting ARENA_PAGES based on the actual page size fixed the problem.

Cc: Emil Tsalapatis <emil@etsalapatis.com>
Signed-off-by: Yonghong Song <yonghong.song@linux.dev>
---
 tools/testing/selftests/bpf/progs/verifier_arena_globals1.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/bpf/progs/verifier_arena_globals1.c b/tools/testing/selftests/bpf/progs/verifier_arena_globals1.c
index 14afef3d6442..83182ddbfb95 100644
--- a/tools/testing/selftests/bpf/progs/verifier_arena_globals1.c
+++ b/tools/testing/selftests/bpf/progs/verifier_arena_globals1.c
@@ -9,7 +9,7 @@
 #include "bpf_arena_common.h"
 #include "bpf_misc.h"
 
-#define ARENA_PAGES (1UL<< (32 - 12))
+#define ARENA_PAGES (1UL<< (32 - __builtin_ffs(__PAGE_SIZE) + 1))
 #define GLOBAL_PAGES (16)
 
 struct {
-- 
2.47.3


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

* Re: [PATCH bpf-next 0/3] Fix a few selftest failure due to 64K page
  2026-01-13  6:10 [PATCH bpf-next 0/3] Fix a few selftest failure due to 64K page Yonghong Song
                   ` (2 preceding siblings ...)
  2026-01-13  6:10 ` [PATCH bpf-next 3/3] selftests/bpf: Fix verifier_arena_globals1 " Yonghong Song
@ 2026-01-13 10:32 ` Alan Maguire
  2026-01-13 18:17 ` patchwork-bot+netdevbpf
  4 siblings, 0 replies; 7+ messages in thread
From: Alan Maguire @ 2026-01-13 10:32 UTC (permalink / raw)
  To: Yonghong Song, bpf
  Cc: Alexei Starovoitov, Andrii Nakryiko, Daniel Borkmann, kernel-team,
	Martin KaFai Lau

On 13/01/2026 06:10, Yonghong Song wrote:
> Fix a few arm64 selftest failures due to 64K page. Please see each
> indvidual patch for why the test failed and how the test gets fixed.
> 
> Yonghong Song (3):
>   selftests/bpf: Fix dmabuf_iter/lots_of_buffers failure with 64K page
>   selftests/bpf: Fix sk_bypass_prot_mem failure with 64K page
>   selftests/bpf: Fix verifier_arena_globals1 failure with 64K page
>

For the series,

Tested-by: Alan Maguire <alan.maguire@oracle.com>

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

* Re: [PATCH bpf-next 3/3] selftests/bpf: Fix verifier_arena_globals1 failure with 64K page
  2026-01-13  6:10 ` [PATCH bpf-next 3/3] selftests/bpf: Fix verifier_arena_globals1 " Yonghong Song
@ 2026-01-13 17:04   ` Emil Tsalapatis
  0 siblings, 0 replies; 7+ messages in thread
From: Emil Tsalapatis @ 2026-01-13 17:04 UTC (permalink / raw)
  To: Yonghong Song, bpf
  Cc: Alexei Starovoitov, Andrii Nakryiko, Daniel Borkmann, kernel-team,
	Martin KaFai Lau

On Tue Jan 13, 2026 at 1:10 AM EST, Yonghong Song wrote:
> With 64K page on arm64, verifier_arena_globals1 failed like below:
>   ...
>   libbpf: map 'arena': failed to create: -E2BIG
>   ...
>   #509/1   verifier_arena_globals1/check_reserve1:FAIL
>   ...
>
> For 64K page, if the number of arena pages is (1UL << 20), the total
> memory will exceed 4G and this will cause map creation failure.
> Adjusting ARENA_PAGES based on the actual page size fixed the problem.
>
> Cc: Emil Tsalapatis <emil@etsalapatis.com>
> Signed-off-by: Yonghong Song <yonghong.song@linux.dev>
> ---

Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com>

>  tools/testing/selftests/bpf/progs/verifier_arena_globals1.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/bpf/progs/verifier_arena_globals1.c b/tools/testing/selftests/bpf/progs/verifier_arena_globals1.c
> index 14afef3d6442..83182ddbfb95 100644
> --- a/tools/testing/selftests/bpf/progs/verifier_arena_globals1.c
> +++ b/tools/testing/selftests/bpf/progs/verifier_arena_globals1.c
> @@ -9,7 +9,7 @@
>  #include "bpf_arena_common.h"
>  #include "bpf_misc.h"
>  
> -#define ARENA_PAGES (1UL<< (32 - 12))
> +#define ARENA_PAGES (1UL<< (32 - __builtin_ffs(__PAGE_SIZE) + 1))
>  #define GLOBAL_PAGES (16)
>  
>  struct {


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

* Re: [PATCH bpf-next 0/3] Fix a few selftest failure due to 64K page
  2026-01-13  6:10 [PATCH bpf-next 0/3] Fix a few selftest failure due to 64K page Yonghong Song
                   ` (3 preceding siblings ...)
  2026-01-13 10:32 ` [PATCH bpf-next 0/3] Fix a few selftest failure due to " Alan Maguire
@ 2026-01-13 18:17 ` patchwork-bot+netdevbpf
  4 siblings, 0 replies; 7+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-01-13 18:17 UTC (permalink / raw)
  To: Yonghong Song; +Cc: bpf, ast, andrii, daniel, kernel-team, martin.lau

Hello:

This series was applied to bpf/bpf-next.git (master)
by Alexei Starovoitov <ast@kernel.org>:

On Mon, 12 Jan 2026 22:10:18 -0800 you wrote:
> Fix a few arm64 selftest failures due to 64K page. Please see each
> indvidual patch for why the test failed and how the test gets fixed.
> 
> Yonghong Song (3):
>   selftests/bpf: Fix dmabuf_iter/lots_of_buffers failure with 64K page
>   selftests/bpf: Fix sk_bypass_prot_mem failure with 64K page
>   selftests/bpf: Fix verifier_arena_globals1 failure with 64K page
> 
> [...]

Here is the summary with links:
  - [bpf-next,1/3] selftests/bpf: Fix dmabuf_iter/lots_of_buffers failure with 64K page
    https://git.kernel.org/bpf/bpf-next/c/2465a08d433d
  - [bpf-next,2/3] selftests/bpf: Fix sk_bypass_prot_mem failure with 64K page
    https://git.kernel.org/bpf/bpf-next/c/d2f7cd20a7c7
  - [bpf-next,3/3] selftests/bpf: Fix verifier_arena_globals1 failure with 64K page
    https://git.kernel.org/bpf/bpf-next/c/951d79017e8a

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

end of thread, other threads:[~2026-01-13 18:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-13  6:10 [PATCH bpf-next 0/3] Fix a few selftest failure due to 64K page Yonghong Song
2026-01-13  6:10 ` [PATCH bpf-next 1/3] selftests/bpf: Fix dmabuf_iter/lots_of_buffers failure with " Yonghong Song
2026-01-13  6:10 ` [PATCH bpf-next 2/3] selftests/bpf: Fix sk_bypass_prot_mem " Yonghong Song
2026-01-13  6:10 ` [PATCH bpf-next 3/3] selftests/bpf: Fix verifier_arena_globals1 " Yonghong Song
2026-01-13 17:04   ` Emil Tsalapatis
2026-01-13 10:32 ` [PATCH bpf-next 0/3] Fix a few selftest failure due to " Alan Maguire
2026-01-13 18:17 ` 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