All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel Müller" <deso@posteo.net>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: bpf <bpf@vger.kernel.org>, Alexei Starovoitov <ast@kernel.org>,
	Andrii Nakryiko <andrii@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Kernel Team <kernel-team@fb.com>,
	Quentin Monnet <quentin@isovalent.com>
Subject: Re: [PATCH bpf-next 00/12] libbpf: Textual representation of enums
Date: Tue, 17 May 2022 18:59:08 +0000	[thread overview]
Message-ID: <20220517185908.5sa2ohdqsduwo5yh@devvm5318.vll0.facebook.com> (raw)
In-Reply-To: <CAEf4BzYg24WGidanbqQHQnUUeWS0JFKze08cGCPtD+EX94LrFw@mail.gmail.com>

On Mon, May 16, 2022 at 04:43:42PM -0700, Andrii Nakryiko wrote:
> On Mon, May 16, 2022 at 10:35 AM Daniel Müller <deso@posteo.net> wrote:
> >
> > This patch set introduces the means for querying a textual representation of
> > the following BPF related enum types:
> > - enum bpf_map_type
> > - enum bpf_prog_type
> > - enum bpf_attach_type
> > - enum bpf_link_type
> >
> > To make that possible, we introduce a new public function for each of the types:
> > libbpf_bpf_<type>_type_str.
> >
> > Having a way to query a textual representation has been asked for in the past
> > (by systemd, among others). Such representations can generally be useful in
> > tracing and logging contexts, among others. At this point, at least one client,
> > bpftool, maintains such a mapping manually, which is prone to get out of date as
> > new enum variants are introduced. libbpf is arguably best situated to keep this
> > list complete and up-to-date. This patch series adds BTF based tests to ensure
> > that exhaustiveness is upheld moving forward.
> >
> > The libbpf provided textual representation can be inferred from the
> > corresponding enum variant name by removing the prefix and lowercasing the
> > remainder. E.g., BPF_PROG_TYPE_SOCKET_FILTER -> socket_filter. Unfortunately,
> > bpftool does not use such a programmatic approach for some of the
> > bpf_attach_type variants. We propose a work around keeping the existing behavior
> > for the time being in the patch titled "bpftool: Use
> > libbpf_bpf_attach_type_str".
> >
> > The patch series is structured as follows:
> > - for each enumeration type in {bpf_prog_type, bpf_map_type, bpf_attach_type,
> >   bpf_link_type}:
> >   - we first introduce the corresponding public libbpf API function
> >   - we then add BTF based self-tests
> >   - we lastly adjust bpftool to use the libbpf provided functionality
> >
> > Signed-off-by: Daniel Müller <deso@posteo.net>
> >
> > Daniel Müller (12):
> >   libbpf: Introduce libbpf_bpf_prog_type_str
> >   selftests/bpf: Add test for libbpf_bpf_prog_type_str
> >   bpftool: Use libbpf_bpf_prog_type_str
> >   libbpf: Introduce libbpf_bpf_map_type_str
> >   selftests/bpf: Add test for libbpf_bpf_map_type_str
> >   bpftool: Use libbpf_bpf_map_type_str
> >   libbpf: Introduce libbpf_bpf_attach_type_str
> >   selftests/bpf: Add test for libbpf_bpf_attach_type_str
> >   bpftool: Use libbpf_bpf_attach_type_str
> >   libbpf: Introduce libbpf_bpf_link_type_str
> >   selftests/bpf: Add test for libbpf_bpf_link_type_str
> >   bpftool: Use libbpf_bpf_link_type_str
> >
> 
> Looks good to me overall. But keep in mind that libbpf v0.8 was just
> released, so these new APIs will have to go into 1.0 section in
> libbpf.map. It can't inherit from 0.8, btw, so this is a bit new
> procedure, I'll try to get to it in next few days. Meanwhile I'd like
> to get some feedback at least from Quentin on bpftool changes.

Thanks for the heads up (and the review)! I am happy to rebase once we have
figured out the procedure.

[...]

Daniel

  reply	other threads:[~2022-05-17 18:59 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-16 17:35 [PATCH bpf-next 00/12] libbpf: Textual representation of enums Daniel Müller
2022-05-16 17:35 ` [PATCH bpf-next 01/12] libbpf: Introduce libbpf_bpf_prog_type_str Daniel Müller
2022-05-16 17:35 ` [PATCH bpf-next 02/12] selftests/bpf: Add test for libbpf_bpf_prog_type_str Daniel Müller
2022-05-16 17:35 ` [PATCH bpf-next 03/12] bpftool: Use libbpf_bpf_prog_type_str Daniel Müller
2022-05-17 14:18   ` Quentin Monnet
2022-05-17 19:09     ` Daniel Müller
2022-05-16 17:35 ` [PATCH bpf-next 04/12] libbpf: Introduce libbpf_bpf_map_type_str Daniel Müller
2022-05-16 17:35 ` [PATCH bpf-next 05/12] selftests/bpf: Add test for libbpf_bpf_map_type_str Daniel Müller
2022-05-16 17:35 ` [PATCH bpf-next 06/12] bpftool: Use libbpf_bpf_map_type_str Daniel Müller
2022-05-16 17:35 ` [PATCH bpf-next 07/12] libbpf: Introduce libbpf_bpf_attach_type_str Daniel Müller
2022-05-16 17:35 ` [PATCH bpf-next 08/12] selftests/bpf: Add test for libbpf_bpf_attach_type_str Daniel Müller
2022-05-16 17:35 ` [PATCH bpf-next 09/12] bpftool: Use libbpf_bpf_attach_type_str Daniel Müller
2022-05-16 23:41   ` Andrii Nakryiko
2022-05-17 14:18     ` Quentin Monnet
2022-05-17 18:54       ` Daniel Müller
2022-05-18 13:31         ` Quentin Monnet
2022-05-18 23:54           ` Daniel Müller
2022-05-19  3:08           ` Dave Thaler
2022-05-16 17:35 ` [PATCH bpf-next 10/12] libbpf: Introduce libbpf_bpf_link_type_str Daniel Müller
2022-05-16 17:35 ` [PATCH bpf-next 11/12] selftests/bpf: Add test for libbpf_bpf_link_type_str Daniel Müller
2022-05-16 17:35 ` [PATCH bpf-next 12/12] bpftool: Use libbpf_bpf_link_type_str Daniel Müller
2022-05-16 23:43 ` [PATCH bpf-next 00/12] libbpf: Textual representation of enums Andrii Nakryiko
2022-05-17 18:59   ` Daniel Müller [this message]
2022-05-17  6:42 ` Yonghong Song

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=20220517185908.5sa2ohdqsduwo5yh@devvm5318.vll0.facebook.com \
    --to=deso@posteo.net \
    --cc=andrii.nakryiko@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=kernel-team@fb.com \
    --cc=quentin@isovalent.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 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.