[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180226174923.2713410-1-songliubraving@fb.com>
Date: Mon, 26 Feb 2018 09:49:21 -0800
From: Song Liu <songliubraving@...com>
To: <netdev@...r.kernel.org>, <ast@...nel.org>, <peterz@...radead.org>,
<daniel@...earbox.net>
CC: <kernel-team@...com>, <hannes@...xchg.org>,
Song Liu <songliubraving@...com>
Subject: [PATCH bpf-next 0/2] stackmap with build_id+offset
This work follows up discussion at Plumbers'17 on improving addr->sym
resolution of user stack traces. The following links have more information
of the discussion:
http://www.linuxplumbersconf.org/2017/ocw/proposals/4764
https://lwn.net/Articles/734453/ Section "Stack traces and kprobes"
Currently, bpf stackmap store address for each entry in the call trace.
To map these addresses to user space files, it is necessary to maintain
the mapping from these virtual address to symbols in the binary. Usually,
the user space profiler (such as perf) has to scan /proc/pid/maps at the
beginning of profiling, and monitor mmap2() calls afterwards. Given the
cost of maintaining the address map, this solution is not practical for
system wide profiling that is always on.
This patch tries to address this with a variation to stackmap. Instead
of storing addresses, the variation stores ELF file build_id + offset.
After profiling, a user space tool will look up these functions with
build_id (to find the binary or shared library) and the offset.
I also updated bcc/cc library for the stackmap (no python/lua support yet).
You can find the work at:
https://github.com/liu-song-6/bcc/commits/bpf_get_stackid_v02
Thanks!
Song Liu (2):
bpf: extend stackmap to save binary_build_id+offset instead of address
bpf: add selftest for stackmap with BPF_F_STACK_BUILD_ID
include/uapi/linux/bpf.h | 15 ++
kernel/bpf/stackmap.c | 261 +++++++++++++++++++--
tools/include/uapi/linux/bpf.h | 15 ++
tools/testing/selftests/bpf/Makefile | 12 +-
tools/testing/selftests/bpf/test_progs.c | 164 ++++++++++++-
.../selftests/bpf/test_stacktrace_build_id.c | 60 +++++
tools/testing/selftests/bpf/urandom_read.c | 22 ++
7 files changed, 525 insertions(+), 24 deletions(-)
create mode 100644 tools/testing/selftests/bpf/test_stacktrace_build_id.c
create mode 100644 tools/testing/selftests/bpf/urandom_read.c
--
2.9.5
Powered by blists - more mailing lists