mbox series

[v2,bpf-next,0/3] libbpf: add bulk BTF type copying API

Message ID 20211006051107.17921-1-andrii@kernel.org (mailing list archive)
Headers show
Series libbpf: add bulk BTF type copying API | expand

Message

Andrii Nakryiko Oct. 6, 2021, 5:11 a.m. UTC
From: Andrii Nakryiko <andrii@kernel.org>

Add bulk BTF type data copying API, btf__add_btf(), to libbpf. This API is
useful for tools that are manipulating BPF, such as pahole. They abstract away
the details of implementing a pretty mundane, but important to get right,
details of handling all possible BTF kinds, as well as, importantly, adjusting
BTF type IDs and copying/deduplicating strings and string offsets, referenced
from copied BTF types.

Also, being a batch API, it's possible to improve the efficiency by
preallocating necessary memory more efficiently.

This API is going to be used by pahole to implement efficient parallelized BTF
encoding.

v1->v2:
  - fix typo in doc comment and selftest clean up fix (Song).

Cc: Arnaldo Carvalho de Melo <acme@kernel.org>

Andrii Nakryiko (3):
  libbpf: add API that copies all BTF types from one BTF object to
    another
  selftests/bpf: refactor btf_write selftest to reuse BTF generation
    logic
  selftests/bpf: test new btf__add_btf() API

 tools/lib/bpf/btf.c                           | 114 +++++++++++++-
 tools/lib/bpf/btf.h                           |  22 +++
 tools/lib/bpf/libbpf.map                      |   1 +
 .../selftests/bpf/prog_tests/btf_write.c      | 141 +++++++++++++++++-
 4 files changed, 270 insertions(+), 8 deletions(-)

Comments

patchwork-bot+netdevbpf@kernel.org Oct. 6, 2021, 1:40 p.m. UTC | #1
Hello:

This series was applied to bpf/bpf-next.git (refs/heads/master):

On Tue,  5 Oct 2021 22:11:04 -0700 you wrote:
> From: Andrii Nakryiko <andrii@kernel.org>
> 
> Add bulk BTF type data copying API, btf__add_btf(), to libbpf. This API is
> useful for tools that are manipulating BPF, such as pahole. They abstract away
> the details of implementing a pretty mundane, but important to get right,
> details of handling all possible BTF kinds, as well as, importantly, adjusting
> BTF type IDs and copying/deduplicating strings and string offsets, referenced
> from copied BTF types.
> 
> [...]

Here is the summary with links:
  - [v2,bpf-next,1/3] libbpf: add API that copies all BTF types from one BTF object to another
    https://git.kernel.org/bpf/bpf-next/c/7ca611215983
  - [v2,bpf-next,2/3] selftests/bpf: refactor btf_write selftest to reuse BTF generation logic
    https://git.kernel.org/bpf/bpf-next/c/c65eb8082d4c
  - [v2,bpf-next,3/3] selftests/bpf: test new btf__add_btf() API
    https://git.kernel.org/bpf/bpf-next/c/9d0578722391

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html