]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86/pmu: Fix available_event_types check for REF_CPU_CYCLES event
authorLike Xu <likexu@tencent.com>
Wed, 5 Jan 2022 05:15:09 +0000 (13:15 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 17 Jan 2022 17:19:41 +0000 (12:19 -0500)
commit7e46b32355f70a002d46fdbc1829ca0a2ddb7ae8
treee5f73ec1ed5c738060b0835adbe2980128667550
parent709f7ebabbb932b4c822af3cdfa37d88d238b016
KVM: x86/pmu: Fix available_event_types check for REF_CPU_CYCLES event

According to CPUID 0x0A.EBX bit vector, the event [7] should be the
unrealized event "Topdown Slots" instead of the *kernel* generalized
common hardware event "REF_CPU_CYCLES", so we need to skip the cpuid
unavaliblity check in the intel_pmc_perf_hw_id() for the last
REF_CPU_CYCLES event and update the confusing comment.

If the event is marked as unavailable in the Intel guest CPUID
0AH.EBX leaf, we need to avoid any perf_event creation, whether
it's a gp or fixed counter. To distinguish whether it is a rejected
event or an event that needs to be programmed with PERF_TYPE_RAW type,
a new special returned value of "PERF_COUNT_HW_MAX + 1" is introduced.

Fixes: 26eab48ba480c ("KVM: PMU: add proper support for fixed counter 2")
Signed-off-by: Like Xu <likexu@tencent.com>
Message-Id: <20220105051509.69437-1-likexu@tencent.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/pmu.c
arch/x86/kvm/vmx/pmu_intel.c