* [PATCH bpf-next 1/4] selftests/bpf: Reduce test_xdp_adjust_frags_tail_grow logs
2025-06-06 3:23 [PATCH bpf-next 0/4] selftests/bpf: Fix a few test failures with arm64 64KB page Yonghong Song
@ 2025-06-06 3:23 ` Yonghong Song
2025-06-06 3:23 ` [PATCH bpf-next 2/4] selftests/bpf: Fix bpf_mod_race test failure with arm64 64KB page size Yonghong Song
` (3 subsequent siblings)
4 siblings, 0 replies; 17+ messages in thread
From: Yonghong Song @ 2025-06-06 3:23 UTC (permalink / raw)
To: bpf
Cc: Alexei Starovoitov, Andrii Nakryiko, Daniel Borkmann, kernel-team,
Martin KaFai Lau
For selftest xdp_adjust_tail/xdp_adjust_frags_tail_grow, if tested failure,
I see a long list of log output like
...
test_xdp_adjust_frags_tail_grow:PASS:9Kb+10b-untouched 0 nsec
test_xdp_adjust_frags_tail_grow:PASS:9Kb+10b-untouched 0 nsec
test_xdp_adjust_frags_tail_grow:PASS:9Kb+10b-untouched 0 nsec
test_xdp_adjust_frags_tail_grow:PASS:9Kb+10b-untouched 0 nsec
...
There are total 7374 lines of the above which is too much. Let us
only issue such logs when it is an assert failure.
Signed-off-by: Yonghong Song <yonghong.song@linux.dev>
---
.../selftests/bpf/prog_tests/xdp_adjust_tail.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/tools/testing/selftests/bpf/prog_tests/xdp_adjust_tail.c b/tools/testing/selftests/bpf/prog_tests/xdp_adjust_tail.c
index b2b2d85dbb1b..e361129402a1 100644
--- a/tools/testing/selftests/bpf/prog_tests/xdp_adjust_tail.c
+++ b/tools/testing/selftests/bpf/prog_tests/xdp_adjust_tail.c
@@ -246,14 +246,20 @@ static void test_xdp_adjust_frags_tail_grow(void)
ASSERT_EQ(topts.retval, XDP_TX, "9Kb+10b retval");
ASSERT_EQ(topts.data_size_out, exp_size, "9Kb+10b size");
- for (i = 0; i < 9000; i++)
- ASSERT_EQ(buf[i], 1, "9Kb+10b-old");
+ for (i = 0; i < 9000; i++) {
+ if (buf[i] != 1)
+ ASSERT_EQ(buf[i], 1, "9Kb+10b-old");
+ }
- for (i = 9000; i < 9010; i++)
- ASSERT_EQ(buf[i], 0, "9Kb+10b-new");
+ for (i = 9000; i < 9010; i++) {
+ if (buf[i] != 0)
+ ASSERT_EQ(buf[i], 0, "9Kb+10b-new");
+ }
- for (i = 9010; i < 16384; i++)
- ASSERT_EQ(buf[i], 1, "9Kb+10b-untouched");
+ for (i = 9010; i < 16384; i++) {
+ if (buf[i] != 1)
+ ASSERT_EQ(buf[i], 1, "9Kb+10b-untouched");
+ }
/* Test a too large grow */
memset(buf, 1, 16384);
--
2.47.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH bpf-next 2/4] selftests/bpf: Fix bpf_mod_race test failure with arm64 64KB page size
2025-06-06 3:23 [PATCH bpf-next 0/4] selftests/bpf: Fix a few test failures with arm64 64KB page Yonghong Song
2025-06-06 3:23 ` [PATCH bpf-next 1/4] selftests/bpf: Reduce test_xdp_adjust_frags_tail_grow logs Yonghong Song
@ 2025-06-06 3:23 ` Yonghong Song
2025-06-06 3:23 ` [PATCH bpf-next 3/4] selftests/bpf: Fix ringbuf/ringbuf_write " Yonghong Song
` (2 subsequent siblings)
4 siblings, 0 replies; 17+ messages in thread
From: Yonghong Song @ 2025-06-06 3:23 UTC (permalink / raw)
To: bpf
Cc: Alexei Starovoitov, Andrii Nakryiko, Daniel Borkmann, kernel-team,
Martin KaFai Lau
Currently, uffd_register.range.len is set to 4096 for command
'ioctl(uffd, UFFDIO_REGISTER, &uffd_register)'. For arm64 64KB page size,
the len must be 64KB size aligned as page size alignment is required.
See fs/userfaultfd.c:validate_unaligned_range().
Signed-off-by: Yonghong Song <yonghong.song@linux.dev>
---
tools/testing/selftests/bpf/prog_tests/bpf_mod_race.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/bpf/prog_tests/bpf_mod_race.c b/tools/testing/selftests/bpf/prog_tests/bpf_mod_race.c
index fe2c502e5089..ecc3d47919ad 100644
--- a/tools/testing/selftests/bpf/prog_tests/bpf_mod_race.c
+++ b/tools/testing/selftests/bpf/prog_tests/bpf_mod_race.c
@@ -78,7 +78,7 @@ static int test_setup_uffd(void *fault_addr)
}
uffd_register.range.start = (unsigned long)fault_addr;
- uffd_register.range.len = 4096;
+ uffd_register.range.len = getpagesize();
uffd_register.mode = UFFDIO_REGISTER_MODE_MISSING;
if (ioctl(uffd, UFFDIO_REGISTER, &uffd_register)) {
close(uffd);
--
2.47.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH bpf-next 3/4] selftests/bpf: Fix ringbuf/ringbuf_write test failure with arm64 64KB page size
2025-06-06 3:23 [PATCH bpf-next 0/4] selftests/bpf: Fix a few test failures with arm64 64KB page Yonghong Song
2025-06-06 3:23 ` [PATCH bpf-next 1/4] selftests/bpf: Reduce test_xdp_adjust_frags_tail_grow logs Yonghong Song
2025-06-06 3:23 ` [PATCH bpf-next 2/4] selftests/bpf: Fix bpf_mod_race test failure with arm64 64KB page size Yonghong Song
@ 2025-06-06 3:23 ` Yonghong Song
2025-06-06 3:23 ` [PATCH bpf-next 4/4] selftests/bpf: Fix a user_ringbuf " Yonghong Song
2025-06-06 16:30 ` [PATCH bpf-next 0/4] selftests/bpf: Fix a few test failures with arm64 64KB page Andrii Nakryiko
4 siblings, 0 replies; 17+ messages in thread
From: Yonghong Song @ 2025-06-06 3:23 UTC (permalink / raw)
To: bpf
Cc: Alexei Starovoitov, Andrii Nakryiko, Daniel Borkmann, kernel-team,
Martin KaFai Lau
The ringbuf max_entries must be PAGE_ALIGNED. See kernel function
ringbuf_map_alloc(). So for arm64 64KB page size, adjust max_entries
properly.
Signed-off-by: Yonghong Song <yonghong.song@linux.dev>
---
tools/testing/selftests/bpf/prog_tests/ringbuf.c | 5 +++--
tools/testing/selftests/bpf/progs/test_ringbuf_write.c | 5 +++--
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/tools/testing/selftests/bpf/prog_tests/ringbuf.c b/tools/testing/selftests/bpf/prog_tests/ringbuf.c
index da430df45aa4..89fd3401a23e 100644
--- a/tools/testing/selftests/bpf/prog_tests/ringbuf.c
+++ b/tools/testing/selftests/bpf/prog_tests/ringbuf.c
@@ -97,7 +97,8 @@ static void ringbuf_write_subtest(void)
if (!ASSERT_OK_PTR(skel, "skel_open"))
return;
- skel->maps.ringbuf.max_entries = 0x4000;
+ skel->maps.ringbuf.max_entries = 4 * page_size;
+ skel->rodata->reserve_size = 3 * page_size;
err = test_ringbuf_write_lskel__load(skel);
if (!ASSERT_OK(err, "skel_load"))
@@ -108,7 +109,7 @@ static void ringbuf_write_subtest(void)
mmap_ptr = mmap(NULL, page_size, PROT_READ | PROT_WRITE, MAP_SHARED, rb_fd, 0);
if (!ASSERT_OK_PTR(mmap_ptr, "rw_cons_pos"))
goto cleanup;
- *mmap_ptr = 0x3000;
+ *mmap_ptr = 3 * page_size;
ASSERT_OK(munmap(mmap_ptr, page_size), "unmap_rw");
skel->bss->pid = getpid();
diff --git a/tools/testing/selftests/bpf/progs/test_ringbuf_write.c b/tools/testing/selftests/bpf/progs/test_ringbuf_write.c
index 350513c0e4c9..9acef7afbe8a 100644
--- a/tools/testing/selftests/bpf/progs/test_ringbuf_write.c
+++ b/tools/testing/selftests/bpf/progs/test_ringbuf_write.c
@@ -12,6 +12,7 @@ struct {
/* inputs */
int pid = 0;
+const volatile int reserve_size = 0;
/* outputs */
long passed = 0;
@@ -26,11 +27,11 @@ int test_ringbuf_write(void *ctx)
if (cur_pid != pid)
return 0;
- sample1 = bpf_ringbuf_reserve(&ringbuf, 0x3000, 0);
+ sample1 = bpf_ringbuf_reserve(&ringbuf, reserve_size, 0);
if (!sample1)
return 0;
/* first one can pass */
- sample2 = bpf_ringbuf_reserve(&ringbuf, 0x3000, 0);
+ sample2 = bpf_ringbuf_reserve(&ringbuf, reserve_size, 0);
if (!sample2) {
bpf_ringbuf_discard(sample1, 0);
__sync_fetch_and_add(&discarded, 1);
--
2.47.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH bpf-next 4/4] selftests/bpf: Fix a user_ringbuf failure with arm64 64KB page size
2025-06-06 3:23 [PATCH bpf-next 0/4] selftests/bpf: Fix a few test failures with arm64 64KB page Yonghong Song
` (2 preceding siblings ...)
2025-06-06 3:23 ` [PATCH bpf-next 3/4] selftests/bpf: Fix ringbuf/ringbuf_write " Yonghong Song
@ 2025-06-06 3:23 ` Yonghong Song
2025-06-06 5:52 ` Yonghong Song
2025-06-06 16:30 ` [PATCH bpf-next 0/4] selftests/bpf: Fix a few test failures with arm64 64KB page Andrii Nakryiko
4 siblings, 1 reply; 17+ messages in thread
From: Yonghong Song @ 2025-06-06 3:23 UTC (permalink / raw)
To: bpf
Cc: Alexei Starovoitov, Andrii Nakryiko, Daniel Borkmann, kernel-team,
Martin KaFai Lau
The ringbuf max_entries must be PAGE_ALIGNED. See kernel function
ringbuf_map_alloc(). So for arm64 64KB page size, adjust max_entries
properly.
Signed-off-by: Yonghong Song <yonghong.song@linux.dev>
---
tools/testing/selftests/bpf/prog_tests/user_ringbuf.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/bpf/prog_tests/user_ringbuf.c b/tools/testing/selftests/bpf/prog_tests/user_ringbuf.c
index d424e7ecbd12..f50aa8e7f6c2 100644
--- a/tools/testing/selftests/bpf/prog_tests/user_ringbuf.c
+++ b/tools/testing/selftests/bpf/prog_tests/user_ringbuf.c
@@ -21,8 +21,7 @@
#include "../progs/test_user_ringbuf.h"
static const long c_sample_size = sizeof(struct sample) + BPF_RINGBUF_HDR_SZ;
-static const long c_ringbuf_size = 1 << 12; /* 1 small page */
-static const long c_max_entries = c_ringbuf_size / c_sample_size;
+static long c_ringbuf_size, c_max_entries;
static void drain_current_samples(void)
{
@@ -686,6 +685,9 @@ void test_user_ringbuf(void)
{
int i;
+ c_ringbuf_size = getpagesize(); /* 1 page */
+ c_max_entries = c_ringbuf_size / c_sample_size;
+
for (i = 0; i < ARRAY_SIZE(success_tests); i++) {
if (!test__start_subtest(success_tests[i].test_name))
continue;
--
2.47.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH bpf-next 4/4] selftests/bpf: Fix a user_ringbuf failure with arm64 64KB page size
2025-06-06 3:23 ` [PATCH bpf-next 4/4] selftests/bpf: Fix a user_ringbuf " Yonghong Song
@ 2025-06-06 5:52 ` Yonghong Song
2025-06-06 6:00 ` Yonghong Song
0 siblings, 1 reply; 17+ messages in thread
From: Yonghong Song @ 2025-06-06 5:52 UTC (permalink / raw)
To: bpf
Cc: Alexei Starovoitov, Andrii Nakryiko, Daniel Borkmann, kernel-team,
Martin KaFai Lau
On 6/5/25 8:23 PM, Yonghong Song wrote:
> The ringbuf max_entries must be PAGE_ALIGNED. See kernel function
> ringbuf_map_alloc(). So for arm64 64KB page size, adjust max_entries
> properly.
>
> Signed-off-by: Yonghong Song <yonghong.song@linux.dev>
> ---
> tools/testing/selftests/bpf/prog_tests/user_ringbuf.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/prog_tests/user_ringbuf.c b/tools/testing/selftests/bpf/prog_tests/user_ringbuf.c
> index d424e7ecbd12..f50aa8e7f6c2 100644
> --- a/tools/testing/selftests/bpf/prog_tests/user_ringbuf.c
> +++ b/tools/testing/selftests/bpf/prog_tests/user_ringbuf.c
> @@ -21,8 +21,7 @@
> #include "../progs/test_user_ringbuf.h"
>
> static const long c_sample_size = sizeof(struct sample) + BPF_RINGBUF_HDR_SZ;
> -static const long c_ringbuf_size = 1 << 12; /* 1 small page */
> -static const long c_max_entries = c_ringbuf_size / c_sample_size;
> +static long c_ringbuf_size, c_max_entries;
>
> static void drain_current_samples(void)
> {
> @@ -686,6 +685,9 @@ void test_user_ringbuf(void)
> {
> int i;
>
> + c_ringbuf_size = getpagesize(); /* 1 page */
> + c_max_entries = c_ringbuf_size / c_sample_size;
> +
> for (i = 0; i < ARRAY_SIZE(success_tests); i++) {
> if (!test__start_subtest(success_tests[i].test_name))
> continue;
CI reports a build failure error:
/tmp/work/bpf/bpf/tools/testing/selftests/bpf/prog_tests/user_ringbuf.c:426:2:
error: call to '__compiletime_assert_0' declared with 'error' attribute:
BUILD_BUG_ON failed: total_samples <= c_max_entries 426 | BUILD_BUG_ON(total_samples <= c_max_entries |
/tmp/work/bpf/bpf/tools/include/linux/build_bug.h:50:2: note: expanded
from macro 'BUILD_BUG_ON' 50 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON
failed: " #condition) | ^
/tmp/work/bpf/bpf/tools/include/linux/build_bug.h:39:37: note: expanded
from macro 'BUILD_BUG_ON_MSG' 39 | #define BUILD_BUG_ON_MSG(cond, msg)
compiletime_assert(!(cond), msg) | ^
/tmp/work/bpf/bpf/tools/include/linux/compiler.h:37:2: note: expanded
from macro 'compiletime_assert' 37 | _compiletime_assert(condition, msg,
__compiletime_assert_, __COUNTER__) | ^
/tmp/work/bpf/bpf/tools/include/linux/compiler.h:25:2: note: expanded
from macro '_compiletime_assert' 25 | __compiletime_assert(condition,
msg, prefix, suffix) | ^
/tmp/work/bpf/bpf/tools/include/linux/compiler.h:18:4: note: expanded
from macro '__compiletime_assert' 18 | prefix ## suffix(); \ | ^
<scratch space>:60:1: note: expanded from here 60 | __compiletime_assert_0
| ^ This happens for the release build (RELEASE=1 in build command line
where -O2 is used in stead of -O0). Converting the BUILD_BUG_ON to
ASSERT can fix the problem. diff --git
a/tools/testing/selftests/bpf/prog_tests/user_ringbuf.c
b/tools/testing/selftests/bpf/prog_tests/user_ringbuf.c index
f50aa8e7f6c2..467b5b8beecc 100644 ---
a/tools/testing/selftests/bpf/prog_tests/user_ringbuf.c +++
b/tools/testing/selftests/bpf/prog_tests/user_ringbuf.c @@ -423,7 +423,9
@@ static void test_user_ringbuf_loop(void) uint32_t remaining_samples =
total_samples; int err; - BUILD_BUG_ON(total_samples <= c_max_entries);
+ if (!ASSERT_LE(total_samples, c_max_entries, "compare_c_max_entries"))
+ return; + err = load_skel_create_user_ringbuf(&skel, &ringbuf); I will
wait for some further comments before posting v2.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH bpf-next 4/4] selftests/bpf: Fix a user_ringbuf failure with arm64 64KB page size
2025-06-06 5:52 ` Yonghong Song
@ 2025-06-06 6:00 ` Yonghong Song
0 siblings, 0 replies; 17+ messages in thread
From: Yonghong Song @ 2025-06-06 6:00 UTC (permalink / raw)
To: bpf
Cc: Alexei Starovoitov, Andrii Nakryiko, Daniel Borkmann, kernel-team,
Martin KaFai Lau
On 6/5/25 10:52 PM, Yonghong Song wrote:
>
>
> On 6/5/25 8:23 PM, Yonghong Song wrote:
>> The ringbuf max_entries must be PAGE_ALIGNED. See kernel function
>> ringbuf_map_alloc(). So for arm64 64KB page size, adjust max_entries
>> properly.
>>
>> Signed-off-by: Yonghong Song <yonghong.song@linux.dev>
>> ---
>> tools/testing/selftests/bpf/prog_tests/user_ringbuf.c | 6 ++++--
>> 1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/tools/testing/selftests/bpf/prog_tests/user_ringbuf.c
>> b/tools/testing/selftests/bpf/prog_tests/user_ringbuf.c
>> index d424e7ecbd12..f50aa8e7f6c2 100644
>> --- a/tools/testing/selftests/bpf/prog_tests/user_ringbuf.c
>> +++ b/tools/testing/selftests/bpf/prog_tests/user_ringbuf.c
>> @@ -21,8 +21,7 @@
>> #include "../progs/test_user_ringbuf.h"
>> static const long c_sample_size = sizeof(struct sample) +
>> BPF_RINGBUF_HDR_SZ;
>> -static const long c_ringbuf_size = 1 << 12; /* 1 small page */
>> -static const long c_max_entries = c_ringbuf_size / c_sample_size;
>> +static long c_ringbuf_size, c_max_entries;
>> static void drain_current_samples(void)
>> {
>> @@ -686,6 +685,9 @@ void test_user_ringbuf(void)
>> {
>> int i;
>> + c_ringbuf_size = getpagesize(); /* 1 page */
>> + c_max_entries = c_ringbuf_size / c_sample_size;
>> +
>> for (i = 0; i < ARRAY_SIZE(success_tests); i++) {
>> if (!test__start_subtest(success_tests[i].test_name))
>> continue;
>
> CI reports a build failure error:
>
> /tmp/work/bpf/bpf/tools/testing/selftests/bpf/prog_tests/user_ringbuf.c:426:2:
> error: call to '__compiletime_assert_0' declared with 'error'
> attribute: BUILD_BUG_ON failed: total_samples <= c_max_entries 426 |
> BUILD_BUG_ON(total_samples <= c_max_entries |
>
> /tmp/work/bpf/bpf/tools/include/linux/build_bug.h:50:2: note: expanded
> from macro 'BUILD_BUG_ON' 50 | BUILD_BUG_ON_MSG(condition,
> "BUILD_BUG_ON failed: " #condition) | ^
> /tmp/work/bpf/bpf/tools/include/linux/build_bug.h:39:37: note:
> expanded from macro 'BUILD_BUG_ON_MSG' 39 | #define
> BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | ^
> /tmp/work/bpf/bpf/tools/include/linux/compiler.h:37:2: note: expanded
> from macro 'compiletime_assert' 37 | _compiletime_assert(condition,
> msg, __compiletime_assert_, __COUNTER__) | ^
> /tmp/work/bpf/bpf/tools/include/linux/compiler.h:25:2: note: expanded
> from macro '_compiletime_assert' 25 | __compiletime_assert(condition,
> msg, prefix, suffix) | ^
> /tmp/work/bpf/bpf/tools/include/linux/compiler.h:18:4: note: expanded
> from macro '__compiletime_assert' 18 | prefix ## suffix(); \ | ^
> <scratch space>:60:1: note: expanded from here 60 |
> __compiletime_assert_0
>
> | ^ This happens for the release build (RELEASE=1 in build command
> line where -O2 is used in stead of -O0). Converting the BUILD_BUG_ON
> to ASSERT can fix the problem. diff --git
> a/tools/testing/selftests/bpf/prog_tests/user_ringbuf.c
> b/tools/testing/selftests/bpf/prog_tests/user_ringbuf.c index
> f50aa8e7f6c2..467b5b8beecc 100644 ---
> a/tools/testing/selftests/bpf/prog_tests/user_ringbuf.c +++
> b/tools/testing/selftests/bpf/prog_tests/user_ringbuf.c @@ -423,7
> +423,9 @@ static void test_user_ringbuf_loop(void) uint32_t
> remaining_samples = total_samples; int err; -
> BUILD_BUG_ON(total_samples <= c_max_entries); + if
> (!ASSERT_LE(total_samples, c_max_entries, "compare_c_max_entries")) +
> return; + err = load_skel_create_user_ringbuf(&skel, &ringbuf); I will
> wait for some further comments before posting v2.
Sorry for mess up. Basically, need to replace a BUILD_BUG_ON with a ASSERT...
I already tried to format the code properly but somehow still messed up.
Will debug/double-check this next time.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH bpf-next 0/4] selftests/bpf: Fix a few test failures with arm64 64KB page
2025-06-06 3:23 [PATCH bpf-next 0/4] selftests/bpf: Fix a few test failures with arm64 64KB page Yonghong Song
` (3 preceding siblings ...)
2025-06-06 3:23 ` [PATCH bpf-next 4/4] selftests/bpf: Fix a user_ringbuf " Yonghong Song
@ 2025-06-06 16:30 ` Andrii Nakryiko
2025-06-06 16:37 ` Ihor Solodrai
2025-06-06 16:43 ` Yonghong Song
4 siblings, 2 replies; 17+ messages in thread
From: Andrii Nakryiko @ 2025-06-06 16:30 UTC (permalink / raw)
To: Yonghong Song, Ihor Solodrai
Cc: bpf, Alexei Starovoitov, Andrii Nakryiko, Daniel Borkmann,
kernel-team, Martin KaFai Lau
On Thu, Jun 5, 2025 at 8:23 PM Yonghong Song <yonghong.song@linux.dev> wrote:
>
> My local arm64 host has 64KB page size and the VM to run test_progs
> also has 64KB page size. There are a few self tests assuming 4KB page
> and hence failed in my envorinment. Patch 1 tries to reduce long assert
typo: environment
> logs when tail failed. Patches 2-4 fixed three selftest failures.
How come our BPF CI doesn't catch this on aarch64?.. Ihor, any thoughts?
>
> Yonghong Song (4):
> selftests/bpf: Reduce test_xdp_adjust_frags_tail_grow logs
> selftests/bpf: Fix bpf_mod_race test failure with arm64 64KB page size
> selftests/bpf: Fix ringbuf/ringbuf_write test failure with arm64 64KB
> page size
> selftests/bpf: Fix a user_ringbuf failure with arm64 64KB page size
>
> .../selftests/bpf/prog_tests/bpf_mod_race.c | 2 +-
> .../testing/selftests/bpf/prog_tests/ringbuf.c | 5 +++--
> .../selftests/bpf/prog_tests/user_ringbuf.c | 6 ++++--
> .../selftests/bpf/prog_tests/xdp_adjust_tail.c | 18 ++++++++++++------
> .../selftests/bpf/progs/test_ringbuf_write.c | 5 +++--
> 5 files changed, 23 insertions(+), 13 deletions(-)
>
> --
> 2.47.1
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH bpf-next 0/4] selftests/bpf: Fix a few test failures with arm64 64KB page
2025-06-06 16:30 ` [PATCH bpf-next 0/4] selftests/bpf: Fix a few test failures with arm64 64KB page Andrii Nakryiko
@ 2025-06-06 16:37 ` Ihor Solodrai
2025-06-06 16:43 ` Yonghong Song
1 sibling, 0 replies; 17+ messages in thread
From: Ihor Solodrai @ 2025-06-06 16:37 UTC (permalink / raw)
To: Andrii Nakryiko, Yonghong Song
Cc: bpf, Alexei Starovoitov, Andrii Nakryiko, Daniel Borkmann,
kernel-team, Martin KaFai Lau
On 6/6/25 9:30 AM, Andrii Nakryiko wrote:
> On Thu, Jun 5, 2025 at 8:23 PM Yonghong Song <yonghong.song@linux.dev> wrote:
>>
>> My local arm64 host has 64KB page size and the VM to run test_progs
>> also has 64KB page size. There are a few self tests assuming 4KB page
>> and hence failed in my envorinment. Patch 1 tries to reduce long assert
>
> typo: environment
>
>> logs when tail failed. Patches 2-4 fixed three selftest failures.
>
> How come our BPF CI doesn't catch this on aarch64?.. Ihor, any thoughts?
Because our aarch64 hosts use 4K pagesize...
$ uname -a
Linux ip-10-0-0-103.us-west-1.compute.internal
5.10.228-219.884.amzn2.aarch64 #1 SMP Wed Oct 23 17:17:31 UTC 2024
aarch64 aarch64 aarch64 GNU/Linux
[ec2-user@ip-10-0-0-103 ~]$ getconf PAGESIZE
4096
>
>>
>> Yonghong Song (4):
>> selftests/bpf: Reduce test_xdp_adjust_frags_tail_grow logs
>> selftests/bpf: Fix bpf_mod_race test failure with arm64 64KB page size
>> selftests/bpf: Fix ringbuf/ringbuf_write test failure with arm64 64KB
>> page size
>> selftests/bpf: Fix a user_ringbuf failure with arm64 64KB page size
>>
>> .../selftests/bpf/prog_tests/bpf_mod_race.c | 2 +-
>> .../testing/selftests/bpf/prog_tests/ringbuf.c | 5 +++--
>> .../selftests/bpf/prog_tests/user_ringbuf.c | 6 ++++--
>> .../selftests/bpf/prog_tests/xdp_adjust_tail.c | 18 ++++++++++++------
>> .../selftests/bpf/progs/test_ringbuf_write.c | 5 +++--
>> 5 files changed, 23 insertions(+), 13 deletions(-)
>>
>> --
>> 2.47.1
>>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH bpf-next 0/4] selftests/bpf: Fix a few test failures with arm64 64KB page
2025-06-06 16:30 ` [PATCH bpf-next 0/4] selftests/bpf: Fix a few test failures with arm64 64KB page Andrii Nakryiko
2025-06-06 16:37 ` Ihor Solodrai
@ 2025-06-06 16:43 ` Yonghong Song
2025-06-06 16:49 ` Ihor Solodrai
1 sibling, 1 reply; 17+ messages in thread
From: Yonghong Song @ 2025-06-06 16:43 UTC (permalink / raw)
To: Andrii Nakryiko, Ihor Solodrai
Cc: bpf, Alexei Starovoitov, Andrii Nakryiko, Daniel Borkmann,
kernel-team, Martin KaFai Lau
On 6/6/25 9:30 AM, Andrii Nakryiko wrote:
> On Thu, Jun 5, 2025 at 8:23 PM Yonghong Song <yonghong.song@linux.dev> wrote:
>> My local arm64 host has 64KB page size and the VM to run test_progs
>> also has 64KB page size. There are a few self tests assuming 4KB page
>> and hence failed in my envorinment. Patch 1 tries to reduce long assert
> typo: environment
>
>> logs when tail failed. Patches 2-4 fixed three selftest failures.
> How come our BPF CI doesn't catch this on aarch64?.. Ihor, any thoughts?
In CI for aarch64, the page size is 4KB. For example, for this link:
https://github.com/kernel-patches/bpf/actions/runs/15482212552/job/43590176563?pr=9053
Find the kconfig, and we have
CONFIG_ARM64_4K_PAGES=y
# CONFIG_ARM64_16K_PAGES is not set
# CONFIG_ARM64_64K_PAGES is not set
and for 4K page, all these tests are fine, but not for 64K page.
>
>> Yonghong Song (4):
>> selftests/bpf: Reduce test_xdp_adjust_frags_tail_grow logs
>> selftests/bpf: Fix bpf_mod_race test failure with arm64 64KB page size
>> selftests/bpf: Fix ringbuf/ringbuf_write test failure with arm64 64KB
>> page size
>> selftests/bpf: Fix a user_ringbuf failure with arm64 64KB page size
>>
>> .../selftests/bpf/prog_tests/bpf_mod_race.c | 2 +-
>> .../testing/selftests/bpf/prog_tests/ringbuf.c | 5 +++--
>> .../selftests/bpf/prog_tests/user_ringbuf.c | 6 ++++--
>> .../selftests/bpf/prog_tests/xdp_adjust_tail.c | 18 ++++++++++++------
>> .../selftests/bpf/progs/test_ringbuf_write.c | 5 +++--
>> 5 files changed, 23 insertions(+), 13 deletions(-)
>>
>> --
>> 2.47.1
>>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH bpf-next 0/4] selftests/bpf: Fix a few test failures with arm64 64KB page
2025-06-06 16:43 ` Yonghong Song
@ 2025-06-06 16:49 ` Ihor Solodrai
2025-06-06 16:57 ` Andrii Nakryiko
2025-06-06 17:03 ` Yonghong Song
0 siblings, 2 replies; 17+ messages in thread
From: Ihor Solodrai @ 2025-06-06 16:49 UTC (permalink / raw)
To: Yonghong Song, Andrii Nakryiko
Cc: bpf, Alexei Starovoitov, Andrii Nakryiko, Daniel Borkmann,
kernel-team, Martin KaFai Lau
On 6/6/25 9:43 AM, Yonghong Song wrote:
>
>
> On 6/6/25 9:30 AM, Andrii Nakryiko wrote:
>> On Thu, Jun 5, 2025 at 8:23 PM Yonghong Song <yonghong.song@linux.dev>
>> wrote:
>>> My local arm64 host has 64KB page size and the VM to run test_progs
>>> also has 64KB page size. There are a few self tests assuming 4KB page
>>> and hence failed in my envorinment. Patch 1 tries to reduce long assert
>> typo: environment
>>
>>> logs when tail failed. Patches 2-4 fixed three selftest failures.
>> How come our BPF CI doesn't catch this on aarch64?.. Ihor, any thoughts?
>
> In CI for aarch64, the page size is 4KB. For example, for this link:
>
> https://github.com/kernel-patches/bpf/actions/runs/15482212552/
> job/43590176563?pr=9053
>
> Find the kconfig, and we have
>
> CONFIG_ARM64_4K_PAGES=y
> # CONFIG_ARM64_16K_PAGES is not set
> # CONFIG_ARM64_64K_PAGES is not set
>
> and for 4K page, all these tests are fine, but not for 64K page.
Ah right, I just realized the host pagesize doesn't matter, the kernel
we are running tests against needs to be re-compiled with the right
config.
If this is important to test on CI, it can be another matrix dimension
with customized kconfig. Do we want to do that?
>
>
>>
>>> Yonghong Song (4):
>>> selftests/bpf: Reduce test_xdp_adjust_frags_tail_grow logs
>>> selftests/bpf: Fix bpf_mod_race test failure with arm64 64KB page
>>> size
>>> selftests/bpf: Fix ringbuf/ringbuf_write test failure with arm64 64KB
>>> page size
>>> selftests/bpf: Fix a user_ringbuf failure with arm64 64KB page size
>>>
>>> .../selftests/bpf/prog_tests/bpf_mod_race.c | 2 +-
>>> .../testing/selftests/bpf/prog_tests/ringbuf.c | 5 +++--
>>> .../selftests/bpf/prog_tests/user_ringbuf.c | 6 ++++--
>>> .../selftests/bpf/prog_tests/xdp_adjust_tail.c | 18 ++++++++++++------
>>> .../selftests/bpf/progs/test_ringbuf_write.c | 5 +++--
>>> 5 files changed, 23 insertions(+), 13 deletions(-)
>>>
>>> --
>>> 2.47.1
>>>
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH bpf-next 0/4] selftests/bpf: Fix a few test failures with arm64 64KB page
2025-06-06 16:49 ` Ihor Solodrai
@ 2025-06-06 16:57 ` Andrii Nakryiko
2025-06-06 17:15 ` Ihor Solodrai
2025-06-06 17:03 ` Yonghong Song
1 sibling, 1 reply; 17+ messages in thread
From: Andrii Nakryiko @ 2025-06-06 16:57 UTC (permalink / raw)
To: Ihor Solodrai
Cc: Yonghong Song, bpf, Alexei Starovoitov, Andrii Nakryiko,
Daniel Borkmann, kernel-team, Martin KaFai Lau
On Fri, Jun 6, 2025 at 9:49 AM Ihor Solodrai <ihor.solodrai@linux.dev> wrote:
>
> On 6/6/25 9:43 AM, Yonghong Song wrote:
> >
> >
> > On 6/6/25 9:30 AM, Andrii Nakryiko wrote:
> >> On Thu, Jun 5, 2025 at 8:23 PM Yonghong Song <yonghong.song@linux.dev>
> >> wrote:
> >>> My local arm64 host has 64KB page size and the VM to run test_progs
> >>> also has 64KB page size. There are a few self tests assuming 4KB page
> >>> and hence failed in my envorinment. Patch 1 tries to reduce long assert
> >> typo: environment
> >>
> >>> logs when tail failed. Patches 2-4 fixed three selftest failures.
> >> How come our BPF CI doesn't catch this on aarch64?.. Ihor, any thoughts?
> >
> > In CI for aarch64, the page size is 4KB. For example, for this link:
> >
> > https://github.com/kernel-patches/bpf/actions/runs/15482212552/
> > job/43590176563?pr=9053
> >
> > Find the kconfig, and we have
> >
> > CONFIG_ARM64_4K_PAGES=y
> > # CONFIG_ARM64_16K_PAGES is not set
> > # CONFIG_ARM64_64K_PAGES is not set
> >
> > and for 4K page, all these tests are fine, but not for 64K page.
>
> Ah right, I just realized the host pagesize doesn't matter, the kernel
> we are running tests against needs to be re-compiled with the right
> config.
>
> If this is important to test on CI, it can be another matrix dimension
> with customized kconfig. Do we want to do that?
>
Can we just use 64KB page size for aarch64 (no 4KB variant for arm64)?
>
> >
> >
> >>
> >>> Yonghong Song (4):
> >>> selftests/bpf: Reduce test_xdp_adjust_frags_tail_grow logs
> >>> selftests/bpf: Fix bpf_mod_race test failure with arm64 64KB page
> >>> size
> >>> selftests/bpf: Fix ringbuf/ringbuf_write test failure with arm64 64KB
> >>> page size
> >>> selftests/bpf: Fix a user_ringbuf failure with arm64 64KB page size
> >>>
> >>> .../selftests/bpf/prog_tests/bpf_mod_race.c | 2 +-
> >>> .../testing/selftests/bpf/prog_tests/ringbuf.c | 5 +++--
> >>> .../selftests/bpf/prog_tests/user_ringbuf.c | 6 ++++--
> >>> .../selftests/bpf/prog_tests/xdp_adjust_tail.c | 18 ++++++++++++------
> >>> .../selftests/bpf/progs/test_ringbuf_write.c | 5 +++--
> >>> 5 files changed, 23 insertions(+), 13 deletions(-)
> >>>
> >>> --
> >>> 2.47.1
> >>>
> >
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH bpf-next 0/4] selftests/bpf: Fix a few test failures with arm64 64KB page
2025-06-06 16:57 ` Andrii Nakryiko
@ 2025-06-06 17:15 ` Ihor Solodrai
2025-06-06 18:21 ` Andrii Nakryiko
0 siblings, 1 reply; 17+ messages in thread
From: Ihor Solodrai @ 2025-06-06 17:15 UTC (permalink / raw)
To: Andrii Nakryiko
Cc: Yonghong Song, bpf, Alexei Starovoitov, Andrii Nakryiko,
Daniel Borkmann, kernel-team, Martin KaFai Lau
On 6/6/25 9:57 AM, Andrii Nakryiko wrote:
> On Fri, Jun 6, 2025 at 9:49 AM Ihor Solodrai <ihor.solodrai@linux.dev> wrote:
>>
>> On 6/6/25 9:43 AM, Yonghong Song wrote:
>>>
>>>
>>> On 6/6/25 9:30 AM, Andrii Nakryiko wrote:
>>>> On Thu, Jun 5, 2025 at 8:23 PM Yonghong Song <yonghong.song@linux.dev>
>>>> wrote:
>>>>> My local arm64 host has 64KB page size and the VM to run test_progs
>>>>> also has 64KB page size. There are a few self tests assuming 4KB page
>>>>> and hence failed in my envorinment. Patch 1 tries to reduce long assert
>>>> typo: environment
>>>>
>>>>> logs when tail failed. Patches 2-4 fixed three selftest failures.
>>>> How come our BPF CI doesn't catch this on aarch64?.. Ihor, any thoughts?
>>>
>>> In CI for aarch64, the page size is 4KB. For example, for this link:
>>>
>>> https://github.com/kernel-patches/bpf/actions/runs/15482212552/
>>> job/43590176563?pr=9053
>>>
>>> Find the kconfig, and we have
>>>
>>> CONFIG_ARM64_4K_PAGES=y
>>> # CONFIG_ARM64_16K_PAGES is not set
>>> # CONFIG_ARM64_64K_PAGES is not set
>>>
>>> and for 4K page, all these tests are fine, but not for 64K page.
>>
>> Ah right, I just realized the host pagesize doesn't matter, the kernel
>> we are running tests against needs to be re-compiled with the right
>> config.
>>
>> If this is important to test on CI, it can be another matrix dimension
>> with customized kconfig. Do we want to do that?
>>
>
> Can we just use 64KB page size for aarch64 (no 4KB variant for arm64)?
We certainly can, but *not* testing 4k pages on any arch seems like a
bad idea to me.
If we think a step further, there are many permutations of important
configs that we do not test. And it's impractical to test *everything*
for each pending patch.
What we could do is split BPF CI into two domains:
* test most important configurations on every patch like we do now
* test other config permutations on base branches (bpf-next, bpf)
*sometimes*
We have reserved hardware that is often idle when there is low
activity on the list, and it could be used to run other things:
older/newer compilers, different page sizes, particular kconfigs etc.
This way we would catch problems earlier without overloading/expanding
the CI infra.
It's an effort to setup of course, but that's how I would approach it
if we're serious about testing uncommon things.
>>
>>>
>>>
>>>>
>>>>> Yonghong Song (4):
>>>>> selftests/bpf: Reduce test_xdp_adjust_frags_tail_grow logs
>>>>> selftests/bpf: Fix bpf_mod_race test failure with arm64 64KB page
>>>>> size
>>>>> selftests/bpf: Fix ringbuf/ringbuf_write test failure with arm64 64KB
>>>>> page size
>>>>> selftests/bpf: Fix a user_ringbuf failure with arm64 64KB page size
>>>>>
>>>>> .../selftests/bpf/prog_tests/bpf_mod_race.c | 2 +-
>>>>> .../testing/selftests/bpf/prog_tests/ringbuf.c | 5 +++--
>>>>> .../selftests/bpf/prog_tests/user_ringbuf.c | 6 ++++--
>>>>> .../selftests/bpf/prog_tests/xdp_adjust_tail.c | 18 ++++++++++++------
>>>>> .../selftests/bpf/progs/test_ringbuf_write.c | 5 +++--
>>>>> 5 files changed, 23 insertions(+), 13 deletions(-)
>>>>>
>>>>> --
>>>>> 2.47.1
>>>>>
>>>
>>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH bpf-next 0/4] selftests/bpf: Fix a few test failures with arm64 64KB page
2025-06-06 17:15 ` Ihor Solodrai
@ 2025-06-06 18:21 ` Andrii Nakryiko
0 siblings, 0 replies; 17+ messages in thread
From: Andrii Nakryiko @ 2025-06-06 18:21 UTC (permalink / raw)
To: Ihor Solodrai
Cc: Yonghong Song, bpf, Alexei Starovoitov, Andrii Nakryiko,
Daniel Borkmann, kernel-team, Martin KaFai Lau
On Fri, Jun 6, 2025 at 10:15 AM Ihor Solodrai <ihor.solodrai@linux.dev> wrote:
>
> On 6/6/25 9:57 AM, Andrii Nakryiko wrote:
> > On Fri, Jun 6, 2025 at 9:49 AM Ihor Solodrai <ihor.solodrai@linux.dev> wrote:
> >>
> >> On 6/6/25 9:43 AM, Yonghong Song wrote:
> >>>
> >>>
> >>> On 6/6/25 9:30 AM, Andrii Nakryiko wrote:
> >>>> On Thu, Jun 5, 2025 at 8:23 PM Yonghong Song <yonghong.song@linux.dev>
> >>>> wrote:
> >>>>> My local arm64 host has 64KB page size and the VM to run test_progs
> >>>>> also has 64KB page size. There are a few self tests assuming 4KB page
> >>>>> and hence failed in my envorinment. Patch 1 tries to reduce long assert
> >>>> typo: environment
> >>>>
> >>>>> logs when tail failed. Patches 2-4 fixed three selftest failures.
> >>>> How come our BPF CI doesn't catch this on aarch64?.. Ihor, any thoughts?
> >>>
> >>> In CI for aarch64, the page size is 4KB. For example, for this link:
> >>>
> >>> https://github.com/kernel-patches/bpf/actions/runs/15482212552/
> >>> job/43590176563?pr=9053
> >>>
> >>> Find the kconfig, and we have
> >>>
> >>> CONFIG_ARM64_4K_PAGES=y
> >>> # CONFIG_ARM64_16K_PAGES is not set
> >>> # CONFIG_ARM64_64K_PAGES is not set
> >>>
> >>> and for 4K page, all these tests are fine, but not for 64K page.
> >>
> >> Ah right, I just realized the host pagesize doesn't matter, the kernel
> >> we are running tests against needs to be re-compiled with the right
> >> config.
> >>
> >> If this is important to test on CI, it can be another matrix dimension
> >> with customized kconfig. Do we want to do that?
> >>
> >
> > Can we just use 64KB page size for aarch64 (no 4KB variant for arm64)?
>
> We certainly can, but *not* testing 4k pages on any arch seems like a
> bad idea to me.
No-no, x86 should stay 4KB (can it even be 64KB page size on x86?).
But if it's hard to do 64KB on AWS arm64, so be it.
>
> If we think a step further, there are many permutations of important
> configs that we do not test. And it's impractical to test *everything*
> for each pending patch.
>
> What we could do is split BPF CI into two domains:
> * test most important configurations on every patch like we do now
> * test other config permutations on base branches (bpf-next, bpf)
> *sometimes*
>
> We have reserved hardware that is often idle when there is low
> activity on the list, and it could be used to run other things:
> older/newer compilers, different page sizes, particular kconfigs etc.
>
> This way we would catch problems earlier without overloading/expanding
> the CI infra.
>
> It's an effort to setup of course, but that's how I would approach it
> if we're serious about testing uncommon things.
>
>
> >>
> >>>
> >>>
> >>>>
> >>>>> Yonghong Song (4):
> >>>>> selftests/bpf: Reduce test_xdp_adjust_frags_tail_grow logs
> >>>>> selftests/bpf: Fix bpf_mod_race test failure with arm64 64KB page
> >>>>> size
> >>>>> selftests/bpf: Fix ringbuf/ringbuf_write test failure with arm64 64KB
> >>>>> page size
> >>>>> selftests/bpf: Fix a user_ringbuf failure with arm64 64KB page size
> >>>>>
> >>>>> .../selftests/bpf/prog_tests/bpf_mod_race.c | 2 +-
> >>>>> .../testing/selftests/bpf/prog_tests/ringbuf.c | 5 +++--
> >>>>> .../selftests/bpf/prog_tests/user_ringbuf.c | 6 ++++--
> >>>>> .../selftests/bpf/prog_tests/xdp_adjust_tail.c | 18 ++++++++++++------
> >>>>> .../selftests/bpf/progs/test_ringbuf_write.c | 5 +++--
> >>>>> 5 files changed, 23 insertions(+), 13 deletions(-)
> >>>>>
> >>>>> --
> >>>>> 2.47.1
> >>>>>
> >>>
> >>
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH bpf-next 0/4] selftests/bpf: Fix a few test failures with arm64 64KB page
2025-06-06 16:49 ` Ihor Solodrai
2025-06-06 16:57 ` Andrii Nakryiko
@ 2025-06-06 17:03 ` Yonghong Song
2025-06-06 17:19 ` Ihor Solodrai
1 sibling, 1 reply; 17+ messages in thread
From: Yonghong Song @ 2025-06-06 17:03 UTC (permalink / raw)
To: Ihor Solodrai, Andrii Nakryiko
Cc: bpf, Alexei Starovoitov, Andrii Nakryiko, Daniel Borkmann,
kernel-team, Martin KaFai Lau
On 6/6/25 9:49 AM, Ihor Solodrai wrote:
> On 6/6/25 9:43 AM, Yonghong Song wrote:
>>
>>
>> On 6/6/25 9:30 AM, Andrii Nakryiko wrote:
>>> On Thu, Jun 5, 2025 at 8:23 PM Yonghong Song
>>> <yonghong.song@linux.dev> wrote:
>>>> My local arm64 host has 64KB page size and the VM to run test_progs
>>>> also has 64KB page size. There are a few self tests assuming 4KB page
>>>> and hence failed in my envorinment. Patch 1 tries to reduce long
>>>> assert
>>> typo: environment
>>>
>>>> logs when tail failed. Patches 2-4 fixed three selftest failures.
>>> How come our BPF CI doesn't catch this on aarch64?.. Ihor, any
>>> thoughts?
>>
>> In CI for aarch64, the page size is 4KB. For example, for this link:
>>
>> https://github.com/kernel-patches/bpf/actions/runs/15482212552/
>> job/43590176563?pr=9053
>>
>> Find the kconfig, and we have
>>
>> CONFIG_ARM64_4K_PAGES=y
>> # CONFIG_ARM64_16K_PAGES is not set
>> # CONFIG_ARM64_64K_PAGES is not set
>>
>> and for 4K page, all these tests are fine, but not for 64K page.
>
> Ah right, I just realized the host pagesize doesn't matter, the kernel
> we are running tests against needs to be re-compiled with the right
> config.
Actually, the host pagesize matters too.
For example, for trace_printk.lskel.h which is used to build bpf binary at
an aarch64 host and that aarch64 host is 64KB page.
In trace_printk.lskel.h, we have
...
skel->bss = skel_finalize_map_data(&skel->maps.bss.initial_value,
65536, PROT_READ | PROT_WRITE, skel->maps.bss.map_fd);
...
Note that the number '65536' is used here to do mmap.
For an x86 host, the number will be 4096 (4KB) instead of 64KB.
For this bpf prog on aarch64, if the VM has page size 4KB,
something could go wrong.
So the best is to have the same page size for host and VM for selftests.
>
> If this is important to test on CI, it can be another matrix dimension
> with customized kconfig. Do we want to do that?
>
>
>>
>>
>>>
>>>> Yonghong Song (4):
>>>> selftests/bpf: Reduce test_xdp_adjust_frags_tail_grow logs
>>>> selftests/bpf: Fix bpf_mod_race test failure with arm64 64KB
>>>> page size
>>>> selftests/bpf: Fix ringbuf/ringbuf_write test failure with arm64
>>>> 64KB
>>>> page size
>>>> selftests/bpf: Fix a user_ringbuf failure with arm64 64KB page size
>>>>
>>>> .../selftests/bpf/prog_tests/bpf_mod_race.c | 2 +-
>>>> .../testing/selftests/bpf/prog_tests/ringbuf.c | 5 +++--
>>>> .../selftests/bpf/prog_tests/user_ringbuf.c | 6 ++++--
>>>> .../selftests/bpf/prog_tests/xdp_adjust_tail.c | 18
>>>> ++++++++++++------
>>>> .../selftests/bpf/progs/test_ringbuf_write.c | 5 +++--
>>>> 5 files changed, 23 insertions(+), 13 deletions(-)
>>>>
>>>> --
>>>> 2.47.1
>>>>
>>
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH bpf-next 0/4] selftests/bpf: Fix a few test failures with arm64 64KB page
2025-06-06 17:03 ` Yonghong Song
@ 2025-06-06 17:19 ` Ihor Solodrai
2025-06-06 18:11 ` Yonghong Song
0 siblings, 1 reply; 17+ messages in thread
From: Ihor Solodrai @ 2025-06-06 17:19 UTC (permalink / raw)
To: Yonghong Song, Andrii Nakryiko
Cc: bpf, Alexei Starovoitov, Andrii Nakryiko, Daniel Borkmann,
kernel-team, Martin KaFai Lau
On 6/6/25 10:03 AM, Yonghong Song wrote:
>
>
> On 6/6/25 9:49 AM, Ihor Solodrai wrote:
>> On 6/6/25 9:43 AM, Yonghong Song wrote:
>>>
>>>
>>> On 6/6/25 9:30 AM, Andrii Nakryiko wrote:
>>>> On Thu, Jun 5, 2025 at 8:23 PM Yonghong Song
>>>> <yonghong.song@linux.dev> wrote:
>>>>> My local arm64 host has 64KB page size and the VM to run test_progs
>>>>> also has 64KB page size. There are a few self tests assuming 4KB page
>>>>> and hence failed in my envorinment. Patch 1 tries to reduce long
>>>>> assert
>>>> typo: environment
>>>>
>>>>> logs when tail failed. Patches 2-4 fixed three selftest failures.
>>>> How come our BPF CI doesn't catch this on aarch64?.. Ihor, any
>>>> thoughts?
>>>
>>> In CI for aarch64, the page size is 4KB. For example, for this link:
>>>
>>> https://github.com/kernel-patches/bpf/actions/runs/15482212552/
>>> job/43590176563?pr=9053
>>>
>>> Find the kconfig, and we have
>>>
>>> CONFIG_ARM64_4K_PAGES=y
>>> # CONFIG_ARM64_16K_PAGES is not set
>>> # CONFIG_ARM64_64K_PAGES is not set
>>>
>>> and for 4K page, all these tests are fine, but not for 64K page.
>>
>> Ah right, I just realized the host pagesize doesn't matter, the kernel
>> we are running tests against needs to be re-compiled with the right
>> config.
>
> Actually, the host pagesize matters too.
>
> For example, for trace_printk.lskel.h which is used to build bpf binary at
> an aarch64 host and that aarch64 host is 64KB page.
> In trace_printk.lskel.h, we have
> ...
> skel->bss = skel_finalize_map_data(&skel->maps.bss.initial_value,
> 65536, PROT_READ | PROT_WRITE, skel->maps.bss.map_fd);
> ...
>
> Note that the number '65536' is used here to do mmap.
>
> For an x86 host, the number will be 4096 (4KB) instead of 64KB.
>
> For this bpf prog on aarch64, if the VM has page size 4KB,
> something could go wrong.
>
> So the best is to have the same page size for host and VM for selftests.
If the host/vm page size difference only impacts certain tests, we
could denylist them. But if it makes the kernel or selftests more
unstable in general, then we'll have to switch the hosts.
I don't know how difficult it is to get a 64k page machine on AWS,
could be a challenge.
>
>
>>
>> If this is important to test on CI, it can be another matrix dimension
>> with customized kconfig. Do we want to do that?
>>
>>
>>>
>>>
>>>>
>>>>> Yonghong Song (4):
>>>>> selftests/bpf: Reduce test_xdp_adjust_frags_tail_grow logs
>>>>> selftests/bpf: Fix bpf_mod_race test failure with arm64 64KB
>>>>> page size
>>>>> selftests/bpf: Fix ringbuf/ringbuf_write test failure with arm64
>>>>> 64KB
>>>>> page size
>>>>> selftests/bpf: Fix a user_ringbuf failure with arm64 64KB page size
>>>>>
>>>>> .../selftests/bpf/prog_tests/bpf_mod_race.c | 2 +-
>>>>> .../testing/selftests/bpf/prog_tests/ringbuf.c | 5 +++--
>>>>> .../selftests/bpf/prog_tests/user_ringbuf.c | 6 ++++--
>>>>> .../selftests/bpf/prog_tests/xdp_adjust_tail.c | 18 +++++++++++
>>>>> +------
>>>>> .../selftests/bpf/progs/test_ringbuf_write.c | 5 +++--
>>>>> 5 files changed, 23 insertions(+), 13 deletions(-)
>>>>>
>>>>> --
>>>>> 2.47.1
>>>>>
>>>
>>
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH bpf-next 0/4] selftests/bpf: Fix a few test failures with arm64 64KB page
2025-06-06 17:19 ` Ihor Solodrai
@ 2025-06-06 18:11 ` Yonghong Song
0 siblings, 0 replies; 17+ messages in thread
From: Yonghong Song @ 2025-06-06 18:11 UTC (permalink / raw)
To: Ihor Solodrai, Andrii Nakryiko
Cc: bpf, Alexei Starovoitov, Andrii Nakryiko, Daniel Borkmann,
kernel-team, Martin KaFai Lau
On 6/6/25 10:19 AM, Ihor Solodrai wrote:
> On 6/6/25 10:03 AM, Yonghong Song wrote:
>>
>>
>> On 6/6/25 9:49 AM, Ihor Solodrai wrote:
>>> On 6/6/25 9:43 AM, Yonghong Song wrote:
>>>>
>>>>
>>>> On 6/6/25 9:30 AM, Andrii Nakryiko wrote:
>>>>> On Thu, Jun 5, 2025 at 8:23 PM Yonghong Song
>>>>> <yonghong.song@linux.dev> wrote:
>>>>>> My local arm64 host has 64KB page size and the VM to run test_progs
>>>>>> also has 64KB page size. There are a few self tests assuming 4KB
>>>>>> page
>>>>>> and hence failed in my envorinment. Patch 1 tries to reduce long
>>>>>> assert
>>>>> typo: environment
>>>>>
>>>>>> logs when tail failed. Patches 2-4 fixed three selftest failures.
>>>>> How come our BPF CI doesn't catch this on aarch64?.. Ihor, any
>>>>> thoughts?
>>>>
>>>> In CI for aarch64, the page size is 4KB. For example, for this link:
>>>>
>>>> https://github.com/kernel-patches/bpf/actions/runs/15482212552/
>>>> job/43590176563?pr=9053
>>>>
>>>> Find the kconfig, and we have
>>>>
>>>> CONFIG_ARM64_4K_PAGES=y
>>>> # CONFIG_ARM64_16K_PAGES is not set
>>>> # CONFIG_ARM64_64K_PAGES is not set
>>>>
>>>> and for 4K page, all these tests are fine, but not for 64K page.
>>>
>>> Ah right, I just realized the host pagesize doesn't matter, the kernel
>>> we are running tests against needs to be re-compiled with the right
>>> config.
>>
>> Actually, the host pagesize matters too.
>>
>> For example, for trace_printk.lskel.h which is used to build bpf
>> binary at
>> an aarch64 host and that aarch64 host is 64KB page.
>> In trace_printk.lskel.h, we have
>> ...
>> skel->bss = skel_finalize_map_data(&skel->maps.bss.initial_value,
>> 65536, PROT_READ | PROT_WRITE, skel->maps.bss.map_fd);
>> ...
>>
>> Note that the number '65536' is used here to do mmap.
>>
>> For an x86 host, the number will be 4096 (4KB) instead of 64KB.
>>
>> For this bpf prog on aarch64, if the VM has page size 4KB,
>> something could go wrong.
>>
>> So the best is to have the same page size for host and VM for selftests.
>
> If the host/vm page size difference only impacts certain tests, we
For an arm64 host with 64KB page size,
I tested with VM with 4KB and 64KB page size.
Using 4KB page in VM will have 10 more test failures
compared to 64KB page in VM.
> could denylist them. But if it makes the kernel or selftests more
> unstable in general, then we'll have to switch the hosts.
>
> I don't know how difficult it is to get a 64k page machine on AWS,
> could be a challenge.
I agreed with Andrii. It would be great if we can replace a machine
with 64KB so we won't increase capacity and have one more page
size to test. Not sure how difficult it is.
>
>>
>>
>>>
>>> If this is important to test on CI, it can be another matrix dimension
>>> with customized kconfig. Do we want to do that?
>>>
>>>
>>>>
>>>>
>>>>>
>>>>>> Yonghong Song (4):
>>>>>> selftests/bpf: Reduce test_xdp_adjust_frags_tail_grow logs
>>>>>> selftests/bpf: Fix bpf_mod_race test failure with arm64 64KB
>>>>>> page size
>>>>>> selftests/bpf: Fix ringbuf/ringbuf_write test failure with
>>>>>> arm64 64KB
>>>>>> page size
>>>>>> selftests/bpf: Fix a user_ringbuf failure with arm64 64KB page
>>>>>> size
>>>>>>
>>>>>> .../selftests/bpf/prog_tests/bpf_mod_race.c | 2 +-
>>>>>> .../testing/selftests/bpf/prog_tests/ringbuf.c | 5 +++--
>>>>>> .../selftests/bpf/prog_tests/user_ringbuf.c | 6 ++++--
>>>>>> .../selftests/bpf/prog_tests/xdp_adjust_tail.c | 18 +++++++++++
>>>>>> +------
>>>>>> .../selftests/bpf/progs/test_ringbuf_write.c | 5 +++--
>>>>>> 5 files changed, 23 insertions(+), 13 deletions(-)
>>>>>>
>>>>>> --
>>>>>> 2.47.1
>>>>>>
>>>>
>>>
>>
>
^ permalink raw reply [flat|nested] 17+ messages in thread