bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Saeed Mahameed <saeed@kernel.org>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: bpf <bpf@vger.kernel.org>, Alexei Starovoitov <ast@fb.com>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Networking <netdev@vger.kernel.org>,
	Andrii Nakryiko <andrii@kernel.org>
Subject: Re: [PATCH bpf] tools/bpftool: Add/Fix support for modules btf dump
Date: Mon, 07 Dec 2020 22:52:37 -0800	[thread overview]
Message-ID: <3a00844babdefd409f7193eabbdf4c7e13c2aa1b.camel@kernel.org> (raw)
In-Reply-To: <CAEf4BzZYfaC0v8ewDyQHz9JNL-w8bJazAJmuweuH=zif-RUy3Q@mail.gmail.com>

On Mon, 2020-12-07 at 22:48 -0800, Andrii Nakryiko wrote:
> On Mon, Dec 7, 2020 at 10:45 PM Saeed Mahameed <saeed@kernel.org>
> wrote:
> > On Mon, 2020-12-07 at 22:38 -0800, Andrii Nakryiko wrote:
> > > On Mon, Dec 7, 2020 at 10:26 PM Saeed Mahameed <saeed@kernel.org>
> > > wrote:
> > > > On Mon, 2020-12-07 at 19:14 -0800, Andrii Nakryiko wrote:
> > > > > On Sun, Dec 6, 2020 at 9:21 PM <saeed@kernel.org> wrote:
> > > > > > From: Saeed Mahameed <saeedm@nvidia.com>
> > > > > > 
> > [...]
> > > > > > I am not sure why this hasn't been added by the original
> > > > > > patchset
> > > > > 
> > > > > because I never though of dumping module BTF by id, given
> > > > > there
> > > > > is
> > > > > nicely named /sys/kernel/btf/<module> :)
> > > > > 
> > > > 
> > > > What if i didn't compile my kernel with SYSFS ? a user
> > > > experience
> > > > is a
> > > > user experience, there is no reason to not support dump a
> > > > module
> > > > btf by
> > > > id or to have different behavior for different BTF sources.
> > > 
> > > Hm... I didn't claim otherwise and didn't oppose the feature, why
> > > the
> > > lecture about user experience?
> > > 
> > 
> > Sorry wasn't a lecture, just wanted to emphasize the motivation.
> > 
> > > Not having sysfs is a valid point. In such cases, if BTF dumping
> > > is
> > > from ID and we see that it's a module BTF, finding vmlinux BTF
> > > from
> > > ID
> > > makes sense.
> > > 
> > > > I can revise this patch to support -B option and lookup vmlinux
> > > > file if
> > > > not provided for module btf dump by ids.
> > > 
> > > yep
> > > 
> > > > but we  still need to pass base_btf to btf__get_from_id() in
> > > > order
> > > > to
> > > > support that, as was done for btf__parse_split() ... :/
> > > 
> > > btf__get_from_id_split() might be needed, yes.
> > > 
> > > > Are you sure you don't like the current patch/libbpf API ? it
> > > > is
> > > > pretty
> > > > straight forward and correct.
> > > 
> > > I definitely don't like adding btf_get_kernel_id() API to libbpf.
> > > There is nothing special about it to warrant adding it as a
> > > public
> > > API. Everything we discussed can be done by bpftool.
> > > 
> > 
> > What about the case where sysfs isn't available ?
> > we still need to find vmlinux's btf id..
> 
> Right, but bpftool is perfectly capable of doing that without adding
> APIs to libbpf. That's why I wrote above:
> 
>   > > Not having sysfs is a valid point. In such cases, if BTF
> dumping is
>   > > from ID and we see that it's a module BTF, finding vmlinux BTF
> from
>   > > ID
>   > > makes sense.

Oh now i see, you want to scan for it in bpftool.. make sense.




      reply	other threads:[~2020-12-08  6:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-07  5:20 [PATCH bpf] tools/bpftool: Add/Fix support for modules btf dump saeed
2020-12-08  3:14 ` Andrii Nakryiko
2020-12-08  6:26   ` Saeed Mahameed
2020-12-08  6:38     ` Andrii Nakryiko
2020-12-08  6:45       ` Saeed Mahameed
2020-12-08  6:48         ` Andrii Nakryiko
2020-12-08  6:52           ` Saeed Mahameed [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=3a00844babdefd409f7193eabbdf4c7e13c2aa1b.camel@kernel.org \
    --to=saeed@kernel.org \
    --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 \
    /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).