On Thu, Aug 18, 2022 at 3:12 PM David Vernet <void@xxxxxxxxxxxxx> wrote: > > We want to support a ringbuf map type where samples are published from > user-space, to be consumed by BPF programs. BPF currently supports a kernel > -> user-space circular ringbuffer via the BPF_MAP_TYPE_RINGBUF map type. > We'll need to define a new map type for user-space -> kernel, as none of > the helpers exported for BPF_MAP_TYPE_RINGBUF will apply to a user-space > producer ringbuffer, and we'll want to add one or more helper functions > that would not apply for a kernel-producer ringbuffer. > > This patch therefore adds a new BPF_MAP_TYPE_USER_RINGBUF map type > definition. The map type is useless in its current form, as there is no way > to access or use it for anything until we one or more BPF helpers. A > follow-on patch will therefore add a new helper function that allows BPF > programs to run callbacks on samples that are published to the ringbuffer. > > Signed-off-by: David Vernet <void@xxxxxxxxxxxxx> > --- LGTM. Acked-by: Andrii Nakryiko <andrii@xxxxxxxxxx> > include/linux/bpf_types.h | 1 + > include/uapi/linux/bpf.h | 1 + > kernel/bpf/ringbuf.c | 62 ++++++++++++++++++++++++++++++---- > kernel/bpf/verifier.c | 3 ++ > tools/include/uapi/linux/bpf.h | 1 + > tools/lib/bpf/libbpf.c | 1 + > 6 files changed, 63 insertions(+), 6 deletions(-) [...]