2020-02-20 13:54:11

by 陈弋玺

[permalink] [raw]
Subject: [Ask for Help]LBR usage in kernel

Hi experts,
We want to try to retreive callchains of some perf events from LBR rather than frame stacks, as the information in frame stacks would be optimized by compiler. After investigating the usage of LBR in kernel, we found that LBR can only operated via Intel PMU, that means for now only callchains of hardware events can be retrieved from LBR. Is that correct?
If yes, I wonder if callchains of other perf events(eg. tracepoint, software events) can be retrieved from LBR? Or only callchains of events on PMU can be retrieved from LBR as there are some hardware restrictions?

Thanks for any help you can offer!

Best Regards,
Yixi Chen


2020-02-24 01:29:27

by Xu, Like

[permalink] [raw]
Subject: Re: [Ask for Help]LBR usage in kernel

Hi 弋玺,

On 2020/2/20 21:53, 陈弋玺 wrote:
> Hi experts,
> We want to try to retreive callchains of some perf events from LBR rather than frame stacks, as the information in frame stacks would be optimized by compiler. After investigating the usage of LBR in kernel, we found that LBR can only operated via Intel PMU,
The default driver to operate LBR on the Linux is the PMU deriver,
which is one of perf feature ofs and I assume you know about its basic usages.

    perf record -b ./workload
    perf record --call-graph lbr ./workload

Other performance monitoring tools like Emon, VTune and other non-opensource
commercial tools in Ring 0 could operate LBR as well.
> that means for now only callchains of hardware events can be retrieved from LBR. Is that correct?
the callchains and the basic branch records in sampling mode.
>
> If yes, I wonder if callchains of other perf events(eg. tracepoint, software events) can be retrieved from LBR?
Software events like trace points are not retrieved from LBR,
but you could wrapper them with intentional branch instructions changes.

> Or only callchains of events on PMU can be retrieved from LBR as there are some hardware restrictions?
I won't say its hardware restrictions but intentional behavior.
It's all about your innovative ideas to operate LBR for your purpose.

Thanks,
Like Xu
>
> Thanks for any help you can offer!
>
> Best Regards,
> Yixi Chen