Re: [PATCH] KVM: nVMX: Don't expose TSC scaling to L1 when on Hyper-V

From: Vitaly Kuznetsov
Date: Wed Jun 22 2022 - 04:00:39 EST


Sean Christopherson <seanjc@xxxxxxxxxx> writes:

> On Tue, Jun 14, 2022, Anirudh Rayabharam wrote:
>> On Mon, Jun 13, 2022 at 04:57:49PM +0000, Sean Christopherson wrote:

...

>> >
>> > Any reason not to use the already sanitized vmcs_config? I can't think of any
>> > reason why the nested path should blindly use the raw MSR values from hardware.
>>
>> vmcs_config has the sanitized exec controls. But how do we construct MSR
>> values using them?
>
> I was thinking we could use the sanitized controls for the allowed-1 bits, and then
> take the required-1 bits from the CPU. And then if we wanted to avoid the redundant
> RDMSRs in a follow-up patch we could add required-1 fields to vmcs_config.
>
> Hastily constructed and compile-tested only, proceed with caution :-)

Independently from "[PATCH 00/11] KVM: VMX: Support TscScaling and
EnclsExitingBitmap whith eVMCS" which is supposed to fix the particular
TSC scaling issue, I like the idea to make nested_vmx_setup_ctls_msrs()
use both allowed-1 and required-1 bits from vmcs_config. I'll pick up
the suggested patch and try to construct something for required-1 bits.

Thanks!

--
Vitaly