public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf-next 0/2] libbpf: capability for resizing datasec maps
@ 2023-04-28 22:27 JP Kobryn
  2023-04-28 22:27 ` [PATCH bpf-next 1/2] libbpf: add " JP Kobryn
  2023-04-28 22:27 ` [PATCH bpf-next 2/2] libbpf: selftests " JP Kobryn
  0 siblings, 2 replies; 9+ messages in thread
From: JP Kobryn @ 2023-04-28 22:27 UTC (permalink / raw)
  To: bpf, andrii; +Cc: kernel-team, inwardvessel

In a bpf_object, the datasec maps like .data, .bss, .rodata cannot be
resized with bpf_map__set_value_size() like normal maps can. This patch
series offers a way to allow the resizing of datasec maps.

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 custom 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                        | 138 +++++++++++++
 .../bpf/prog_tests/global_map_resize.c        | 187 ++++++++++++++++++
 .../bpf/progs/test_global_map_resize.c        |  33 ++++
 3 files changed, 358 insertions(+)
 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] 9+ messages in thread

end of thread, other threads:[~2023-05-01 23:55 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-28 22:27 [PATCH bpf-next 0/2] libbpf: capability for resizing datasec maps JP Kobryn
2023-04-28 22:27 ` [PATCH bpf-next 1/2] libbpf: add " JP Kobryn
2023-04-28 23:58   ` Stanislav Fomichev
2023-05-01 16:50     ` JP Kobryn
2023-05-01 18:23       ` Stanislav Fomichev
2023-05-01 23:49   ` Andrii Nakryiko
2023-04-28 22:27 ` [PATCH bpf-next 2/2] libbpf: selftests " JP Kobryn
2023-05-01 18:24   ` Stanislav Fomichev
2023-05-01 23:55   ` Andrii Nakryiko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox