BPF List
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Daniel Xu <dxu@dxuuu.xyz>
Cc: jolsa@kernel.org, quentin@isovalent.com, alan.maguire@oracle.com,
	eddyz87@gmail.com, andrii.nakryiko@gmail.com, ast@kernel.org,
	daniel@iogearbox.net, bpf@vger.kernel.org
Subject: Re: [PATCH dwarves v6 0/3] pahole: Inject kfunc decl tags into BTF
Date: Tue, 2 Apr 2024 17:24:28 -0300	[thread overview]
Message-ID: <ZgxpfDAKRAkHVNex@x1> (raw)
In-Reply-To: <cover.1711389163.git.dxu@dxuuu.xyz>

On Mon, Mar 25, 2024 at 11:53:36AM -0600, Daniel Xu wrote:
> This patchset teaches pahole to parse symbols in .BTF_ids section in
> vmlinux and discover exported kfuncs. Pahole then takes the list of
> kfuncs and injects a BTF_KIND_DECL_TAG for each kfunc.
> 
> Example of encoding:
> 
>         $ bpftool btf dump file .tmp_vmlinux.btf | rg "DECL_TAG 'bpf_kfunc'" | wc -l
>         121
> 
>         $ bpftool btf dump file .tmp_vmlinux.btf | rg 56337
>         [56337] FUNC 'bpf_ct_change_timeout' type_id=56336 linkage=static
>         [127861] DECL_TAG 'bpf_kfunc' type_id=56337 component_idx=-1
> 
> This enables downstream users and tools to dynamically discover which
> kfuncs are available on a system by parsing vmlinux or module BTF, both
> available in /sys/kernel/btf.
> 
> This feature is enabled with --btf_features=decl_tag,decl_tag_kfuncs.
> 
> === Changelog ===

I'm a bit lagged on my backlog, will try and process these soon,

- Arnaldo
 
> Changes from v5:
> * Add gobuffer__sort() helper
> * Use strstarts() instead of strncmp()
> * Use uint64_t instead of size_t
> * Add clarifying comments for get_func_name()
> 
> Changes from v4:
> * Update man page with decl_tag_kfuncs feature
> * Fix release mode build warnings
> * Add elf_getshrstrndx() error checking
> * Disable tagging if decl_tag feature is off
> * Fix malformed func name handling
> 
> Changes from v3:
> * Guard kfunc tagging behind feature flag
> * Use struct btf_id_set8 definition
> * Remove unnecessary member from btf_encoder
> * Fix code styling
> 
> Changes from v2:
> * More reliably detect kfunc membership in set8 by tracking set addr ranges
> * Rename some variables/functions to be more clear about kfunc vs func
> 
> Changes from v1:
> * Fix resource leaks
> * Fix callee -> caller typo
> * Rename btf_decl_tag from kfunc -> bpf_kfunc
> * Only grab btf_id_set funcs tagged kfunc
> * Presort btf func list
> 
> Daniel Xu (3):
>   gobuffer: Add gobuffer__sort() helper
>   pahole: Add --btf_feature=decl_tag_kfuncs feature
>   pahole: Inject kfunc decl tags into BTF
> 
>  btf_encoder.c      | 374 +++++++++++++++++++++++++++++++++++++++++++++
>  dwarves.h          |   1 +
>  gobuffer.c         |   5 +
>  gobuffer.h         |   2 +
>  man-pages/pahole.1 |   1 +
>  pahole.c           |   1 +
>  6 files changed, 384 insertions(+)
> 
> -- 
> 2.44.0

      parent reply	other threads:[~2024-04-02 20:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-25 17:53 [PATCH dwarves v6 0/3] pahole: Inject kfunc decl tags into BTF Daniel Xu
2024-03-25 17:53 ` [PATCH dwarves v6 1/3] gobuffer: Add gobuffer__sort() helper Daniel Xu
2024-04-17  9:20   ` Alan Maguire
2024-04-17 13:40     ` Arnaldo Carvalho de Melo
2024-04-18  9:31       ` Alan Maguire
2024-03-25 17:53 ` [PATCH dwarves v6 2/3] pahole: Add --btf_feature=decl_tag_kfuncs feature Daniel Xu
2024-03-25 17:53 ` [PATCH dwarves v6 3/3] pahole: Inject kfunc decl tags into BTF Daniel Xu
2024-04-17  9:32   ` Alan Maguire
2024-04-02 20:24 ` Arnaldo Carvalho de Melo [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=ZgxpfDAKRAkHVNex@x1 \
    --to=acme@kernel.org \
    --cc=alan.maguire@oracle.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=dxu@dxuuu.xyz \
    --cc=eddyz87@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=quentin@isovalent.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