netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alan Maguire <alan.maguire@oracle.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Song Liu <songliubraving@fb.com>,
	Andrii Nakryiko <andrii@kernel.org>, bpf <bpf@vger.kernel.org>,
	Networking <netdev@vger.kernel.org>,
	Alexei Starovoitov <ast@fb.com>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Kernel Team <Kernel-team@fb.com>
Subject: Re: [PATCH bpf-next 00/11] libbpf: split BTF support
Date: Fri, 30 Oct 2020 12:04:27 +0000 (GMT)	[thread overview]
Message-ID: <alpine.LRH.2.21.2010301144050.25037@localhost> (raw)
In-Reply-To: <CAEf4BzbtiByaU_-pEV8gVZH1N9_xCTWJBxb6DYPXF5p9b9+_kg@mail.gmail.com>

On Thu, 29 Oct 2020, Andrii Nakryiko wrote:

> On Thu, Oct 29, 2020 at 5:33 PM Song Liu <songliubraving@fb.com> wrote:
> >
> >
> >
> > > On Oct 28, 2020, at 5:58 PM, Andrii Nakryiko <andrii@kernel.org> wrote:
> > >
> > > This patch set adds support for generating and deduplicating split BTF. This
> > > is an enhancement to the BTF, which allows to designate one BTF as the "base
> > > BTF" (e.g., vmlinux BTF), and one or more other BTFs as "split BTF" (e.g.,
> > > kernel module BTF), which are building upon and extending base BTF with extra
> > > types and strings.
> > >
> > > Once loaded, split BTF appears as a single unified BTF superset of base BTF,
> > > with continuous and transparent numbering scheme. This allows all the existing
> > > users of BTF to work correctly and stay agnostic to the base/split BTFs
> > > composition.  The only difference is in how to instantiate split BTF: it
> > > requires base BTF to be alread instantiated and passed to btf__new_xxx_split()
> > > or btf__parse_xxx_split() "constructors" explicitly.
> > >
> > > This split approach is necessary if we are to have a reasonably-sized kernel
> > > module BTFs. By deduping each kernel module's BTF individually, resulting
> > > module BTFs contain copies of a lot of kernel types that are already present
> > > in vmlinux BTF. Even those single copies result in a big BTF size bloat. On my
> > > kernel configuration with 700 modules built, non-split BTF approach results in
> > > 115MBs of BTFs across all modules. With split BTF deduplication approach,
> > > total size is down to 5.2MBs total, which is on part with vmlinux BTF (at
> > > around 4MBs). This seems reasonable and practical. As to why we'd need kernel
> > > module BTFs, that should be pretty obvious to anyone using BPF at this point,
> > > as it allows all the BTF-powered features to be used with kernel modules:
> > > tp_btf, fentry/fexit/fmod_ret, lsm, bpf_iter, etc.
> >
> > Some high level questions. Do we plan to use split BTF for in-tree modules
> > (those built together with the kernel) or out-of-tree modules (those built
> > separately)? If it is for in-tree modules, is it possible to build split BTF
> > into vmlinux BTF?
> 
> It will be possible to use for both in-tree and out-of-tree. For
> in-tree, this will be integrated into the kernel build process. For
> out-of-tree, whoever builds their kernel module will need to invoke
> pahole -J with an extra flag pointing to the right vmlinux image (I
> haven't looked into the exact details of this integration, maybe there
> are already scripts in Linux repo that out-of-tree modules have to
> use, in such case we can add this integration there).
> 
> Merging all in-tree modules' BTFs into vmlinux's BTF defeats the
> purpose of the split BTF and will just increase the size of vmlinux
> BTF unnecessarily.
>

Again more of a question about how module BTF will be exposed, but
I'm wondering if there will be a way for a consumer to ask for
type info across kernel and module BTF, i.e. something like
libbpf_find_kernel_btf_id() ? Similarly will __builtin_btf_type_id()
work across both vmlinux and modules? I'm thinking of the case where we 
potentially don't know which module a type is defined in.

I realize in some cases type names may refer to different types in 
different modules (not sure how frequent this is in practice?) but
I'm curious how the split model for modules will interact with existing 
APIs and helpers.

In some cases it's likely that modules may share types with
each other that they do not share with vmlinux; in such cases 
will those types get deduplicated also, or is deduplication just
between kernel/module, and not module/module? 

Sorry I know these questions aren't about this patchset in
particular, but I'm just trying to get a sense of the bigger
picture. Thanks!

Alan

  parent reply	other threads:[~2020-10-30 12:07 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-29  0:58 [PATCH bpf-next 00/11] libbpf: split BTF support Andrii Nakryiko
2020-10-29  0:58 ` [PATCH bpf-next 01/11] libbpf: factor out common operations in BTF writing APIs Andrii Nakryiko
2020-10-30  0:36   ` Song Liu
2020-10-29  0:58 ` [PATCH bpf-next 02/11] selftest/bpf: relax btf_dedup test checks Andrii Nakryiko
2020-10-30 16:43   ` Song Liu
2020-10-30 18:44     ` Andrii Nakryiko
2020-10-30 22:30       ` Song Liu
2020-10-29  0:58 ` [PATCH bpf-next 03/11] libbpf: unify and speed up BTF string deduplication Andrii Nakryiko
2020-10-30 23:32   ` Song Liu
2020-11-03  4:51     ` Andrii Nakryiko
2020-11-03  4:59   ` Alexei Starovoitov
2020-11-03  6:01     ` Andrii Nakryiko
2020-10-29  0:58 ` [PATCH bpf-next 04/11] libbpf: implement basic split BTF support Andrii Nakryiko
2020-11-02 23:23   ` Song Liu
2020-11-03  5:02     ` Andrii Nakryiko
2020-11-03  5:41       ` Song Liu
2020-11-04 23:51         ` Andrii Nakryiko
2020-10-29  0:58 ` [PATCH bpf-next 05/11] selftests/bpf: add split BTF basic test Andrii Nakryiko
2020-11-02 23:36   ` Song Liu
2020-11-03  5:10     ` Andrii Nakryiko
2020-10-29  0:58 ` [PATCH bpf-next 06/11] selftests/bpf: add checking of raw type dump in BTF writer APIs selftests Andrii Nakryiko
2020-11-03  0:08   ` Song Liu
2020-11-03  5:14     ` Andrii Nakryiko
2020-10-29  0:58 ` [PATCH bpf-next 07/11] libbpf: fix BTF data layout checks and allow empty BTF Andrii Nakryiko
2020-11-03  0:51   ` Song Liu
2020-11-03  5:18     ` Andrii Nakryiko
2020-11-03  5:44       ` Song Liu
2020-10-29  0:58 ` [PATCH bpf-next 08/11] libbpf: support BTF dedup of split BTFs Andrii Nakryiko
2020-11-03  2:49   ` Song Liu
2020-11-03  5:25     ` Andrii Nakryiko
2020-11-03  5:59       ` Song Liu
2020-11-03  6:31         ` Andrii Nakryiko
2020-11-03 17:15           ` Song Liu
2020-11-03  5:10   ` Alexei Starovoitov
2020-11-03  6:27     ` Andrii Nakryiko
2020-11-03 17:55       ` Alexei Starovoitov
2020-10-29  0:59 ` [PATCH bpf-next 09/11] libbpf: accomodate DWARF/compiler bug with duplicated identical arrays Andrii Nakryiko
2020-11-03  2:52   ` Song Liu
2020-10-29  0:59 ` [PATCH bpf-next 10/11] selftests/bpf: add split BTF dedup selftests Andrii Nakryiko
2020-11-03  5:35   ` Song Liu
2020-11-03  6:05     ` Andrii Nakryiko
2020-11-03  6:30       ` Song Liu
2020-10-29  0:59 ` [PATCH bpf-next 11/11] tools/bpftool: add bpftool support for split BTF Andrii Nakryiko
2020-11-03  6:03   ` Song Liu
2020-10-30  0:33 ` [PATCH bpf-next 00/11] libbpf: split BTF support Song Liu
2020-10-30  2:33   ` Andrii Nakryiko
2020-10-30  6:45     ` Song Liu
2020-10-30 12:04     ` Alan Maguire [this message]
2020-10-30 18:30       ` 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=alpine.LRH.2.21.2010301144050.25037@localhost \
    --to=alan.maguire@oracle.com \
    --cc=Kernel-team@fb.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@fb.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=netdev@vger.kernel.org \
    --cc=songliubraving@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).