Re: [PATCH v6 bpf-next 11/11] bpftool: Show perf link info

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2023-06-28 11:53 UTC+0000 ~ Yafang Shao <laoar.shao@xxxxxxxxx>
> Enhance bpftool to display comprehensive information about exposed
> perf_event links, covering uprobe, kprobe, tracepoint, and generic perf
> event. The resulting output will include the following details:
> 
> $ tools/bpf/bpftool/bpftool link show
> 3: perf_event  prog 14
>         event software:cpu-clock
>         bpf_cookie 0
>         pids perf_event(19483)
> 4: perf_event  prog 14
>         event hw-cache:LLC-load-misses
>         bpf_cookie 0
>         pids perf_event(19483)
> 5: perf_event  prog 14
>         event hardware:cpu-cycles
>         bpf_cookie 0
>         pids perf_event(19483)
> 6: perf_event  prog 19
>         tracepoint sched_switch
>         bpf_cookie 0
>         pids tracepoint(20947)
> 7: perf_event  prog 26
>         uprobe /home/dev/waken/bpf/uprobe/a.out+0x1338
>         bpf_cookie 0
>         pids uprobe(21973)
> 8: perf_event  prog 27
>         uretprobe /home/dev/waken/bpf/uprobe/a.out+0x1338
>         bpf_cookie 0
>         pids uprobe(21973)
> 10: perf_event  prog 43
>         kprobe ffffffffb70a9660 kernel_clone
>         bpf_cookie 0
>         pids kprobe(35275)
> 11: perf_event  prog 41
>         kretprobe ffffffffb70a9660 kernel_clone
>         bpf_cookie 0
>         pids kprobe(35275)
> 
> $ tools/bpf/bpftool/bpftool link show -j
> [{"id":3,"type":"perf_event","prog_id":14,"event_type":"software","event_config":"cpu-clock","bpf_cookie":0,"pids":[{"pid":19483,"comm":"perf_event"}]},{"id":4,"type":"perf_event","prog_id":14,"event_type":"hw-cache","event_config":"LLC-load-misses","bpf_cookie":0,"pids":[{"pid":19483,"comm":"perf_event"}]},{"id":5,"type":"perf_event","prog_id":14,"event_type":"hardware","event_config":"cpu-cycles","bpf_cookie":0,"pids":[{"pid":19483,"comm":"perf_event"}]},{"id":6,"type":"perf_event","prog_id":19,"tracepoint":"sched_switch","bpf_cookie":0,"pids":[{"pid":20947,"comm":"tracepoint"}]},{"id":7,"type":"perf_event","prog_id":26,"retprobe":false,"file":"/home/dev/waken/bpf/uprobe/a.out","offset":4920,"bpf_cookie":0,"pids":[{"pid":21973,"comm":"uprobe"}]},{"id":8,"type":"perf_event","prog_id":27,"retprobe":true,"file":"/home/dev/waken/bpf/uprobe/a.out","offset":4920,"bpf_cookie":0,"pids":[{"pid":21973,"comm":"uprobe"}]},{"id":10,"type":"perf_event","prog_id":43,"retprobe":false,"addr":18446744072485508704,"func":"kernel_clone","offset":0,"bpf_cookie":0,"pids":[{"pid":35275,"comm":"kprobe"}]},{"id":11,"type":"perf_event","prog_id":41,"retprobe":true,"addr":18446744072485508704,"func":"kernel_clone","offset":0,"bpf_cookie":0,"pids":[{"pid":35275,"comm":"kprobe"}]}]
> 
> For generic perf events, the displayed information in bpftool is limited to
> the type and configuration, while other attributes such as sample_period,
> sample_freq, etc., are not included.
> 
> The kernel function address won't be exposed if it is not permitted by
> kptr_restrict. The result as follows when kptr_restrict is 2.
> 
> $ tools/bpf/bpftool/bpftool link show
> 3: perf_event  prog 14
>         event software:cpu-clock
> 4: perf_event  prog 14
>         event hw-cache:LLC-load-misses
> 5: perf_event  prog 14
>         event hardware:cpu-cycles
> 6: perf_event  prog 19
>         tracepoint sched_switch
> 7: perf_event  prog 26
>         uprobe /home/dev/waken/bpf/uprobe/a.out+0x1338
> 8: perf_event  prog 27
>         uretprobe /home/dev/waken/bpf/uprobe/a.out+0x1338
> 10: perf_event  prog 43
>         kprobe kernel_clone
> 11: perf_event  prog 41
>         kretprobe kernel_clone
> 
> Signed-off-by: Yafang Shao <laoar.shao@xxxxxxxxx>

Reviewed-by: Quentin Monnet <quentin@xxxxxxxxxxxxx>

Thank you!





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux