public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf-next 0/2] inline asm helpers to access array elements
@ 2024-01-03 15:33 Barret Rhoden
  2024-01-03 15:33 ` [PATCH bpf-next 1/2] libbpf: add helpers for mmapping maps Barret Rhoden
  2024-01-03 15:33 ` [PATCH bpf-next 2/2] selftests/bpf: add inline assembly helpers to access array elements Barret Rhoden
  0 siblings, 2 replies; 12+ messages in thread
From: Barret Rhoden @ 2024-01-03 15:33 UTC (permalink / raw)
  To: Andrii Nakryiko, Alexei Starovoitov, Daniel Borkmann, Song Liu,
	Yonghong Song
  Cc: mattbobrowski, bpf, linux-kernel

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/b4cb3423-b18d-8fad-7355-d8aa66ccfe4c@google.com/T/
[2] https://github.com/google/ghost-userspace/blob/main/third_party/bpf/common.bpf.h#L218

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                        |  23 +++
 tools/lib/bpf/libbpf.h                        |   6 +
 tools/lib/bpf/libbpf.map                      |   4 +
 tools/testing/selftests/bpf/Makefile          |   2 +-
 .../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 ++++
 8 files changed, 387 insertions(+), 14 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

-- 
2.43.0.472.g3155946c3a-goog


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

end of thread, other threads:[~2024-01-04 22:46 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-03 15:33 [PATCH bpf-next 0/2] inline asm helpers to access array elements Barret Rhoden
2024-01-03 15:33 ` [PATCH bpf-next 1/2] libbpf: add helpers for mmapping maps Barret Rhoden
2024-01-03 16:57   ` John Fastabend
2024-01-03 18:50     ` Barret Rhoden
2024-01-03 15:33 ` [PATCH bpf-next 2/2] selftests/bpf: add inline assembly helpers to access array elements Barret Rhoden
2024-01-03 17:52   ` John Fastabend
2024-01-03 19:51   ` Andrii Nakryiko
2024-01-03 20:06     ` Barret Rhoden
2024-01-03 21:21       ` Andrii Nakryiko
2024-01-04 21:32         ` Barret Rhoden
2024-01-04 21:37     ` Barret Rhoden
2024-01-04 22:45       ` Andrii Nakryiko

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