Skip to content

inline asm helpers to access array elements

Barret Rhoden bpf lkml 2 versions In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 11 repliesIn review
  2. v12 patches 9 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2libbpf: add helpers for mmapping mapstools/bpf/bpftool/gen.c tools/lib/bpf/libbpf.c tools/lib/bpf/libbpf.h +1 more+31 -133 replies
2/2selftests/bpf: add inline assembly helpers to access array elementstools/testing/selftests/bpf/prog_tests/test_array_elem.c tools/testing/selftests/bpf/progs/array_elem_test.c tools/testing/selftests/bpf/progs/bpf_misc.h+350 -08 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 bpf-next 0/2] inline asm helpers to access array elements

Sorry for the delay on this. Discussed in [1]. It's a helper for proving to the verifier that your access in the array is valid. Happy to change names or whatever. =)

Also added a libbpf helper function for mmapping an mmappable map.

We've been using both in our ghost-BPF schedulers[2].

[1] https://lore.kernel.org/bpf/[email protected]/T/
[2] https://github.com/google/ghost-userspace/blob/main/third_party/bpf/common.bpf.h#L218

v1: https://lore.kernel.org/bpf/[email protected]/
- use libbpf's internal bpf_map_mmap_sz()
- remove debugging cruft

Barret Rhoden (2):
libbpf: add helpers for mmapping maps
selftests/bpf: add inline assembly helpers to access array elements

 tools/bpf/bpftool/gen.c                       |  16 +-
 tools/lib/bpf/libbpf.c                        |  18 ++
 tools/lib/bpf/libbpf.h                        |   6 +
 tools/lib/bpf/libbpf.map                      |   4 +
 .../bpf/prog_tests/test_array_elem.c          | 112 ++++++++++
 .../selftests/bpf/progs/array_elem_test.c     | 195 ++++++++++++++++++
 tools/testing/selftests/bpf/progs/bpf_misc.h  |  43 ++++
 7 files changed, 381 insertions(+), 13 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/prog_tests/test_array_elem.c
 create mode 100644 tools/testing/selftests/bpf/progs/array_elem_test.c
Signature · 1 line
2.43.0.472.g3155946c3a-goog