• Jiri Olsa's avatar
    perf tools: Synthesize bpf_trampoline/dispatcher ksymbol event · 943930e4
    Jiri Olsa authored
    Synthesize bpf images (trampolines/dispatchers) on start, as ksymbol
    events from /proc/kallsyms. Having this perf can recognize samples from
    those images and perf report and top shows them correctly.
    
    The rest of the ksymbol handling is already in place from for the bpf
    programs monitoring, so only the initial state was needed.
    
    perf report output:
    
      # Overhead  Command     Shared Object                  Symbol
    
        12.37%  test_progs  [kernel.vmlinux]                 [k] entry_SYSCALL_64
        11.80%  test_progs  [kernel.vmlinux]                 [k] syscall_return_via_sysret
         9.63%  test_progs  bpf_prog_bcf7977d3b93787c_prog2  [k] bpf_prog_bcf7977d3b93787c_prog2
         6.90%  test_progs  bpf_trampoline_24456             [k] bpf_trampoline_24456
         6.36%  test_progs  [kernel.vmlinux]                 [k] memcpy_erms
    
    Committer notes:
    
    Use scnprintf() instead of strncpy() to overcome this on fedora:32,
    rawhide and OpenMandriva Cooker:
    
        CC...
    943930e4
bpf-event.c 14.6 KB