.../bpf/prog_tests/xdp_adjust_tail.c | 160 +++++++++++++----- .../bpf/progs/test_xdp_adjust_tail_grow.c | 41 +++-- 2 files changed, 149 insertions(+), 52 deletions(-)
For platforms on powerpc architecture with a default page size greater
than 4096, there was an inconsistency in fragment size calculation.
This caused the BPF selftest xdp_adjust_tail/xdp_adjust_frags_tail_grow
to fail on powerpc.
The issue occurred because the fragment buffer size in
bpf_prog_test_run_xdp() was set to 4096, while the actual data size in
the fragment within the shared skb was checked against PAGE_SIZE
(65536 on powerpc) in min_t, causing it to exceed 4096 and be set
accordingly. This discrepancy led to an overflow when
bpf_xdp_frags_increase_tail() checked for tailroom, as skb_frag_size(frag)
could be greater than rxq->frag_size (when PAGE_SIZE > 4096).
This change fixes:
1. test_run by getting the correct arch dependent PAGE_SIZE.
2. selftest by caculating tailroom and getting correct PAGE_SIZE.
Changes:
v1 -> v2:
* Address comments from Alexander
* Use dynamic page size, cacheline size and size of
struct skb_shared_info to calculate parameters.
* Fixed both test_run and selftest.
v1: https://lore.kernel.org/all/20250122183720.1411176-1-skb99@linux.ibm.com/
Saket Kumar Bhaskar (2):
bpf, test_run: Replace hardcoded page size with dynamic PAGE_SIZE in
test_run
selftests/bpf: Refactor xdp_adjust_tail selftest with dynamic sizing
.../bpf/prog_tests/xdp_adjust_tail.c | 160 +++++++++++++-----
.../bpf/progs/test_xdp_adjust_tail_grow.c | 41 +++--
2 files changed, 149 insertions(+), 52 deletions(-)
--
2.43.5
On 05/03/25 10:43 pm, Saket Kumar Bhaskar wrote: > For platforms on powerpc architecture with a default page size greater > than 4096, there was an inconsistency in fragment size calculation. > This caused the BPF selftest xdp_adjust_tail/xdp_adjust_frags_tail_grow > to fail on powerpc. > > The issue occurred because the fragment buffer size in > bpf_prog_test_run_xdp() was set to 4096, while the actual data size in > the fragment within the shared skb was checked against PAGE_SIZE > (65536 on powerpc) in min_t, causing it to exceed 4096 and be set > accordingly. This discrepancy led to an overflow when > bpf_xdp_frags_increase_tail() checked for tailroom, as skb_frag_size(frag) > could be greater than rxq->frag_size (when PAGE_SIZE > 4096). > > This change fixes: > > 1. test_run by getting the correct arch dependent PAGE_SIZE. > 2. selftest by caculating tailroom and getting correct PAGE_SIZE. > > Changes: > v1 -> v2: > * Address comments from Alexander > * Use dynamic page size, cacheline size and size of > struct skb_shared_info to calculate parameters. > * Fixed both test_run and selftest. > > v1: https://lore.kernel.org/all/20250122183720.1411176-1-skb99@linux.ibm.com/ > > Saket Kumar Bhaskar (2): > bpf, test_run: Replace hardcoded page size with dynamic PAGE_SIZE in > test_run > selftests/bpf: Refactor xdp_adjust_tail selftest with dynamic sizing > > .../bpf/prog_tests/xdp_adjust_tail.c | 160 +++++++++++++----- > .../bpf/progs/test_xdp_adjust_tail_grow.c | 41 +++-- > 2 files changed, 149 insertions(+), 52 deletions(-) > Applied the patch series on the bpf-next and patch works as expected. With Out the Patch: test_xdp_adjust_frags_tail_grow:PASS:9Kb+10b 0 nsec test_xdp_adjust_frags_tail_grow:FAIL:9Kb+10b retval unexpected 9Kb+10b retval: actual 3 != expected 1 test_xdp_adjust_frags_tail_grow:FAIL:9Kb+10b size unexpected 9Kb+10b size: actual 13097 != expected 9001 #583/5 xdp_adjust_tail/xdp_adjust_frags_tail_grow:FAIL #583 xdp_adjust_tail:FAIL Summary: 0/4 PASSED, 0 SKIPPED, 1 FAILED With Patch: # ./test_progs -t xdp_adjust_tail #583/1 xdp_adjust_tail/xdp_adjust_tail_shrink:OK #583/2 xdp_adjust_tail/xdp_adjust_tail_grow:OK #583/3 xdp_adjust_tail/xdp_adjust_tail_grow2:OK #583/4 xdp_adjust_tail/xdp_adjust_frags_tail_shrink:OK #583/5 xdp_adjust_tail/xdp_adjust_frags_tail_grow:OK #583 xdp_adjust_tail:OK Summary: 1/5 PASSED, 0 SKIPPED, 0 FAILED Please add below tag to all the patches in series. Tested-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com> Regards, Venkat.
Gentle Ping... Hi Alexander and other net bpf guys, it would be great if you could share your feedback whenever you have a moment. Please do let me know if there's any additional change needed. Thanks, Saket On Fri, Mar 07, 2025 at 08:54:00PM +0530, Venkat Rao Bagalkote wrote: > > On 05/03/25 10:43 pm, Saket Kumar Bhaskar wrote: > > For platforms on powerpc architecture with a default page size greater > > than 4096, there was an inconsistency in fragment size calculation. > > This caused the BPF selftest xdp_adjust_tail/xdp_adjust_frags_tail_grow > > to fail on powerpc. > > > > The issue occurred because the fragment buffer size in > > bpf_prog_test_run_xdp() was set to 4096, while the actual data size in > > the fragment within the shared skb was checked against PAGE_SIZE > > (65536 on powerpc) in min_t, causing it to exceed 4096 and be set > > accordingly. This discrepancy led to an overflow when > > bpf_xdp_frags_increase_tail() checked for tailroom, as skb_frag_size(frag) > > could be greater than rxq->frag_size (when PAGE_SIZE > 4096). > > > > This change fixes: > > > > 1. test_run by getting the correct arch dependent PAGE_SIZE. > > 2. selftest by caculating tailroom and getting correct PAGE_SIZE. > > > > Changes: > > v1 -> v2: > > * Address comments from Alexander > > * Use dynamic page size, cacheline size and size of > > struct skb_shared_info to calculate parameters. > > * Fixed both test_run and selftest. > > > > v1: https://lore.kernel.org/all/20250122183720.1411176-1-skb99@linux.ibm.com/ > > > > Saket Kumar Bhaskar (2): > > bpf, test_run: Replace hardcoded page size with dynamic PAGE_SIZE in > > test_run > > selftests/bpf: Refactor xdp_adjust_tail selftest with dynamic sizing > > > > .../bpf/prog_tests/xdp_adjust_tail.c | 160 +++++++++++++----- > > .../bpf/progs/test_xdp_adjust_tail_grow.c | 41 +++-- > > 2 files changed, 149 insertions(+), 52 deletions(-) > > > Applied the patch series on the bpf-next and patch works as expected. > > > With Out the Patch: > > test_xdp_adjust_frags_tail_grow:PASS:9Kb+10b 0 nsec > test_xdp_adjust_frags_tail_grow:FAIL:9Kb+10b retval unexpected 9Kb+10b > retval: actual 3 != expected 1 > test_xdp_adjust_frags_tail_grow:FAIL:9Kb+10b size unexpected 9Kb+10b size: > actual 13097 != expected 9001 > #583/5 xdp_adjust_tail/xdp_adjust_frags_tail_grow:FAIL > #583 xdp_adjust_tail:FAIL > Summary: 0/4 PASSED, 0 SKIPPED, 1 FAILED > > > With Patch: > > # ./test_progs -t xdp_adjust_tail > #583/1 xdp_adjust_tail/xdp_adjust_tail_shrink:OK > #583/2 xdp_adjust_tail/xdp_adjust_tail_grow:OK > #583/3 xdp_adjust_tail/xdp_adjust_tail_grow2:OK > #583/4 xdp_adjust_tail/xdp_adjust_frags_tail_shrink:OK > #583/5 xdp_adjust_tail/xdp_adjust_frags_tail_grow:OK > #583 xdp_adjust_tail:OK > Summary: 1/5 PASSED, 0 SKIPPED, 0 FAILED > > > Please add below tag to all the patches in series. > > Tested-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com> > > > Regards, > > Venkat. >
On Fri, Mar 07, 2025 at 08:54:00PM +0530, Venkat Rao Bagalkote wrote: > > On 05/03/25 10:43 pm, Saket Kumar Bhaskar wrote: > > For platforms on powerpc architecture with a default page size greater > > than 4096, there was an inconsistency in fragment size calculation. > > This caused the BPF selftest xdp_adjust_tail/xdp_adjust_frags_tail_grow > > to fail on powerpc. > > > > The issue occurred because the fragment buffer size in > > bpf_prog_test_run_xdp() was set to 4096, while the actual data size in > > the fragment within the shared skb was checked against PAGE_SIZE > > (65536 on powerpc) in min_t, causing it to exceed 4096 and be set > > accordingly. This discrepancy led to an overflow when > > bpf_xdp_frags_increase_tail() checked for tailroom, as skb_frag_size(frag) > > could be greater than rxq->frag_size (when PAGE_SIZE > 4096). > > > > This change fixes: > > > > 1. test_run by getting the correct arch dependent PAGE_SIZE. > > 2. selftest by caculating tailroom and getting correct PAGE_SIZE. > > > > Changes: > > v1 -> v2: > > * Address comments from Alexander > > * Use dynamic page size, cacheline size and size of > > struct skb_shared_info to calculate parameters. > > * Fixed both test_run and selftest. > > > > v1: https://lore.kernel.org/all/20250122183720.1411176-1-skb99@linux.ibm.com/ > > > > Saket Kumar Bhaskar (2): > > bpf, test_run: Replace hardcoded page size with dynamic PAGE_SIZE in > > test_run > > selftests/bpf: Refactor xdp_adjust_tail selftest with dynamic sizing > > > > .../bpf/prog_tests/xdp_adjust_tail.c | 160 +++++++++++++----- > > .../bpf/progs/test_xdp_adjust_tail_grow.c | 41 +++-- > > 2 files changed, 149 insertions(+), 52 deletions(-) > > > Applied the patch series on the bpf-next and patch works as expected. > > > With Out the Patch: > > test_xdp_adjust_frags_tail_grow:PASS:9Kb+10b 0 nsec > test_xdp_adjust_frags_tail_grow:FAIL:9Kb+10b retval unexpected 9Kb+10b > retval: actual 3 != expected 1 > test_xdp_adjust_frags_tail_grow:FAIL:9Kb+10b size unexpected 9Kb+10b size: > actual 13097 != expected 9001 > #583/5 xdp_adjust_tail/xdp_adjust_frags_tail_grow:FAIL > #583 xdp_adjust_tail:FAIL > Summary: 0/4 PASSED, 0 SKIPPED, 1 FAILED > > > With Patch: > > # ./test_progs -t xdp_adjust_tail > #583/1 xdp_adjust_tail/xdp_adjust_tail_shrink:OK > #583/2 xdp_adjust_tail/xdp_adjust_tail_grow:OK > #583/3 xdp_adjust_tail/xdp_adjust_tail_grow2:OK > #583/4 xdp_adjust_tail/xdp_adjust_frags_tail_shrink:OK > #583/5 xdp_adjust_tail/xdp_adjust_frags_tail_grow:OK > #583 xdp_adjust_tail:OK > Summary: 1/5 PASSED, 0 SKIPPED, 0 FAILED > > > Please add below tag to all the patches in series. > > Tested-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com> > > > Regards, > > Venkat. > Thanks for testing this Venkat. Regards, Saket
© 2016 - 2026 Red Hat, Inc.