• Like Xu's avatar
    KVM: x86/pmu: Fix available_event_types check for REF_CPU_CYCLES event · a2186448
    Like Xu authored
    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: 62079d8a ("KVM: PMU: add proper support for fixed counter 2")
    Signed-off-by: default avatarLike Xu <likexu@tencent.com>
    Message-Id: <20220105051509.69437-1-likexu@tencent.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    a2186448
pmu_intel.c 20.4 KB