mbox series

[v3,bpf-next,0/5] bpftool: Support dumping a map with btf_vmlinux_value_type_id

Message ID 20200115230012.1100525-1-kafai@fb.com
Headers show
Series bpftool: Support dumping a map with btf_vmlinux_value_type_id | expand

Message

Martin KaFai Lau Jan. 15, 2020, 11 p.m. UTC
When a map is storing a kernel's struct, its
map_info->btf_vmlinux_value_type_id is set.  The first map type
supporting it is BPF_MAP_TYPE_STRUCT_OPS.

This series adds support to dump this kind of map with BTF.
The first two patches are bug fixes which are only applicable to
bpf-next.

Please see individual patches for details.

v3:
- Remove unnecessary #include "libbpf_internal.h" from patch 5

v2:
- Expose bpf_find_kernel_btf() as a LIBBPF_API in patch 3 (Andrii)
- Cache btf_vmlinux in bpftool/map.c (Andrii)

Martin KaFai Lau (5):
  bpftool: Fix a leak of btf object
  bpftool: Fix missing BTF output for json during map dump
  libbpf: Expose bpf_find_kernel_btf as a LIBBPF_API
  bpftool: Add struct_ops map name
  bpftool: Support dumping a map with btf_vmlinux_value_type_id

 tools/bpf/bpftool/map.c  | 102 ++++++++++++++++++++++++---------------
 tools/lib/bpf/btf.c      | 102 ++++++++++++++++++++++++++++++++++++---
 tools/lib/bpf/btf.h      |   2 +
 tools/lib/bpf/libbpf.c   |  93 ++---------------------------------
 tools/lib/bpf/libbpf.map |   1 +
 5 files changed, 166 insertions(+), 134 deletions(-)

Comments

Alexei Starovoitov Jan. 15, 2020, 11:26 p.m. UTC | #1
On Wed, Jan 15, 2020 at 03:00:12PM -0800, Martin KaFai Lau wrote:
> When a map is storing a kernel's struct, its
> map_info->btf_vmlinux_value_type_id is set.  The first map type
> supporting it is BPF_MAP_TYPE_STRUCT_OPS.
> 
> This series adds support to dump this kind of map with BTF.
> The first two patches are bug fixes which are only applicable to
> bpf-next.
> 
> Please see individual patches for details.
> 
> v3:
> - Remove unnecessary #include "libbpf_internal.h" from patch 5

I think the subj of patch 3 is fine as-is.

Applied. Thanks