diff options
author | Andrii Nakryiko <andrii@kernel.org> | 2024-04-01 19:21:17 -0700 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2024-04-03 09:14:26 +0200 |
commit | a4d18112e5317c120bcadeb486fbe950f749bb5e (patch) | |
tree | c1b83b8949365190bc142559175f3f4a21e32266 /arch/x86/um | |
parent | 1eddf187e5d087de4560ec7c3baa2f8283920710 (diff) |
perf/x86/amd: Support capturing LBR from software events
Upstream commit c22ac2a3d4bd ("perf: Enable branch record for software
events") added ability to capture LBR (Last Branch Records) on Intel CPUs
from inside BPF program at pretty much any arbitrary point. This is
extremely useful capability that allows to figure out otherwise
hard to debug problems, because LBR is now available based on some
application-defined conditions, not just hardware-supported events.
'retsnoop' is one such tool that takes a huge advantage of this
functionality and has proved to be an extremely useful tool in
practice:
https://github.com/anakryiko/retsnoop
Now, AMD Zen4 CPUs got support for similar LBR functionality, but
necessary wiring inside the kernel is not yet setup. This patch seeks to
rectify this and follows a similar approach to the original patch
for Intel CPUs. We implement an AMD-specific callback set to be called
through perf_snapshot_branch_stack static call.
Previous preparatory patches ensured that amd_pmu_core_disable_all() and
__amd_pmu_lbr_disable() will be completely inlined and will have no
branches, so LBR snapshot contamination will be minimized.
This was tested on AMD Bergamo CPU and worked well when utilized from
the aforementioned retsnoop tool.
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Sandipan Das <sandipan.das@amd.com>
Link: https://lore.kernel.org/r/20240402022118.1046049-4-andrii@kernel.org
Diffstat (limited to 'arch/x86/um')
0 files changed, 0 insertions, 0 deletions