]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
selftests/bpf: Fix xdp_pull_data failure with 64K page
authorYonghong Song <yonghong.song@linux.dev>
Fri, 23 Jan 2026 05:51:28 +0000 (21:51 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Sun, 25 Jan 2026 00:51:22 +0000 (16:51 -0800)
If the argument 'pull_len' of run_test() is 'PULL_MAX' or
'PULL_MAX | PULL_PLUS_ONE', the eventual pull_len size
will close to the page size. On arm64 systems with 64K pages,
the pull_len size will be close to 64K. But the existing buffer
will be close to 9000 which is not enough to pull.

For those failed run_tests(), make buff size to
  pg_sz + (pg_sz / 2)
This way, there will be enough buffer space to pull
regardless of page size.

Tested-by: Alan Maguire <alan.maguire@oracle.com>
Cc: Amery Hung <ameryhung@gmail.com>
Signed-off-by: Yonghong Song <yonghong.song@linux.dev>
Acked-by: Amery Hung <ameryhung@gmail.com>
Link: https://lore.kernel.org/r/20260123055128.495265-1-yonghong.song@linux.dev
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/prog_tests/xdp_pull_data.c

index efa350d04ec5ff0bc3eef6fa24fe528ad64db224..910dabe95afddf2ee829107e0accc8c58d1495d7 100644 (file)
@@ -114,12 +114,14 @@ static void test_xdp_pull_data_basic(void)
 {
        u32 pg_sz, max_meta_len, max_data_len;
        struct test_xdp_pull_data *skel;
+       int buff_len;
 
        skel = test_xdp_pull_data__open_and_load();
        if (!ASSERT_OK_PTR(skel, "test_xdp_pull_data__open_and_load"))
                return;
 
        pg_sz = sysconf(_SC_PAGE_SIZE);
+       buff_len = pg_sz + pg_sz / 2;
 
        if (find_xdp_sizes(skel, pg_sz))
                goto out;
@@ -140,13 +142,13 @@ static void test_xdp_pull_data_basic(void)
        run_test(skel, XDP_PASS, pg_sz, 9000, 0, 1025, 1025);
 
        /* multi-buf pkt, empty linear data area, pull requires memmove */
-       run_test(skel, XDP_PASS, pg_sz, 9000, 0, 0, PULL_MAX);
+       run_test(skel, XDP_PASS, pg_sz, buff_len, 0, 0, PULL_MAX);
 
        /* multi-buf pkt, no headroom */
-       run_test(skel, XDP_PASS, pg_sz, 9000, max_meta_len, 1024, PULL_MAX);
+       run_test(skel, XDP_PASS, pg_sz, buff_len, max_meta_len, 1024, PULL_MAX);
 
        /* multi-buf pkt, no tailroom, pull requires memmove */
-       run_test(skel, XDP_PASS, pg_sz, 9000, 0, max_data_len, PULL_MAX);
+       run_test(skel, XDP_PASS, pg_sz, buff_len, 0, max_data_len, PULL_MAX);
 
        /* Test cases with invalid pull length */
 
@@ -154,18 +156,18 @@ static void test_xdp_pull_data_basic(void)
        run_test(skel, XDP_DROP, pg_sz, 2048, 0, 2048, 2049);
 
        /* multi-buf pkt with no space left in linear data area */
-       run_test(skel, XDP_DROP, pg_sz, 9000, max_meta_len, max_data_len,
+       run_test(skel, XDP_DROP, pg_sz, buff_len, max_meta_len, max_data_len,
                 PULL_MAX | PULL_PLUS_ONE);
 
        /* multi-buf pkt, empty linear data area */
-       run_test(skel, XDP_DROP, pg_sz, 9000, 0, 0, PULL_MAX | PULL_PLUS_ONE);
+       run_test(skel, XDP_DROP, pg_sz, buff_len, 0, 0, PULL_MAX | PULL_PLUS_ONE);
 
        /* multi-buf pkt, no headroom */
-       run_test(skel, XDP_DROP, pg_sz, 9000, max_meta_len, 1024,
+       run_test(skel, XDP_DROP, pg_sz, buff_len, max_meta_len, 1024,
                 PULL_MAX | PULL_PLUS_ONE);
 
        /* multi-buf pkt, no tailroom */
-       run_test(skel, XDP_DROP, pg_sz, 9000, 0, max_data_len,
+       run_test(skel, XDP_DROP, pg_sz, buff_len, 0, max_data_len,
                 PULL_MAX | PULL_PLUS_ONE);
 
 out: