]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Add bpf_read_branch_records() helper
authorDaniel Xu <dxu@dxuuu.xyz>
Tue, 18 Feb 2020 03:04:31 +0000 (19:04 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 19 Feb 2020 22:37:36 +0000 (14:37 -0800)
commit737f5b54e1965db783b78340da0ac07995f70278
treeca8d642f593dee81cfdf303d8675ff5754dcb393
parent6178eb9c397404090b3288c0e5d77c813ecd3501
bpf: Add bpf_read_branch_records() helper

Branch records are a CPU feature that can be configured to record
certain branches that are taken during code execution. This data is
particularly interesting for profile guided optimizations. perf has had
branch record support for a while but the data collection can be a bit
coarse grained.

We (Facebook) have seen in experiments that associating metadata with
branch records can improve results (after postprocessing). We generally
use bpf_probe_read_*() to get metadata out of userspace. That's why bpf
support for branch records is useful.

Aside from this particular use case, having branch data available to bpf
progs can be useful to get stack traces out of userspace applications
that omit frame pointers.

Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Link: https://lore.kernel.org/bpf/20200218030432.4600-2-dxu@dxuuu.xyz
include/uapi/linux/bpf.h
kernel/trace/bpf_trace.c