• Daniel Xu's avatar
    bpf: Add bpf_read_branch_records() helper · fff7b643
    Daniel Xu authored
    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: default avatarDaniel Xu <dxu@dxuuu.xyz>
    Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
    Acked-by: default avatarAndrii Nakryiko <andriin@fb.com>
    Link: https://lore.kernel.org/bpf/20200218030432.4600-2-dxu@dxuuu.xyz
    fff7b643
bpf.h 141 KB