Running command to collect last branch record performance statistics on linux virtual machine failed
search cancel

Running command to collect last branch record performance statistics on linux virtual machine failed

book

Article ID: 369620

calendar_today

Updated On:

Products

VMware vSphere ESX 8.x VMware vSphere ESXi

Issue/Introduction

Running "perf record --call-graph lbr" command on linux virtual machine failed with error "PMU Hardware or event type doesn't support branch stack sampling." and thus unable to collect last branch record.

user@localhost ~]$ perf record --call-graph lbr echo
Error:
cycles:u: PMU Hardware or event type doesn't support branch stack sampling.

Environment

VMware vCenter Server 8.0

Issue is seen across different linux distributions including Debian/RHEL/Centos etc.

Cause

Last Branch Record(LBR) is a feature in Intel CPUs that logs the source and destination addresses of recently executed branches.

LBR is primarily used for performance monitoring and debugging by tracking the control flow of programs.

There are certain prerequisites that need to be met in order to run LBR on Linux virtual machine.

 

 

Resolution

Below requirements need to be met in order to collect LBR statistics on linux virtual machine:

1 CPU on Sapphire Rapids and later as Architectural LBRs are only supported on Sapphire Rapids and later CPU generations.

2 ESXi host on 8.0 or later

3 guest VM hardware on latest version

4 guest_lbr.enable="TRUE" configuration added to vmx file

 

With the above conditions met, one should be able to gather LBR statistics. For example:

[user@localhost ~]$ perf record --call-graph lbr echo

[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.007 MB perf.data (37 samples) ]

 

Additional Information