• Like Xu's avatar
    KVM: x86/svm: Add module param to control PMU virtualization · b1d66dad
    Like Xu authored
    For Intel, the guest PMU can be disabled via clearing the PMU CPUID.
    For AMD, all hw implementations support the base set of four
    performance counters, with current mainstream hardware indicating
    the presence of two additional counters via X86_FEATURE_PERFCTR_CORE.
    
    In the virtualized world, the AMD guest driver may detect
    the presence of at least one counter MSR. Most hypervisor
    vendors would introduce a module param (like lbrv for svm)
    to disable PMU for all guests.
    
    Another control proposal per-VM is to pass PMU disable information
    via MSR_IA32_PERF_CAPABILITIES or one bit in CPUID Fn4000_00[FF:00].
    Both of methods require some guest-side changes, so a module
    parameter may not be sufficiently granular, but practical enough.
    Signed-off-by: default avatarLike Xu <likexu@tencent.com>
    Message-Id: <20211117080304.38989-1-likexu@tencent.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    b1d66dad
pmu.c 7.99 KB