linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] KVM: VMX: Disable LBRs if CPU doesn't have callstacks
@ 2024-03-07  1:13 Sean Christopherson
  2024-03-07  1:13 ` [PATCH 1/3] KVM: VMX: Snapshot LBR capabilities during module initialization Sean Christopherson
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Sean Christopherson @ 2024-03-07  1:13 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Sean Christopherson, Paolo Bonzini
  Cc: linux-perf-users, linux-kernel, kvm, Mingwei Zhang, Jim Mattson

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
-- 
2.44.0.278.ge034bb2e1d-goog


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-04-09  2:02 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-07  1:13 [PATCH 0/3] KVM: VMX: Disable LBRs if CPU doesn't have callstacks Sean Christopherson
2024-03-07  1:13 ` [PATCH 1/3] KVM: VMX: Snapshot LBR capabilities during module initialization Sean Christopherson
2024-03-18 22:50   ` Mingwei Zhang
2024-03-07  1:13 ` [PATCH 2/3] perf/x86/intel: Expose existence of callback support to KVM Sean Christopherson
2024-03-18 22:50   ` Mingwei Zhang
2024-03-07  1:13 ` [PATCH 3/3] KVM: VMX: Disable LBR virtualization if the CPU doesn't support LBR callstacks Sean Christopherson
2024-03-18 22:51   ` Mingwei Zhang
2024-04-09  2:01 ` [PATCH 0/3] KVM: VMX: Disable LBRs if CPU doesn't have callstacks Sean Christopherson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).