Fix a bug where KVM incorrectly advertises PMU_CAP_LBR_FMT to userspace if perf has disabled LBRs, e.g. because probing one or more LBR MSRs during setup hit a #GP. The non-KVM patches remove unnecessary stubs and unreachable error paths, which allows for a cleaner fix for said bug (backporting is unlikely to be necessary/requested). v4 - Make vmx_get_perf_capabilities() non-inline to avoid references to x86_perf_get_lbr() when CPU_SUP_INTEL=n. [kernel test robot] v3: - https://lore.kernel.org/all/20220831000051.4015031-1-seanjc@xxxxxxxxxx - Drop patches for bug #1 (already merged). - Drop misguided "clean up the capability check" patch. [Like] v2: - https://lore.kernel.org/all/20220803192658.860033-1-seanjc@xxxxxxxxxx - Add patches to fix bug #2. [Like] - Add a patch to clean up the capability check. - Tweak the changelog for the PMU refresh bug fix to call out that KVM should disallow changing feature MSRs after KVM_RUN. [Like] v1: https://lore.kernel.org/all/20220727233424.2968356-1-seanjc@xxxxxxxxxx Sean Christopherson (5): perf/x86/core: Remove unnecessary stubs provided for KVM-only helpers perf/x86/core: Drop the unnecessary return value from x86_perf_get_lbr() KVM: VMX: Move vmx_get_perf_capabilities() definition to vmx.c KVM: VMX: Fold vmx_supported_debugctl() into vcpu_supported_debugctl() KVM: VMX: Advertise PMU LBRs if and only if perf supports LBRs arch/x86/events/intel/lbr.c | 6 +--- arch/x86/include/asm/perf_event.h | 55 ++++++++----------------------- arch/x86/kvm/vmx/capabilities.h | 39 ++-------------------- arch/x86/kvm/vmx/vmx.c | 37 ++++++++++++++++++--- 4 files changed, 49 insertions(+), 88 deletions(-) base-commit: 372d07084593dc7a399bf9bee815711b1fb1bcf2 -- 2.37.2.789.g6183377224-goog