public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Alexei Starovoitov <ast@fb.com>, Yonghong Song <yhs@fb.com>,
	Martin Lau <kafai@fb.com>,
	bpf@vger.kernel.org, dwarves@vger.kernel.org
Subject: Re: pahole: soliciting naming suggestion for struct btf rename
Date: Thu, 14 Feb 2019 09:47:57 -0300	[thread overview]
Message-ID: <20190214124757.GP3269@kernel.org> (raw)
In-Reply-To: <CAEf4BzYH25Qi=H7woMf-ZHCu=tML=m+atDh+PO=wdNzeNZ2o3w@mail.gmail.com>

Em Wed, Feb 13, 2019 at 09:43:43PM -0800, Andrii Nakryiko escreveu:
> Hi folks,
> 
> I'm working on adding btf__dedup() support to pahole when doing DWARF
> to BTF conversion, which requires usage of libbpf from pahole. I've
> already added libbpf as a submodule and pahole now reuses btf.h header
> with all the btf struct definitions. Next step is actually using
> btf__dedup().
> 
> The problem with that is that both libbpf and pahole define their own
> incompatible versions of struct btf, which causes a lot of naming
> conflicts when I'm trying to use libbpf along those structs. Pahole
> has it's own internal library centered around struct btf with lots of
> useful methods to manipulate BTF data. My intent is to migrate most of
> that functionality (e.g., pretty-printing and BTF types construction)
> into libbpf, so maybe in the future pahole won't need it's own struct
> btf, but for now I'd like to avoid blocking on that.

I wonder if we should have a libbtf, with the same licensing as libbpf,
as, for instance, pahole would be interested only in the btf parts, be
it encoding, loading and pretty printing.

In fact the pretty printing part perhaps could be done exclusively using
the BTF parts, with the dwarf loader just being the current BTF encoder,
if we manage to not lose any information from DWARF, which is the case
for example, for multi dimensional arrays.

Having tools/lib/btf/ in the kernel sources would be nice for that, in
the long run I could even make a leaner pahole in tools/pahole/,
starting with the basic BTF pretty printing and in time getting the
other features, like struct reorganization to eliminate holes, etc, that
could, in time, even be something interesting to use in more situations.
 
> So to make progress I'll need to rename pahole's struct btf into
> something else. And I've been struggling to come up with good succinct
> name. The best I've got so far is btf_info, but I can't say I'm too

Humm, I think that what is being left for pahole is the encoding part,
right? So perhaps rename it to btf_encoder, the btf_loader part can use
libbpf's btf struct?

> happy with it. So consider this email a solicitation for naming
> suggestion. Keep in mind, that all the pahole's functions of the form
> btf__xxx will be renamed as well for consistency. If you like
> btf_info, let me know as well, I'll just stick with it.

Can you try thinking if splitting this further into 'struct btf_loader',
'struct btf_encoder' that would live in the pahole sources and that
refer to a 'struct btf' that lives in libbpf (or in libbtf, at some
point) is a move that eases your current needs?

- Arnaldo

  reply	other threads:[~2019-02-14 12:48 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-14  5:43 pahole: soliciting naming suggestion for struct btf rename Andrii Nakryiko
2019-02-14 12:47 ` Arnaldo Carvalho de Melo [this message]
2019-02-14 13:11   ` Arnaldo Carvalho de Melo
2019-02-14 13:20     ` Arnaldo Carvalho de Melo
2019-02-14 14:01       ` Arnaldo Carvalho de Melo
2019-02-15  4:37         ` Andrii Nakryiko
2019-02-15 17:15           ` Arnaldo Carvalho de Melo
2019-02-15 17:25             ` Andrii Nakryiko
2019-02-15 17:43               ` Arnaldo Carvalho de Melo
2019-02-15 17:17   ` Alexei Starovoitov
2019-02-15 17:25     ` Arnaldo Carvalho de Melo
2019-02-15 18:47       ` Alexei Starovoitov
2019-02-15 20:21         ` Daniel Borkmann
2019-02-18 12:44           ` Arnaldo Carvalho de Melo

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=20190214124757.GP3269@kernel.org \
    --to=acme@kernel.org \
    --cc=andrii.nakryiko@gmail.com \
    --cc=ast@fb.com \
    --cc=bpf@vger.kernel.org \
    --cc=dwarves@vger.kernel.org \
    --cc=kafai@fb.com \
    --cc=yhs@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