[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Ytnb2Zc0ANQM+twN@google.com>
Date: Thu, 21 Jul 2022 23:06:01 +0000
From: Sean Christopherson <seanjc@...gle.com>
To: Vitaly Kuznetsov <vkuznets@...hat.com>
Cc: kvm@...r.kernel.org, Paolo Bonzini <pbonzini@...hat.com>,
Anirudh Rayabharam <anrayabh@...ux.microsoft.com>,
Wanpeng Li <wanpengli@...cent.com>,
Jim Mattson <jmattson@...gle.com>,
Maxim Levitsky <mlevitsk@...hat.com>,
linux-hyperv@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 24/25] KVM: VMX: Cache MSR_IA32_VMX_MISC in vmcs_config
On Thu, Jul 14, 2022, Vitaly Kuznetsov wrote:
> @@ -2613,6 +2614,8 @@ static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf,
> if (((vmx_msr_high >> 18) & 15) != 6)
> return -EIO;
>
> + rdmsrl(MSR_IA32_VMX_MISC, misc_msr);
Might make sense to sanitize fields that KVM doesn't use and that are not exposed
to L1. Not sure it's worthwhile though as many of the bits fall into a grey area,
e.g. all the SMM stuff isn't technically used by KVM, but that's largely because
much of it just isn't relevant to virtualization.
I'm totally ok leaving it as-is, though maybe name it "unsanitized_misc" or so
to make that obvious?
> vmcs_conf->size = vmx_msr_high & 0x1fff;
> vmcs_conf->basic_cap = vmx_msr_high & ~0x1fff;
>
> @@ -2624,6 +2627,7 @@ static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf,
> vmcs_conf->cpu_based_3rd_exec_ctrl = _cpu_based_3rd_exec_control;
> vmcs_conf->vmexit_ctrl = _vmexit_control;
> vmcs_conf->vmentry_ctrl = _vmentry_control;
> + vmcs_conf->misc = misc_msr;
>
> return 0;
> }
> @@ -8241,11 +8245,9 @@ static __init int hardware_setup(void)
>
> if (enable_preemption_timer) {
> u64 use_timer_freq = 5000ULL * 1000 * 1000;
> - u64 vmx_msr;
>
> - rdmsrl(MSR_IA32_VMX_MISC, vmx_msr);
> cpu_preemption_timer_multi =
> - vmx_msr & VMX_MISC_PREEMPTION_TIMER_RATE_MASK;
> + vmcs_config.misc & VMX_MISC_PREEMPTION_TIMER_RATE_MASK;
>
> if (tsc_khz)
> use_timer_freq = (u64)tsc_khz * 1000;
> --
> 2.35.3
>
Powered by blists - more mailing lists