Skip to content

Fix xdp_adjust_frags_tail_grow selftest on powerpc

Saket Kumar Bhaskar bpf linux-kselftest lkml netdev 2 versions – Applied

Status from this message: Applied the patch series on the bpf-next and patch works as expected.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 3 repliesApplied
  2. v13 patches 9 repliesSuperseded

Changes in v2 from the cover letter

* 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.

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/2bpf, test_run: Replace hardcoded page size with dynamic PAGE_SIZE in test_runnet/bpf/test_run.c+1 -10 replies
2/2selftests/bpf: Refactor xdp_adjust_tail selftest with dynamic sizingtools/testing/selftests/bpf/prog_tests/xdp_adjust_tail.c tools/testing/selftests/bpf/progs/test_xdp_adjust_tail_grow.c+149 -520 replies

Reviews trailers per patch

None of the 2 patches has a Reviewed-by or Acked-by.

PatchVenkat Rao Bagalkote
SeriesT-b
1/2
2/2

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/2] Fix xdp_adjust_frags_tail_grow selftest on powerpc

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/[email protected]/

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(-)
Signature · 1 line
2.43.5