From: Alan Maguire <alan.maguire@oracle.com>
To: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org
Cc: kafai@fb.com, songliubraving@fb.com, yhs@fb.com,
john.fastabend@gmail.com, kpsingh@chromium.org,
rostedt@goodmis.org, mingo@redhat.com, haoluo@google.com,
jolsa@kernel.org, quentin@isovalent.com,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
bpf@vger.kernel.org
Subject: [RFC bpf-next 0/3] bpf: support module BTF in btf display helpers
Date: Fri, 13 Nov 2020 18:10:10 +0000 [thread overview]
Message-ID: <1605291013-22575-1-git-send-email-alan.maguire@oracle.com> (raw)
This series aims to add support to bpf_snprintf_btf() and
bpf_seq_printf_btf() allowing them to store string representations
of module-specific types, as well as the kernel-specific ones
they currently support.
Patch 1 adds an additional field "const char *module" to
"struct btf_ptr", allowing the specification of a module
name along with a data pointer, BTF id, etc. It is then
used to look up module BTF, rather than the default
vmlinux BTF.
Patch 2 makes a small fix to libbpf to allow
btf__type_by_name[_kind] to work with split BTF. Without
this fix, type lookup of a module-specific type id will fail
in patch 3.
Patch 3 is a selftest that uses veth (when built as a
module) and a kprobe to display both a module-specific
and kernel-specific type; both are arguments to veth_stats_rx().
Alan Maguire (3):
bpf: add module support to btf display helpers
libbpf: bpf__find_by_name[_kind] should use btf__get_nr_types()
selftests/bpf: verify module-specific types can be shown via
bpf_snprintf_btf
include/linux/btf.h | 8 ++
include/uapi/linux/bpf.h | 5 +-
kernel/bpf/btf.c | 18 ++++
kernel/trace/bpf_trace.c | 42 +++++++---
tools/include/uapi/linux/bpf.h | 5 +-
tools/lib/bpf/btf.c | 4 +-
.../selftests/bpf/prog_tests/snprintf_btf_mod.c | 96 ++++++++++++++++++++++
tools/testing/selftests/bpf/progs/btf_ptr.h | 1 +
tools/testing/selftests/bpf/progs/veth_stats_rx.c | 73 ++++++++++++++++
9 files changed, 238 insertions(+), 14 deletions(-)
create mode 100644 tools/testing/selftests/bpf/prog_tests/snprintf_btf_mod.c
create mode 100644 tools/testing/selftests/bpf/progs/veth_stats_rx.c
--
1.8.3.1
next reply other threads:[~2020-11-13 18:11 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-13 18:10 Alan Maguire [this message]
2020-11-13 18:10 ` [RFC bpf-next 1/3] bpf: add module support to btf display helpers Alan Maguire
2020-11-14 6:58 ` Andrii Nakryiko
2020-11-14 16:04 ` Alexei Starovoitov
2020-11-15 4:13 ` Yonghong Song
2020-11-15 10:53 ` Alan Maguire
2020-11-17 23:56 ` Andrii Nakryiko
2020-11-13 18:10 ` [RFC bpf-next 2/3] libbpf: bpf__find_by_name[_kind] should use btf__get_nr_types() Alan Maguire
2020-11-14 6:46 ` Andrii Nakryiko
2020-11-13 18:10 ` [RFC bpf-next 3/3] selftests/bpf: verify module-specific types can be shown via bpf_snprintf_btf Alan Maguire
2020-11-14 7:01 ` Andrii Nakryiko
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=1605291013-22575-1-git-send-email-alan.maguire@oracle.com \
--to=alan.maguire@oracle.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kafai@fb.com \
--cc=kpsingh@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=quentin@isovalent.com \
--cc=rostedt@goodmis.org \
--cc=songliubraving@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox