lkml.org 
[lkml]   [2024]   [Apr]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    SubjectRe: [RFC PATCH 15/41] KVM: x86/pmu: Manage MSR interception for IA32_PERF_GLOBAL_CTRL
    From
    On Fri, Jan 26, 2024, Xiong Zhang wrote:
    > + if (is_passthrough_pmu_enabled(&vmx->vcpu)) {
    > + /*
    > + * Setup auto restore guest PERF_GLOBAL_CTRL MSR at vm entry.
    > + */
    > + if (vmentry_ctrl & VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL)
    > + vmcs_write64(GUEST_IA32_PERF_GLOBAL_CTRL, 0);
    > + else {
    > + i = vmx_find_loadstore_msr_slot(&vmx->msr_autoload.guest,
    > + MSR_CORE_PERF_GLOBAL_CTRL);
    > + if (i < 0) {
    > + i = vmx->msr_autoload.guest.nr++;
    > + vmcs_write32(VM_ENTRY_MSR_LOAD_COUNT,
    > + vmx->msr_autoload.guest.nr);
    > + }
    > + vmx->msr_autoload.guest.val[i].index = MSR_CORE_PERF_GLOBAL_CTRL;
    > + vmx->msr_autoload.guest.val[i].value = 0;

    Eww, no. Just make cpu_has_load_perf_global_ctrl() and VM_EXIT_SAVE_IA32_PERF_GLOBAL_CTRL
    hard requirements for enabling passthrough mode. And then have clear_atomic_switch_msr()
    yell if KVM tries to disable loading MSR_CORE_PERF_GLOBAL_CTRL.

    \
     
     \ /
      Last update: 2024-05-27 16:36    [W:2.649 / U:0.244 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site