From: Jiri Olsa <olsajiri@gmail.com>
To: Philo Lu <lulie@linux.alibaba.com>
Cc: bpf@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net,
john.fastabend@gmail.com, andrii@kernel.org,
martin.lau@linux.dev, song@kernel.org, yonghong.song@linux.dev,
kpsingh@kernel.org, sdf@google.com, haoluo@google.com,
rostedt@goodmis.org, mhiramat@kernel.org,
mathieu.desnoyers@efficios.com,
linux-trace-kernel@vger.kernel.org, xuanzhuo@linux.alibaba.com,
dust.li@linux.alibaba.com, alibuda@linux.alibaba.com,
guwen@linux.alibaba.com, hengqi@linux.alibaba.com,
shung-hsi.yu@suse.com
Subject: Re: [PATCH bpf-next 0/3] bpf: introduce BPF_MAP_TYPE_RELAY
Date: Fri, 22 Dec 2023 15:45:25 +0100 [thread overview]
Message-ID: <ZYWhBWP_J_esr6TW@krava> (raw)
In-Reply-To: <20231222122146.65519-1-lulie@linux.alibaba.com>
On Fri, Dec 22, 2023 at 08:21:43PM +0800, Philo Lu wrote:
> The patch set introduce a new type of map, BPF_MAP_TYPE_RELAY, based on
> relay interface [0]. It provides a way for persistent and overwritable data
> transfer.
>
> As stated in [0], relay is a efficient method for log and data transfer.
> And the interface is simple enough so that we can implement and use this
> type of map with current map interfaces. Besides we need a new helper
> bpf_relay_output to output data to user, similar with bpf_ringbuf_output.
>
> We need this map because currently neither ringbuf nor perfbuf satisfies
> the requirements of relatively long-term consistent tracing, where the bpf
> program keeps writing into the buffer without any bundled reader, and the
> buffer supports overwriting. For users, they just run the bpf program to
> collect data, and are able to read as need. The detailed discussion can be
> found at [1].
>
> The buffer is exposed to users as per-cpu files in debugfs, supporting read
> and mmap, and it is up to users how to formulate and read it, either
> through a program with mmap or just `cat`. Specifically, the files are
> created as "/sys/kerenl/debug/<dirname>/<mapname>#cpu", where the <dirname>
> is defined with map_update_elem (Note that we do not need to implement
> actual elem operators for relay_map).
>
> If this map is acceptable, other parts including docs, libbpf support,
> selftests, and benchmarks (if need) will be added in the following version.
looks useful, selftests might be already helpful to see the usage
jirka
>
> [0]
> https://github.com/torvalds/linux/blob/master/Documentation/filesystems/relay.rst
> [1]
> https://lore.kernel.org/bpf/20231219122850.433be151@gandalf.local.home/T/
>
> Philo Lu (3):
> bpf: implement relay map basis
> bpf: implement map_update_elem to init relay file
> bpf: introduce bpf_relay_output helper
>
> include/linux/bpf.h | 1 +
> include/linux/bpf_types.h | 3 +
> include/uapi/linux/bpf.h | 17 +++
> kernel/bpf/Makefile | 3 +
> kernel/bpf/helpers.c | 4 +
> kernel/bpf/relaymap.c | 213 ++++++++++++++++++++++++++++++++++++++
> kernel/bpf/syscall.c | 1 +
> kernel/bpf/verifier.c | 8 ++
> kernel/trace/bpf_trace.c | 4 +
> 9 files changed, 254 insertions(+)
> create mode 100644 kernel/bpf/relaymap.c
>
> --
> 2.32.0.3.g01195cf9f
>
next prev parent reply other threads:[~2023-12-22 14:45 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-22 12:21 [PATCH bpf-next 0/3] bpf: introduce BPF_MAP_TYPE_RELAY Philo Lu
2023-12-22 12:21 ` [PATCH bpf-next 1/3] bpf: implement relay map basis Philo Lu
2023-12-22 14:45 ` Jiri Olsa
2023-12-23 2:54 ` Philo Lu
2023-12-22 23:07 ` kernel test robot
2023-12-23 0:11 ` kernel test robot
2023-12-23 11:22 ` Hou Tao
2023-12-23 13:02 ` Philo Lu
2023-12-25 11:36 ` Philo Lu
2023-12-25 13:06 ` Hou Tao
2023-12-22 12:21 ` [PATCH bpf-next 2/3] bpf: implement map_update_elem to init relay file Philo Lu
2023-12-22 14:45 ` Jiri Olsa
2023-12-23 2:55 ` Philo Lu
2023-12-23 11:28 ` Hou Tao
2023-12-23 13:19 ` Philo Lu
2023-12-22 12:21 ` [PATCH bpf-next 3/3] bpf: introduce bpf_relay_output helper Philo Lu
2023-12-22 14:46 ` Jiri Olsa
2023-12-23 2:56 ` Philo Lu
2023-12-22 14:45 ` Jiri Olsa [this message]
2023-12-23 2:57 ` [PATCH bpf-next 0/3] bpf: introduce BPF_MAP_TYPE_RELAY Philo Lu
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=ZYWhBWP_J_esr6TW@krava \
--to=olsajiri@gmail.com \
--cc=alibuda@linux.alibaba.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=dust.li@linux.alibaba.com \
--cc=guwen@linux.alibaba.com \
--cc=haoluo@google.com \
--cc=hengqi@linux.alibaba.com \
--cc=john.fastabend@gmail.com \
--cc=kpsingh@kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=lulie@linux.alibaba.com \
--cc=martin.lau@linux.dev \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=rostedt@goodmis.org \
--cc=sdf@google.com \
--cc=shung-hsi.yu@suse.com \
--cc=song@kernel.org \
--cc=xuanzhuo@linux.alibaba.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox