All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yonghong Song <yonghong.song@linux.dev>
To: Amery Hung <ameryhung@gmail.com>
Cc: bpf@vger.kernel.org, Alexei Starovoitov <ast@kernel.org>,
	Andrii Nakryiko <andrii@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	kernel-team@fb.com, Martin KaFai Lau <martin.lau@kernel.org>,
	Alan Maguire <alan.maguire@oracle.com>
Subject: Re: [PATCH bpf-next v2 2/2] selftests/bpf: Fix xdp_pull_data failure with 64K page
Date: Thu, 22 Jan 2026 13:28:04 -0800	[thread overview]
Message-ID: <4a41cc0f-e409-478f-ad71-103de63cfacb@linux.dev> (raw)
In-Reply-To: <CAMB2axP_AaoiZB9BSQ3Mz_M0e0t1S-y3u8KnBx1FY1nCq3qN6Q@mail.gmail.com>



On 1/22/26 1:18 PM, Amery Hung wrote:
> On Thu, Jan 22, 2026 at 8:56 AM Yonghong Song <yonghong.song@linux.dev> wrote:
>> 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
>>    2 * 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>
>> ---
>>   .../testing/selftests/bpf/prog_tests/xdp_pull_data.c | 12 +++++++-----
>>   1 file changed, 7 insertions(+), 5 deletions(-)
>>
>> Changelog:
>>   v1 -> v2:
>>     - v1: https://lore.kernel.org/bpf/20260120210930.2544950-1-yonghong.song@linux.dev/
>>     - Use pg_sz to simplify buff_len calculation.
>>
>> diff --git a/tools/testing/selftests/bpf/prog_tests/xdp_pull_data.c b/tools/testing/selftests/bpf/prog_tests/xdp_pull_data.c
>> index efa350d04ec5..35f0eb5b43f3 100644
>> --- a/tools/testing/selftests/bpf/prog_tests/xdp_pull_data.c
>> +++ b/tools/testing/selftests/bpf/prog_tests/xdp_pull_data.c
>> @@ -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 = 2 * pg_sz + pg_sz / 2;
> Thanks for fixing the test. Just curious if there is an issue with 1.5
> pg_sz as suggested by Alan?

Yes. It works fine with 1.5 pg_sz too. I picked '2 * pg_sz + pg_sz / 2'
as for 4K page, 9000 will have 2 frags and I intend to maintain
2 frags for the tests.

>
>>          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,7 +156,7 @@ 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 */
>> @@ -165,7 +167,7 @@ static void test_xdp_pull_data_basic(void)
>>                   PULL_MAX | PULL_PLUS_ONE);
> We should also change these two cases above to use buff_len to make
> sure we are testing the right logic in bpf_xdp_pull_data().

Sure. Will do. Replacing 9000 with buff_len for those two cases
works okay too for both x86 and 64-page arm64.

>
>>          /* 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:
>> --
>> 2.47.3
>>
>>


  reply	other threads:[~2026-01-22 21:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-22 16:26 [PATCH bpf-next v2 1/2] selftests/bpf: Fix task_local_data failure with 64K page Yonghong Song
2026-01-22 16:26 ` [PATCH bpf-next v2 2/2] selftests/bpf: Fix xdp_pull_data " Yonghong Song
2026-01-22 21:18   ` Amery Hung
2026-01-22 21:28     ` Yonghong Song [this message]
2026-01-22 21:38     ` Yonghong Song
2026-01-22 21:53       ` Amery Hung
2026-01-22 21:49 ` [PATCH bpf-next v2 1/2] selftests/bpf: Fix task_local_data " Amery Hung
2026-01-22 22:58   ` Yonghong Song
2026-01-22 23:34     ` Alexei Starovoitov
2026-01-22 23:47     ` Amery Hung
2026-01-23  0:23       ` Yonghong Song

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4a41cc0f-e409-478f-ad71-103de63cfacb@linux.dev \
    --to=yonghong.song@linux.dev \
    --cc=alan.maguire@oracle.com \
    --cc=ameryhung@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=kernel-team@fb.com \
    --cc=martin.lau@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.