AMD Posts Linux Patches For "LbrExtV2" Zen 4 CPU Feature

Written by Michael Larabel in AMD on 11 August 2022 at 09:11 AM EDT. Add A Comment
While all of the key Zen 4 CPU functionality appears in place for the mainline Linux kernel, AMD engineers continue working to enable other new Zen 4 features for use under Linux. The newest patches out of AMD this morning are for LbrExtV2.

LbrExtV2 is their shorthand for an updated Last Branch Record (LBR) implementation coming with Zen 4 CPUs. Last Branch Record is used for determining/analyzing the control flow of software by logging branch information to registers in real-time. The LBR information can be used for determining of hot code paths and useful for areas like profile-guided compiler optimizations and other tuning based on being able to analyze the branches frequently taken in software.

AMD Last Branch Record Extension Version 2 adds new features like LBR-Freeze-on-PMI for better correlation with PMC overflow events. There is also new hardware branch filtering support for recording just specific types of branches. The LbrExtV2 filtering includes being able to suppress branches for just kernel-only, user-space only, conditional branches, near relative calls, near indirect calls, near returns, near indirect jumps, near relative jumps, and far branches.

LbrExtV2 also extends the Linux perf user-space API to provide branch speculation information with Zen 4 CPUs now able to provide branch speculation details. The speculation information includes whether the correct path was taken for the branch and if speculation was involved or whether the wrong path was taken.

The nearly thousand lines of new code working out the AMD Last Branch Record Extension Version 2 handling for Zen 4 can be found now for review on the kernel mailing list. Meanwhile this secondary patch series adds speculation information to the Linux perf tooling.

While Zen 4 CPUs are launching later this quarter, the timing of these patches mean they won't be mainlined until at least Linux 6.1 that in turn won't be out as stable until around end of year -- granted, for the vast majority of users they won't care about LbrExtV2 Linux perf integration unless engaging in heavy system profiling and tuning.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via

Popular News This Week