bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf-next 0/5] bpf: list BTF objects loaded on system
@ 2019-08-15 15:00 Quentin Monnet
  2019-08-15 15:00 ` [PATCH bpf-next 1/5] bpf: add new BPF_BTF_GET_NEXT_ID syscall command Quentin Monnet
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Quentin Monnet @ 2019-08-15 15:00 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann
  Cc: bpf, netdev, oss-drivers, Quentin Monnet

Hi,
This set adds a new command BPF_BTF_GET_NEXT_ID to the bpf() system call,
adds the relevant API function in libbpf, and uses it in bpftool to list
all BTF objects loaded on the system (and to dump the ids of maps and
programs associated with them, if any).

The main motivation of listing BTF objects is introspection and debugging
purposes. By getting BPF program and map information, it should already be
possible to list all BTF objects associated to at least one map or one
program. But there may be unattached BTF objects, held by a file descriptor
from a user space process only, and we may want to list them too.

As a side note, it also turned useful for examining the BTF objects
attached to offloaded programs, which would not show in program information
because the BTF id is not copied when retrieving such info. A fix is in
progress on that side.

Quentin Monnet (5):
  bpf: add new BPF_BTF_GET_NEXT_ID syscall command
  tools: bpf: synchronise BPF UAPI header with tools
  libbpf: refactor bpf_*_get_next_id() functions
  libbpf: add bpf_btf_get_next_id() to cycle through BTF objects
  tools: bpftool: implement "bpftool btf show|list"

 include/linux/bpf.h                           |   3 +
 include/uapi/linux/bpf.h                      |   1 +
 kernel/bpf/btf.c                              |   4 +-
 kernel/bpf/syscall.c                          |   4 +
 .../bpf/bpftool/Documentation/bpftool-btf.rst |   7 +
 tools/bpf/bpftool/bash-completion/bpftool     |  20 +-
 tools/bpf/bpftool/btf.c                       | 342 +++++++++++++++++-
 tools/include/uapi/linux/bpf.h                |   1 +
 tools/lib/bpf/Makefile                        |   2 +-
 tools/lib/bpf/bpf.c                           |  24 +-
 tools/lib/bpf/bpf.h                           |   1 +
 tools/lib/bpf/libbpf.map                      |   5 +
 12 files changed, 393 insertions(+), 21 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-08-20  1:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-15 15:00 [PATCH bpf-next 0/5] bpf: list BTF objects loaded on system Quentin Monnet
2019-08-15 15:00 ` [PATCH bpf-next 1/5] bpf: add new BPF_BTF_GET_NEXT_ID syscall command Quentin Monnet
2019-08-15 15:00 ` [PATCH bpf-next 2/5] tools: bpf: synchronise BPF UAPI header with tools Quentin Monnet
2019-08-15 15:00 ` [PATCH bpf-next 3/5] libbpf: refactor bpf_*_get_next_id() functions Quentin Monnet
2019-08-15 15:00 ` [PATCH bpf-next 4/5] libbpf: add bpf_btf_get_next_id() to cycle through BTF objects Quentin Monnet
2019-08-20  1:21   ` Alexei Starovoitov
2019-08-15 15:00 ` [PATCH bpf-next 5/5] tools: bpftool: implement "bpftool btf show|list" Quentin Monnet

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).