Fix a few selftest failure due to 64K page
Subsystems (3)
Yonghong Song
reviewercover Fix a few selftest failure due to 64K page
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(-)
Signature · 1 line
2.47.3
Yonghong Song
reviewerPATCH 1/3 selftests/bpf: Fix dmabuf_iter/lots_of_buffers failure with 64K page
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.
--- tools/testing/selftests/bpf/prog_tests/dmabuf_iter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/bpf/prog_tests/dmabuf_iter.c +1 -1
@@ -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); }
Signature · 1 line
2.47.3
Yonghong Song
reviewerPATCH 2/3 selftests/bpf: Fix sk_bypass_prot_mem failure with 64K page
In reply to Yonghong SongThe 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.
--- .../testing/selftests/bpf/prog_tests/sk_bypass_prot_mem.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
tools/testing/selftests/bpf/prog_tests/sk_bypass_prot_mem.c +6 -1
@@ -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)
Signature · 1 line
2.47.3
Yonghong Song
reviewerPATCH 3/3 selftests/bpf: Fix verifier_arena_globals1 failure with 64K page
In reply to Yonghong SongWith 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.
--- tools/testing/selftests/bpf/progs/verifier_arena_globals1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/bpf/progs/verifier_arena_globals1.c +1 -1
@@ -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 {
Signature · 1 line
2.47.3
Re: [PATCH bpf-next 3/3] selftests/bpf: Fix verifier_arena_globals1 failure with 64K page
Quoted 7 lines · Yonghong Song
With 64K page on arm64,
verifier_arena_globals1failed like below:
...
libbpf: map 'arena': failed to create:-E2BIG
...
#509/1 verifier_arena_globals1/check_reserve1:FAIL
...
Quoted 7 lines
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_PAGESbased on the actual page size fixed the problem.Cc Emil Tsalapatis <[email protected]>Signed-off-by Yonghong Song <[email protected]>---
Quoted 16 lines
tools/testing/selftests/bpf/progs/verifier_arena_globals1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/testing/selftests/bpf/progs/verifier_arena_globals1.c +1
-1@@ -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 {
Quoted 8 lines · Yonghong Song
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: Fixsk_bypass_prot_memfailure with 64K page selftests/bpf: Fixverifier_arena_globals1failure with 64K page
For the series,
This series was applied to bpf/bpf-next.git (master) by Alexei Starovoitov <[email protected]>:
Hello:
This series was applied to bpf/bpf-next.git (master) by Alexei Starovoitov <[email protected]>:
Quoted 9 lines · 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: Fixsk_bypass_prot_memfailure with 64K page selftests/bpf: Fixverifier_arena_globals1failure 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!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html