All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Hengqi Chen <hengqi.chen@gmail.com>
To: Andrii Nakryiko <andrii.nakryiko@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>,
	Martin Lau <kafai@fb.com>
Subject: Re: [PATCH bpf-next v3] libbpf: add btf__load_vmlinux_btf/btf__load_module_btf
Date: Sat, 31 Jul 2021 16:42:42 +0800	[thread overview]
Message-ID: <b1da3641-81bf-8ffa-2210-c4fccd8e6e45@gmail.com> (raw)
In-Reply-To: <CAEf4BzbtPFEbme_KZQA+n-gCgC+xp-v+270BBCi+89smi6pzkA@mail.gmail.com>



On 7/31/21 3:26 AM, Andrii Nakryiko wrote:
> On Fri, Jul 30, 2021 at 4:40 AM Hengqi Chen <hengqi.chen@gmail.com> wrote:
>>
>> Add two new APIs: btf__load_vmlinux_btf and btf__load_module_btf.
>> btf__load_vmlinux_btf is just an alias to the existing API named
>> libbpf_find_kernel_btf, rename to be more precisely and consistent
>> with existing BTF APIs. btf__load_module_btf can be used to load
>> module BTF, add it for completeness. These two APIs are useful for
>> implementing tracing tools and introspection tools. This is part
>> of the effort towards libbpf 1.0. [1]
>>
>> [1] https://github.com/libbpf/libbpf/issues/280
> 
> I changed this to
> 
> [0] Closes: https://github.com/libbpf/libbpf/issues/280
> 
> which will close an associated Github issue when we sync sources to
> Github next time. Let's see how this works in practice.
> 
>>
>> Signed-off-by: Hengqi Chen <hengqi.chen@gmail.com>
>> ---
> 
> Thanks, applied to bpf-next. But please follow up with a selftest that
> would utilize this new module BTF API. It's good to have all APIs
> exercised regularly. Look at test_progs.
> 

Thanks, will do.

>>  tools/lib/bpf/btf.c      | 15 ++++++++++++++-
>>  tools/lib/bpf/btf.h      |  6 ++++--
>>  tools/lib/bpf/libbpf.c   |  4 ++--
>>  tools/lib/bpf/libbpf.map |  2 ++
>>  4 files changed, 22 insertions(+), 5 deletions(-)
>>
>> diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c
>> index cafa4f6bd9b1..56e84583e283 100644
>> --- a/tools/lib/bpf/btf.c
>> +++ b/tools/lib/bpf/btf.c
>> @@ -4036,7 +4036,7 @@ static void btf_dedup_merge_hypot_map(struct btf_dedup *d)
>>                  */
>>                 if (d->hypot_adjust_canon)
>>                         continue;
>> -
>> +
>>                 if (t_kind == BTF_KIND_FWD && c_kind != BTF_KIND_FWD)
>>                         d->map[t_id] = c_id;
>>
>> @@ -4410,6 +4410,11 @@ static int btf_dedup_remap_types(struct btf_dedup *d)
>>   * data out of it to use for target BTF.
>>   */
>>  struct btf *libbpf_find_kernel_btf(void)
> 
> I switched this to __attribute__((alias("btf__load_vmlinux_btf"))); to
> match what Quentin did recently. Also moved comment above to be next
> to btf__load_vmlinux_btf.
> 

OK, the alias attribute look nicer.

>> +{
>> +       return btf__load_vmlinux_btf();
>> +}
>> +
>> +struct btf *btf__load_vmlinux_btf(void)
>>  {
>>         struct {
>>                 const char *path_fmt;
> 
> [...]
> 
>> diff --git a/tools/lib/bpf/libbpf.map b/tools/lib/bpf/libbpf.map
>> index 5aca3686ca5e..a2f471950213 100644
>> --- a/tools/lib/bpf/libbpf.map
>> +++ b/tools/lib/bpf/libbpf.map
>> @@ -380,4 +380,6 @@ LIBBPF_0.5.0 {
>>                 btf__load_into_kernel;
>>                 btf_dump__dump_type_data;
>>                 libbpf_set_strict_mode;
>> +               btf__load_vmlinux_btf;
>> +               btf__load_module_btf;
> 
> This list needs to be alphabetically sorted. I'll fix it up while
> applying, but please remember it for the future.
> 

Yeah, will keep this in mind.

>>  } LIBBPF_0.4.0;
>> --
>> 2.25.1
>>

      reply	other threads:[~2021-07-31  8:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-30 11:40 [PATCH bpf-next v3] libbpf: add btf__load_vmlinux_btf/btf__load_module_btf Hengqi Chen
2021-07-30 19:26 ` Andrii Nakryiko
2021-07-31  8:42   ` Hengqi Chen [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=b1da3641-81bf-8ffa-2210-c4fccd8e6e45@gmail.com \
    --to=hengqi.chen@gmail.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=john.fastabend@gmail.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.