Skip to content

libbpf: capability for resizing datasec maps

JP Kobryn bpf 3 versions – Applied

Status from this message: This series was applied to bpf/bpf-next.git (master)

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest2 patches 1 replyApplied 2/2
  2. v22 patches 2 repliesSuperseded
  3. v12 patches 6 repliesSuperseded

Patches in v3 All 2 applied

#Subject and filesSizeRepliesApplied
1/2libbpf: add capability for resizing datasec mapstools/lib/bpf/libbpf.c tools/lib/bpf/libbpf.h+146 -10 repliesApplied
2/2libbpf: selftests for resizing datasec mapstools/testing/selftests/bpf/prog_tests/global_map_resize.c tools/testing/selftests/bpf/progs/test_global_map_resize.c+294 -00 repliesApplied

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchStanislav Fomichev
1/2A-b
2/2A-b

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

Read the v3 thread

Cover letter [PATCH v3 bpf-next 0/2] libbpf: capability for resizing datasec maps

Due to the way the datasec maps like bss, data, rodata are memory mapped, they cannot be resized with bpf_map__set_value_size() like non-datasec maps can. This series offers a way to allow the resizing of datasec maps, by having the mapped regions resized as needed and also adjusting associated BTF info if possible.

The thought behind this is to allow for use cases where a given datasec needs to scale to for example the number of CPU's present. A bpf program can have a global array in a data section with an initial length and before loading the bpf program, the array length could be extended to match the CPU count. The selftests included in this series perform this scaling to an arbitrary value to demonstrate how it can work.

JP Kobryn (2):
add capability for resizing datasec maps
selftests for resizing datasec maps

 tools/lib/bpf/libbpf.c                        | 130 ++++++++++
 tools/lib/bpf/libbpf.h                        |  17 +-
 .../bpf/prog_tests/global_map_resize.c        | 236 ++++++++++++++++++
 .../bpf/progs/test_global_map_resize.c        |  58 +++++
 4 files changed, 440 insertions(+), 1 deletion(-)
 create mode 100644 tools/testing/selftests/bpf/prog_tests/global_map_resize.c
 create mode 100644 tools/testing/selftests/bpf/progs/test_global_map_resize.c
Signature · 1 line
2.40.0