[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4Bzb8YhqZM4UM8z3kYRLYCFsk96rdPCkK9JT2ZpkL9KGn2w@mail.gmail.com>
Date: Fri, 8 May 2020 11:57:34 -0700
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Yonghong Song <yhs@...com>
Cc: Andrii Nakryiko <andriin@...com>, bpf <bpf@...r.kernel.org>,
Martin KaFai Lau <kafai@...com>,
Networking <netdev@...r.kernel.org>,
Alexei Starovoitov <ast@...com>,
Daniel Borkmann <daniel@...earbox.net>,
Kernel Team <kernel-team@...com>
Subject: Re: [PATCH bpf-next v3 06/21] bpf: create anonymous bpf iterator
On Wed, May 6, 2020 at 10:39 PM Yonghong Song <yhs@...com> wrote:
>
> A new bpf command BPF_ITER_CREATE is added.
>
> The anonymous bpf iterator is seq_file based.
> The seq_file private data are referenced by targets.
> The bpf_iter infrastructure allocated additional space
> at seq_file->private before the space used by targets
> to store some meta data, e.g.,
> prog: prog to run
> session_id: an unique id for each opened seq_file
> seq_num: how many times bpf programs are queried in this session
> done_stop: an internal state to decide whether bpf program
> should be called in seq_ops->stop() or not
>
> The seq_num will start from 0 for valid objects.
> The bpf program may see the same seq_num more than once if
> - seq_file buffer overflow happens and the same object
> is retried by bpf_seq_read(), or
> - the bpf program explicitly requests a retry of the
> same object
>
> Since module is not supported for bpf_iter, all target
> registeration happens at __init time, so there is no
> need to change bpf_iter_unreg_target() as it is used
> mostly in error path of the init function at which time
> no bpf iterators have been created yet.
>
> Signed-off-by: Yonghong Song <yhs@...com>
> ---
LGTM.
Acked-by: Andrii Nakryiko <andriin@...com>
> include/linux/bpf.h | 1 +
> include/uapi/linux/bpf.h | 6 ++
> kernel/bpf/bpf_iter.c | 129 +++++++++++++++++++++++++++++++++
> kernel/bpf/syscall.c | 26 +++++++
> tools/include/uapi/linux/bpf.h | 6 ++
> 5 files changed, 168 insertions(+)
>
[...]
Powered by blists - more mailing lists