[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5a7aebc9-2d4d-e202-5f89-8f5f2bc462db@intel.com>
Date: Tue, 15 Oct 2019 08:48:02 +0800
From: Xiaoyao Li <xiaoyao.li@...el.com>
To: Sean Christopherson <sean.j.christopherson@...el.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>
Cc: kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
Paolo Bonzini <pbonzini@...hat.com>,
Radim Krčmář <rkrcmar@...hat.com>,
Jim Mattson <jmattson@...gle.com>
Subject: Re: [PATCH] KVM: X86: Make fpu allocation a common function
On 10/15/2019 2:37 AM, Sean Christopherson wrote:
> On Mon, Oct 14, 2019 at 06:58:49PM +0200, Vitaly Kuznetsov wrote:
>> Xiaoyao Li <xiaoyao.li@...el.com> writes:
>>
>>> They are duplicated codes to create vcpu.arch.{user,guest}_fpu in VMX
>>> and SVM. Make them common functions.
>>>
>>> No functional change intended.
>>
>> Would it rather make sense to move this code to
>> kvm_arch_vcpu_create()/kvm_arch_vcpu_destroy() instead?
>
> Does it make sense? Yes. Would it actually work? No. Well, not without
> other shenanigans.
>
> FPU allocation can't be placed after the call to .create_vcpu() becuase
> it's consumed in kvm_arch_vcpu_init(). FPU allocation can't come before
> .create_vcpu() because the vCPU struct itself hasn't been allocated. The
> latter could be solved by passed the FPU pointer into .create_vcpu(), but
> that's a bit ugly and is not a precedent we want to set.
>
That's exactly what I found.
> At a glance, FPU allocation can be moved to kvm_arch_vcpu_init(), maybe
> right before the call to fx_init().
>
Yeah, putting here is better.
I'm wondering the semantic of create, init, setup. There are
vcpu_{create,init,setup}, and IIUC, vcpu_create is mainly for data
structure allocation and vcpu_{init,setup} should be for data structure
initialization/setup (and maybe they could/should merge into one)
But I feel the current codes for vcpu creation a bit messed, especially
of vmx.
Powered by blists - more mailing lists