netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yonghong Song <yhs@fb.com>
To: <bpf@vger.kernel.org>, <netdev@vger.kernel.org>
Cc: Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Jiri Olsa <jolsa@kernel.org>, <kernel-team@fb.com>
Subject: [PATCH bpf-next v2 0/5] bpf: compute btf_ids at build time for btf_iter
Date: Mon, 20 Jul 2020 09:33:58 -0700	[thread overview]
Message-ID: <20200720163358.1392964-1-yhs@fb.com> (raw)

Commit 5a2798ab32ba
("bpf: Add BTF_ID_LIST/BTF_ID/BTF_ID_UNUSED macros")
implemented a mechanism to compute btf_ids at kernel build
time which can simplify kernel implementation and reduce
runtime overhead by removing in-kernel btf_id calculation.

This patch set tried to use this mechanism to compute
btf_ids for bpf_skc_to_*() helpers and for btf_id_or_null ctx
arguments specified during bpf iterator registration.
Please see individual patch for details.

Changelogs:
  v1 -> v2:
    - v1 ([1]) is only for bpf_skc_to_*() helpers. This version
      expanded it to cover ctx btf_id_or_null arguments
    - abandoned the change of "extern u32 name[]" to
      "static u32 name[]" for BPF_ID_LIST local "name" definition.
      gcc 9 incurred a compilation error.

 [1]: https://lore.kernel.org/bpf/20200717184706.3476992-1-yhs@fb.com/T

Yonghong Song (5):
  bpf: compute bpf_skc_to_*() helper socket btf ids at build time
  tools/bpf: sync btf_ids.h to tools
  bpf: add BTF_ID_LIST_GLOBAL in btf_ids.h
  bpf: make btf_sock_ids global
  bpf: net: use precomputed btf_id for bpf iterators

 include/linux/bpf.h                           |  5 +-
 include/linux/btf_ids.h                       | 40 +++++++++++++--
 kernel/bpf/btf.c                              |  6 +--
 kernel/bpf/map_iter.c                         |  7 ++-
 kernel/bpf/task_iter.c                        | 12 ++++-
 net/core/filter.c                             | 49 ++----------------
 net/ipv4/tcp_ipv4.c                           |  4 +-
 net/ipv4/udp.c                                |  4 +-
 net/ipv6/route.c                              |  7 ++-
 net/netlink/af_netlink.c                      |  7 ++-
 tools/include/linux/btf_ids.h                 | 51 +++++++++++++++++--
 .../selftests/bpf/prog_tests/resolve_btfids.c | 34 ++++++++++---
 12 files changed, 153 insertions(+), 73 deletions(-)

-- 
2.24.1


             reply	other threads:[~2020-07-20 16:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-20 16:33 Yonghong Song [this message]
2020-07-20 16:33 ` [PATCH bpf-next v2 1/5] bpf: compute bpf_skc_to_*() helper socket btf ids at build time Yonghong Song
2020-07-20 16:33 ` [PATCH bpf-next v2 2/5] tools/bpf: sync btf_ids.h to tools Yonghong Song
2020-07-20 19:44   ` Jiri Olsa
2020-07-20 16:34 ` [PATCH bpf-next v2 3/5] bpf: add BTF_ID_LIST_GLOBAL in btf_ids.h Yonghong Song
2020-07-20 19:58   ` Jiri Olsa
2020-07-20 16:34 ` [PATCH bpf-next v2 4/5] bpf: make btf_sock_ids global Yonghong Song
2020-07-20 16:34 ` [PATCH bpf-next v2 5/5] bpf: net: use precomputed btf_id for bpf iterators Yonghong Song
2020-07-21 20:21 ` [PATCH bpf-next v2 0/5] bpf: compute btf_ids at build time for btf_iter Alexei Starovoitov

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=20200720163358.1392964-1-yhs@fb.com \
    --to=yhs@fb.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=jolsa@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).