Skip to content

KVM: VMX: Disable LBRs if CPU doesn't have callstacks

Sean Christopherson kvm linux-perf-users lkml 1 version Applied

Status from this message: Applied to kvm-x86 fixes, as I can't imagine anyone objecting to patch 2.

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 4 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/3KVM: VMX: Snapshot LBR capabilities during module initializationarch/x86/kvm/vmx/pmu_intel.c arch/x86/kvm/vmx/vmx.c arch/x86/kvm/vmx/vmx.h+8 -51 reply
2/3perf/x86/intel: Expose existence of callback support to KVMarch/x86/events/intel/lbr.c arch/x86/include/asm/perf_event.h+2 -01 reply
3/3KVM: VMX: Disable LBR virtualization if the CPU doesn't support LBR callstacksarch/x86/kvm/vmx/vmx.c+9 -11 reply

Reviews trailers per patch

2 of 3 patches have a Reviewed-by or Acked-by.

PatchMingwei Zhang
1/3R-b
2/3R-b
3/3T-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/3] KVM: VMX: Disable LBRs if CPU doesn't have callstacks

Disable LBR virtualization if the CPU (or I guess perf) doesn't support LBR callstacks, as KVM unconditionally creates the associated perf LBR event with PERF_SAMPLE_BRANCH_CALL_STACK. That results in perf rejecting the event, and cause LBR virtualization to silently fail.

This was detected by running vmx_pmu_caps_test on older hardware. I didn't tag it for stable because I can't imagine anyone is trying to use KVM's LBR virtualization on pre-HSW.

Sean Christopherson (3):
KVM: VMX: Snapshot LBR capabilities during module initialization perf/x86/intel: Expose existence of callback support to KVM
KVM: VMX: Disable LBR virtualization if the CPU doesn't support LBR
callstacks

 arch/x86/events/intel/lbr.c       |  1 +
 arch/x86/include/asm/perf_event.h |  1 +
 arch/x86/kvm/vmx/pmu_intel.c      |  2 +-
 arch/x86/kvm/vmx/vmx.c            | 17 +++++++++++++----
 arch/x86/kvm/vmx/vmx.h            |  2 ++
 5 files changed, 18 insertions(+), 5 deletions(-)

base-commit: 0c64952fec3ea01cb5b09f00134200f3e7ab40d5

Signature · 1 line
2.44.0.278.ge034bb2e1d-goog