Re: [PATCH 2/2] KVM: x86: VMX: untangle VMXON revision_id setting when using eVMCS

From: Vitaly Kuznetsov
Date: Thu Mar 05 2020 - 11:35:09 EST


Sean Christopherson <sean.j.christopherson@xxxxxxxxx> writes:

> On Thu, Mar 05, 2020 at 11:01:23AM +0100, Vitaly Kuznetsov wrote:
>> As stated in alloc_vmxon_regions(), VMXON region needs to be tagged with
>> revision id from MSR_IA32_VMX_BASIC even in case of eVMCS. The logic to
>> do so is not very straightforward: first, we set
>> hdr.revision_id = KVM_EVMCS_VERSION in alloc_vmcs_cpu() just to reset it
>> back to vmcs_config.revision_id in alloc_vmxon_regions(). Simplify this by
>> introducing 'enum vmx_area_type' parameter to what is now known as
>> alloc_vmx_area_cpu().
>
> I'd strongly prefer to keep the alloc_vmcs_cpu() name and call the new enum
> "vmcs_type". The discrepancy could be resolved by a comment above the
> VMXON_REGION usage, e.g.
>
> /* The VMXON region is really just a special type of VMCS. */
> vmcs = alloc_vmcs_cpu(VMXON_REGION, cpu, GFP_KERNEL);

I have no strong opinion (but honestly I don't really know what VMXON
region is being used for), Paolo already said 'queued' but I think I'll
send v2 with the suggested changes (including patch prefixes :-)

--
Vitaly