mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-04-08 12:02:33 +02:00
selftests/bpf: Fix ringbuf/ringbuf_write test failure with arm64 64KB page size
[ Upstream commit 8c8c5e3c85 ]
The ringbuf max_entries must be PAGE_ALIGNED. See kernel function
ringbuf_map_alloc(). So for arm64 64KB page size, adjust max_entries
and other related metrics properly.
Signed-off-by: Yonghong Song <yonghong.song@linux.dev>
Link: https://lore.kernel.org/r/20250607013621.1552332-1-yonghong.song@linux.dev
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
c14bf7f873
commit
e49253b504
@@ -97,7 +97,7 @@ 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 = 0x40000;
|
||||
|
||||
err = test_ringbuf_write_lskel__load(skel);
|
||||
if (!ASSERT_OK(err, "skel_load"))
|
||||
@@ -108,7 +108,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 = 0x30000;
|
||||
ASSERT_OK(munmap(mmap_ptr, page_size), "unmap_rw");
|
||||
|
||||
skel->bss->pid = getpid();
|
||||
|
||||
@@ -26,11 +26,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, 0x30000, 0);
|
||||
if (!sample1)
|
||||
return 0;
|
||||
/* first one can pass */
|
||||
sample2 = bpf_ringbuf_reserve(&ringbuf, 0x3000, 0);
|
||||
sample2 = bpf_ringbuf_reserve(&ringbuf, 0x30000, 0);
|
||||
if (!sample2) {
|
||||
bpf_ringbuf_discard(sample1, 0);
|
||||
__sync_fetch_and_add(&discarded, 1);
|
||||
|
||||
Reference in New Issue
Block a user