From: Barret Rhoden <brho@google.com>
To: Andrii Nakryiko <andrii@kernel.org>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Song Liu <song@kernel.org>,
Yonghong Song <yonghong.song@linux.dev>
Cc: mattbobrowski@google.com, bpf@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH v2 bpf-next 0/2] inline asm helpers to access array elements
Date: Wed, 3 Jan 2024 13:53:57 -0500 [thread overview]
Message-ID: <20240103185403.610641-1-brho@google.com> (raw)
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
v1: https://lore.kernel.org/bpf/20240103153307.553838-1-brho@google.com/
- 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
--
2.43.0.472.g3155946c3a-goog
next reply other threads:[~2024-01-03 18:54 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-03 18:53 Barret Rhoden [this message]
2024-01-03 18:53 ` [PATCH v2 bpf-next 1/2] libbpf: add helpers for mmapping maps Barret Rhoden
2024-01-03 19:42 ` Andrii Nakryiko
2024-01-03 19:45 ` Barret Rhoden
2024-01-03 20:00 ` Andrii Nakryiko
2024-01-03 18:53 ` [PATCH v2 bpf-next 2/2] selftests/bpf: add inline assembly helpers to access array elements Barret Rhoden
2024-01-04 13:43 ` Jiri Olsa
2024-01-04 17:31 ` Yonghong Song
2024-01-04 21:30 ` Barret Rhoden
2024-01-10 0:42 ` Alexei Starovoitov
2024-01-10 1:02 ` Barret Rhoden
2024-01-10 1:06 ` Alexei Starovoitov
2024-01-10 1:20 ` Barret Rhoden
2024-01-10 0:26 ` Barret Rhoden
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240103185403.610641-1-brho@google.com \
--to=brho@google.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=linux-kernel@vger.kernel.org \
--cc=mattbobrowski@google.com \
--cc=song@kernel.org \
--cc=yonghong.song@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.