netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Borkmann <daniel@iogearbox.net>
To: Andrii Nakryiko <andriin@fb.com>,
	bpf@vger.kernel.org, netdev@vger.kernel.org, ast@fb.com
Cc: andrii.nakryiko@gmail.com, kernel-team@fb.com
Subject: Re: [PATCH v3 bpf-next 0/3] Convert BPF UAPI constants into enum values
Date: Wed, 4 Mar 2020 16:21:31 +0100	[thread overview]
Message-ID: <47bbaa27-a112-b4a5-6251-d8aad31937a5@iogearbox.net> (raw)
In-Reply-To: <20200303003233.3496043-1-andriin@fb.com>

On 3/3/20 1:32 AM, Andrii Nakryiko wrote:
> Convert BPF-related UAPI constants, currently defined as #define macro, into
> anonymous enums. This has no difference in terms of usage of such constants in
> C code (they are still could be used in all the compile-time contexts that
> `#define`s can), but they are recorded as part of DWARF type info, and
> subsequently get recorded as part of kernel's BTF type info. This allows those
> constants to be emitted as part of vmlinux.h auto-generated header file and be
> used from BPF programs. Which is especially convenient for all kinds of BPF
> helper flags and makes CO-RE BPF programs nicer to write.
> 
> libbpf's btf_dump logic currently assumes enum values are signed 32-bit
> values, but that doesn't match a typical case, so switch it to emit unsigned
> values. Once BTF encoding of BTF_KIND_ENUM is extended to capture signedness
> properly, this will be made more flexible.
> 
> As an immediate validation of the approach, runqslower's copy of
> BPF_F_CURRENT_CPU #define is dropped in favor of its enum variant from
> vmlinux.h.
> 
> v2->v3:
> - convert only constants usable from BPF programs (BPF helper flags, map
>    create flags, etc) (Alexei);
> 
> v1->v2:
> - fix up btf_dump test to use max 32-bit unsigned value instead of negative one.
> 
> 
> Andrii Nakryiko (3):
>    bpf: switch BPF UAPI #define constants used from BPF program side to
>      enums
>    libbpf: assume unsigned values for BTF_KIND_ENUM
>    tools/runqslower: drop copy/pasted BPF_F_CURRENT_CPU definiton
> 
>   include/uapi/linux/bpf.h                      | 175 ++++++++++-------
>   tools/bpf/runqslower/runqslower.bpf.c         |   3 -
>   tools/include/uapi/linux/bpf.h                | 177 +++++++++++-------
>   tools/lib/bpf/btf_dump.c                      |   8 +-
>   .../bpf/progs/btf_dump_test_case_syntax.c     |   2 +-
>   5 files changed, 224 insertions(+), 141 deletions(-)
> 

Applied, thanks!

  parent reply	other threads:[~2020-03-04 15:21 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-03  0:32 [PATCH v3 bpf-next 0/3] Convert BPF UAPI constants into enum values Andrii Nakryiko
2020-03-03  0:32 ` [PATCH v3 bpf-next 1/3] bpf: switch BPF UAPI #define constants used from BPF program side to enums Andrii Nakryiko
2020-03-03 23:01   ` Daniel Borkmann
2020-03-03 23:24     ` Andrii Nakryiko
2020-03-04  9:37       ` Toke Høiland-Jørgensen
2020-03-04 15:38         ` Daniel Borkmann
2020-03-04 15:50           ` Alexei Starovoitov
2020-03-04 16:03             ` Daniel Borkmann
2020-03-04 15:57           ` Daniel Borkmann
2020-03-04 16:02             ` Andrii Nakryiko
2020-03-04 16:07             ` Alexei Starovoitov
2020-03-05 10:50             ` Toke Høiland-Jørgensen
2020-06-02  5:31           ` Michael Forney
2020-06-02 19:17             ` Alexei Starovoitov
2020-06-02 21:40               ` Michael Forney
2020-06-02 23:07                 ` Alexei Starovoitov
2020-06-02 23:21                   ` Michael Forney
2020-06-02 23:36                     ` Alexei Starovoitov
2020-06-03 21:22                       ` Michael Forney
2020-03-03  0:32 ` [PATCH v3 bpf-next 2/3] libbpf: assume unsigned values for BTF_KIND_ENUM Andrii Nakryiko
2020-03-03  0:32 ` [PATCH v3 bpf-next 3/3] tools/runqslower: drop copy/pasted BPF_F_CURRENT_CPU definiton Andrii Nakryiko
2020-03-04 15:21 ` Daniel Borkmann [this message]
2020-03-04 15:34   ` [PATCH v3 bpf-next 0/3] Convert BPF UAPI constants into enum values Andrii Nakryiko

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=47bbaa27-a112-b4a5-6251-d8aad31937a5@iogearbox.net \
    --to=daniel@iogearbox.net \
    --cc=andrii.nakryiko@gmail.com \
    --cc=andriin@fb.com \
    --cc=ast@fb.com \
    --cc=bpf@vger.kernel.org \
    --cc=kernel-team@fb.com \
    --cc=netdev@vger.kernel.org \
    /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).