Skip to content

samples: bpf: refactor BPF map test with libbpf

Daniel T. Lee bpf netdev 2 versions – Applied

Status from this message: Applied, thanks everyone!

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest4 patches 4 repliesApplied
  2. v14 patches 14 repliesSuperseded

Changes in v2 from the cover letter

- instead of changing event from __x64_sys_connect to __sys_connect, fetch and set register values directly
- fix wrong error check logic with bpf_program
- set numa_node 0 declaratively at map definition instead of setting it from user-space
- static initialization of ARRAY_OF_MAPS element with '.values'

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/4samples: bpf: fix bpf programs with kprobe/sys_connect eventsamples/bpf/map_perf_test_kern.c samples/bpf/test_map_in_map_kern.c samples/bpf/test_probe_write_user_kern.c+18 -90 replies
2/4samples: bpf: refactor BPF map in map test with libbpfsamples/bpf/Makefile samples/bpf/test_map_in_map_kern.c samples/bpf/test_map_in_map_user.c+91 -490 replies
3/4samples: bpf: refactor BPF map performance test with libbpfsamples/bpf/map_perf_test_kern.c samples/bpf/map_perf_test_user.c+196 -1470 replies
4/4selftests: bpf: remove unused bpf_map_def_legacy structtools/testing/selftests/bpf/bpf_legacy.h+0 -142 replies

Reviews trailers per patch

None of the 4 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchAndrii Nakryiko
SeriesA-b
1/4
2/4
3/4
4/4

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 bpf-next v2 0/4] samples: bpf: refactor BPF map test with libbpf

There have been many changes in how the current bpf program defines map. The development of libbbpf has led to the new method called BTF-defined map, which is a new way of defining BPF maps, and thus has a lot of differences from the existing MAP definition method.

Although bpf_load was also internally using libbbpf, fragmentation in its implementation began to occur, such as using its own structure, bpf_load_map_def, to define the map.

Therefore, in this patch set, map test programs, which are closely related to changes in the definition method of BPF map, were refactored with libbbpf.

---
Changes in V2:
- instead of changing event from __x64_sys_connect to __sys_connect, fetch and set register values directly
- fix wrong error check logic with bpf_program
- set numa_node 0 declaratively at map definition instead of setting it from user-space
- static initialization of ARRAY_OF_MAPS element with '.values'

Daniel T. Lee (4):
samples: bpf: fix bpf programs with kprobe/sys_connect event
samples: bpf: refactor BPF map in map test with libbpf
samples: bpf: refactor BPF map performance test with libbpf
selftests: bpf: remove unused bpf_map_def_legacy struct

 samples/bpf/Makefile                     |   2 +-
 samples/bpf/map_perf_test_kern.c         | 188 ++++++++++++-----------
 samples/bpf/map_perf_test_user.c         | 164 +++++++++++++-------
 samples/bpf/test_map_in_map_kern.c       |  94 ++++++------
 samples/bpf/test_map_in_map_user.c       |  53 ++++++-
 samples/bpf/test_probe_write_user_kern.c |   9 +-
 tools/testing/selftests/bpf/bpf_legacy.h |  14 --
 7 files changed, 305 insertions(+), 219 deletions(-)
Signature · 1 line
2.25.1