bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 bpf-next 0/2] libbpf: capability for resizing datasec maps
@ 2023-05-24  0:45 JP Kobryn
  2023-05-24  0:45 ` [PATCH v3 bpf-next 1/2] libbpf: add " JP Kobryn
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: JP Kobryn @ 2023-05-24  0:45 UTC (permalink / raw)
  To: bpf, andrii; +Cc: kernel-team, inwardvessel

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

-- 
2.40.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-05-24 18:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-24  0:45 [PATCH v3 bpf-next 0/2] libbpf: capability for resizing datasec maps JP Kobryn
2023-05-24  0:45 ` [PATCH v3 bpf-next 1/2] libbpf: add " JP Kobryn
2023-05-24  0:45 ` [PATCH v3 bpf-next 2/2] libbpf: selftests " JP Kobryn
2023-05-24 18:48 ` [PATCH v3 bpf-next 0/2] libbpf: capability " Andrii Nakryiko
2023-05-24 18:50 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).