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