• Like Xu's avatar
    KVM: x86/pmu: Avoid exposing Intel BTS feature · b9181c8e
    Like Xu authored
    The BTS feature (including the ability to set the BTS and BTINT
    bits in the DEBUGCTL MSR) is currently unsupported on KVM.
    
    But we may try using the BTS facility on a PEBS enabled guest like this:
        perf record -e branches:u -c 1 -d ls
    and then we would encounter the following call trace:
    
     [] unchecked MSR access error: WRMSR to 0x1d9 (tried to write 0x00000000000003c0)
            at rIP: 0xffffffff810745e4 (native_write_msr+0x4/0x20)
     [] Call Trace:
     []  intel_pmu_enable_bts+0x5d/0x70
     []  bts_event_add+0x54/0x70
     []  event_sched_in+0xee/0x290
    
    As it lacks any CPUID indicator or perf_capabilities valid bit
    fields to prompt for this information, the platform would hint
    the Intel BTS feature unavailable to guest by setting the
    BTS_UNAVAIL bit in the IA32_MISC_ENABLE.
    Signed-off-by: default avatarLike Xu <likexu@tencent.com>
    Message-Id: <20220601031925.59693-3-likexu@tencent.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    b9181c8e
pmu_intel.c 22.9 KB