From: Kui-Feng Lee <kuifeng@fb.com>
To: "alexei.starovoitov@gmail.com" <alexei.starovoitov@gmail.com>
Cc: "daniel@iogearbox.net" <daniel@iogearbox.net>,
Kernel Team <Kernel-team@fb.com>, Yonghong Song <yhs@fb.com>,
"ast@kernel.org" <ast@kernel.org>,
"andrii@kernel.org" <andrii@kernel.org>,
"bpf@vger.kernel.org" <bpf@vger.kernel.org>
Subject: Re: [PATCH bpf-next v2 1/3] bpf: Parameterize task iterators.
Date: Tue, 2 Aug 2022 16:47:51 +0000 [thread overview]
Message-ID: <abd48496db08b3f50df163267f37bb96616f355e.camel@fb.com> (raw)
In-Reply-To: <CAADnVQJp3GDjFw9H8nez4z8zSYME3h_fL3cuhiVSOrMc11T5KA@mail.gmail.com>
On Mon, 2022-08-01 at 18:49 -0700, Alexei Starovoitov wrote:
> On Mon, Aug 1, 2022 at 4:27 PM Kui-Feng Lee <kuifeng@fb.com> wrote:
> >
> > Allow creating an iterator that loops through resources of one
> > task/thread.
> >
> > People could only create iterators to loop through all resources of
> > files, vma, and tasks in the system, even though they were
> > interested
> > in only the resources of a specific task or process. Passing the
> > additional parameters, people can now create an iterator to go
> > through all resources or only the resources of a task.
> >
> > Signed-off-by: Kui-Feng Lee <kuifeng@fb.com>
> > ---
> > include/linux/bpf.h | 4 ++
> > include/uapi/linux/bpf.h | 23 +++++++++
> > kernel/bpf/task_iter.c | 93 ++++++++++++++++++++++++++----
> > ----
> > tools/include/uapi/linux/bpf.h | 23 +++++++++
> > 4 files changed, 121 insertions(+), 22 deletions(-)
> >
> > diff --git a/include/linux/bpf.h b/include/linux/bpf.h
> > index 11950029284f..3c26dbfc9cef 100644
> > --- a/include/linux/bpf.h
> > +++ b/include/linux/bpf.h
> > @@ -1718,6 +1718,10 @@ int bpf_obj_get_user(const char __user
> > *pathname, int flags);
> >
> > struct bpf_iter_aux_info {
> > struct bpf_map *map;
> > + struct {
> > + u32 tid;
> > + u8 type;
> > + } task;
> > };
> >
> > typedef int (*bpf_iter_attach_target_t)(struct bpf_prog *prog,
> > diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
> > index ffcbf79a556b..ed5ba501609f 100644
> > --- a/include/uapi/linux/bpf.h
> > +++ b/include/uapi/linux/bpf.h
> > @@ -87,10 +87,33 @@ struct bpf_cgroup_storage_key {
> > __u32 attach_type; /* program attach type
> > (enum bpf_attach_type) */
> > };
> >
> > +enum bpf_task_iter_type {
> > + BPF_TASK_ITER_ALL = 0,
> > + BPF_TASK_ITER_TID,
> > +};
> > +
> > union bpf_iter_link_info {
> > struct {
> > __u32 map_fd;
> > } map;
> > + /*
> > + * Parameters of task iterators.
> > + */
> > + struct {
> > + __u32 pid_fd;
> > + /*
> > + * The type of the iterator.
> > + *
> > + * It can be one of enum bpf_task_iter_type.
> > + *
> > + * BPF_TASK_ITER_ALL (default)
> > + * The iterator iterates over resources of
> > everyprocess.
> > + *
> > + * BPF_TASK_ITER_TID
> > + * You should also set *pid_fd* to iterate
> > over one task.
> > + */
> > + __u8 type; /* BPF_TASK_ITER_* */
>
> __u8 might be a pain for future extensibility.
Do you mean the problem caused by padding?
> big vs little endian will be another potential issue.
Do we need binary compatible for different platforms?
I don't get the point of endian. Could you explain it more?
>
> Maybe use enum bpf_task_iter_type type; here and
> move the comment to enum def ?
> Or rename it to '__u32 flags;' ?
next prev parent reply other threads:[~2022-08-02 16:47 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-01 23:26 [PATCH bpf-next v2 0/3] Parameterize task iterators Kui-Feng Lee
2022-08-01 23:26 ` [PATCH bpf-next v2 1/3] bpf: " Kui-Feng Lee
2022-08-02 1:49 ` Alexei Starovoitov
2022-08-02 16:47 ` Kui-Feng Lee [this message]
2022-08-02 21:19 ` Andrii Nakryiko
2022-08-02 3:30 ` Andrii Nakryiko
2022-08-02 16:42 ` Kui-Feng Lee
2022-08-02 21:17 ` Andrii Nakryiko
2022-08-04 23:05 ` Kui-Feng Lee
2022-08-01 23:26 ` [PATCH bpf-next v2 2/3] bpf: Handle bpf_link_info for the parameterized task BPF iterators Kui-Feng Lee
2022-08-01 23:26 ` [PATCH bpf-next v2 3/3] selftests/bpf: Test " Kui-Feng Lee
2022-08-01 23:35 ` [PATCH bpf-next v2 0/3] Parameterize task iterators Kui-Feng Lee
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=abd48496db08b3f50df163267f37bb96616f355e.camel@fb.com \
--to=kuifeng@fb.com \
--cc=Kernel-team@fb.com \
--cc=alexei.starovoitov@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=yhs@fb.com \
/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;
as well as URLs for NNTP newsgroup(s).