bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrii Nakryiko <andrii.nakryiko@gmail.com>
To: Hengqi Chen <hengqi.chen@gmail.com>
Cc: bpf <bpf@vger.kernel.org>, Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>, Yonghong Song <yhs@fb.com>,
	john fastabend <john.fastabend@gmail.com>
Subject: Re: [PATCH bpf-next 0/2] libbpf: Support uniform BTF-defined key/value specification across all BPF maps
Date: Fri, 1 Oct 2021 15:35:27 -0700	[thread overview]
Message-ID: <CAEf4BzZJCza+k7ssS39CEobEcVL8LpFDPK7QNkzEJu9iZ6nYoQ@mail.gmail.com> (raw)
In-Reply-To: <20210930161456.3444544-1-hengqi.chen@gmail.com>

On Thu, Sep 30, 2021 at 9:15 AM Hengqi Chen <hengqi.chen@gmail.com> wrote:
>
> Currently a bunch of (usually pretty specialized) BPF maps do not support
> specifying BTF types for they key and value. For such maps, specifying
> their definition like this:
>
>   struct {
>       __uint(type, BPF_MAP_TYPE_PERF_EVENT_ARRAY);
>       __type(key, int);
>       __type(value, int);
>   } my_perf_buf SEC(".maps");
>
> Would actually produce warnings about retrying BPF map creation without BTF.
> Users are forced to know such nuances and use __uint(key_size, 4) instead.
> This is non-uniform, annoying, and inconvenient.
>
> This patch set teaches libbpf to recognize those specialized maps and removes
> BTF type IDs when creating BPF map. Also, update existing BPF selftests to
> exericse this change.
>
> Hengqi Chen (2):
>   libbpf: Support uniform BTF-defined key/value specification across all
>     BPF maps
>   selftests/bpf: Use BTF-defined key/value for map definitions
>
>  tools/lib/bpf/libbpf.c                        | 24 +++++++++++++++++++
>  tools/testing/selftests/bpf/progs/kfree_skb.c |  4 ++--
>  .../selftests/bpf/progs/perf_event_stackmap.c |  4 ++--
>  .../bpf/progs/sockmap_verdict_prog.c          | 12 +++++-----
>  .../selftests/bpf/progs/test_btf_map_in_map.c | 14 +++++------
>  .../selftests/bpf/progs/test_map_in_map.c     | 10 ++++----
>  .../bpf/progs/test_map_in_map_invalid.c       |  2 +-
>  .../bpf/progs/test_pe_preserve_elems.c        |  8 +++----
>  .../selftests/bpf/progs/test_perf_buffer.c    |  4 ++--
>  .../bpf/progs/test_select_reuseport_kern.c    |  4 ++--
>  .../bpf/progs/test_stacktrace_build_id.c      |  4 ++--
>  .../selftests/bpf/progs/test_stacktrace_map.c |  4 ++--
>  .../selftests/bpf/progs/test_tcpnotify_kern.c |  4 ++--
>  .../selftests/bpf/progs/test_xdp_bpf2bpf.c    |  4 ++--
>  14 files changed, 62 insertions(+), 40 deletions(-)
>
> --
> 2.30.2

Looks good. Applied to bpf-next, thanks.

      parent reply	other threads:[~2021-10-01 22:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-30 16:14 Hengqi Chen
2021-09-30 16:14 ` [PATCH bpf-next 1/2] " Hengqi Chen
2021-09-30 16:14 ` [PATCH bpf-next 2/2] selftests/bpf: Use BTF-defined key/value for map definitions Hengqi Chen
2021-10-01 22:35 ` Andrii Nakryiko [this message]

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=CAEf4BzZJCza+k7ssS39CEobEcVL8LpFDPK7QNkzEJu9iZ6nYoQ@mail.gmail.com \
    --to=andrii.nakryiko@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=hengqi.chen@gmail.com \
    --cc=john.fastabend@gmail.com \
    --cc=yhs@fb.com \
    --subject='Re: [PATCH bpf-next 0/2] libbpf: Support uniform BTF-defined key/value specification across all BPF maps' \
    /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

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).