Re: [PATCH] KVM: X86: Make fpu allocation a common function

2019-10-21 Thread Xiaoyao Li
On 10/21/2019 9:09 PM, Paolo Bonzini wrote: On 17/10/19 18:05, Sean Christopherson wrote: On Wed, Oct 16, 2019 at 11:41:05AM +0200, Paolo Bonzini wrote: On 16/10/19 09:48, Xiaoyao Li wrote: BTW, could you have a look at the series I sent yesterday to refactor the vcpu creation flow, which is

Re: [PATCH] KVM: X86: Make fpu allocation a common function

2019-10-21 Thread Paolo Bonzini
On 17/10/19 18:05, Sean Christopherson wrote: > On Wed, Oct 16, 2019 at 11:41:05AM +0200, Paolo Bonzini wrote: >> On 16/10/19 09:48, Xiaoyao Li wrote: >>> BTW, could you have a look at the series I sent yesterday to refactor >>> the vcpu creation flow, which is inspired partly by this issue. Any

Re: [PATCH] KVM: X86: Make fpu allocation a common function

2019-10-17 Thread Sean Christopherson
On Wed, Oct 16, 2019 at 11:41:05AM +0200, Paolo Bonzini wrote: > On 16/10/19 09:48, Xiaoyao Li wrote: > > BTW, could you have a look at the series I sent yesterday to refactor > > the vcpu creation flow, which is inspired partly by this issue. Any > > comment and suggestion is welcomed since I

Re: [PATCH] KVM: X86: Make fpu allocation a common function

2019-10-16 Thread Paolo Bonzini
On 16/10/19 09:48, Xiaoyao Li wrote: > BTW, could you have a look at the series I sent yesterday to refactor > the vcpu creation flow, which is inspired partly by this issue. Any > comment and suggestion is welcomed since I don't want to waste time on > wrong direction. Yes, that's the series

Re: [PATCH] KVM: X86: Make fpu allocation a common function

2019-10-16 Thread Xiaoyao Li
On 10/16/2019 3:35 PM, Paolo Bonzini wrote: On 16/10/19 03:52, Xiaoyao Li wrote: user_fpu could be made percpu too...  That would save a bit of memory for each vCPU.  I'm holding on Xiaoyao's patch because a lot of the code he's touching would go away then. Sorry, I don't get clear your

Re: [PATCH] KVM: X86: Make fpu allocation a common function

2019-10-16 Thread Paolo Bonzini
On 16/10/19 03:52, Xiaoyao Li wrote: >> >> user_fpu could be made percpu too...  That would save a bit of memory >> for each vCPU.  I'm holding on Xiaoyao's patch because a lot of the code >> he's touching would go away then. > > Sorry, I don't get clear your attitude. > Do you mean the generic

Re: [PATCH] KVM: X86: Make fpu allocation a common function

2019-10-15 Thread Xiaoyao Li
On 10/15/2019 5:28 PM, Paolo Bonzini wrote: On 14/10/19 18:58, Vitaly Kuznetsov wrote: Xiaoyao Li 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

Re: [PATCH] KVM: X86: Make fpu allocation a common function

2019-10-15 Thread Paolo Bonzini
On 15/10/19 16:36, Vitaly Kuznetsov wrote: >> On 15/10/19 12:53, Vitaly Kuznetsov wrote: >>> A very theoretical question: why do we have 'struct vcpu' embedded in >>> vcpu_vmx/vcpu_svm and not the other way around (e.g. in a union)? That >>> would've allowed us to allocate memory in common code

Re: [PATCH] KVM: X86: Make fpu allocation a common function

2019-10-15 Thread Sean Christopherson
On Tue, Oct 15, 2019 at 04:36:57PM +0200, Vitaly Kuznetsov wrote: > Paolo Bonzini writes: > > > On 15/10/19 12:53, Vitaly Kuznetsov wrote: > >> A very theoretical question: why do we have 'struct vcpu' embedded in > >> vcpu_vmx/vcpu_svm and not the other way around (e.g. in a union)? That > >>

Re: [PATCH] KVM: X86: Make fpu allocation a common function

2019-10-15 Thread Vitaly Kuznetsov
Paolo Bonzini writes: > On 15/10/19 12:53, Vitaly Kuznetsov wrote: >> A very theoretical question: why do we have 'struct vcpu' embedded in >> vcpu_vmx/vcpu_svm and not the other way around (e.g. in a union)? That >> would've allowed us to allocate memory in common code and then fill in >>

Re: [PATCH] KVM: X86: Make fpu allocation a common function

2019-10-15 Thread Paolo Bonzini
On 15/10/19 12:53, Vitaly Kuznetsov wrote: > A very theoretical question: why do we have 'struct vcpu' embedded in > vcpu_vmx/vcpu_svm and not the other way around (e.g. in a union)? That > would've allowed us to allocate memory in common code and then fill in > vendor-specific details in

Re: [PATCH] KVM: X86: Make fpu allocation a common function

2019-10-15 Thread Vitaly Kuznetsov
Sean Christopherson writes: > On Mon, Oct 14, 2019 at 06:58:49PM +0200, Vitaly Kuznetsov wrote: >> Xiaoyao Li 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

Re: [PATCH] KVM: X86: Make fpu allocation a common function

2019-10-15 Thread Paolo Bonzini
On 14/10/19 18:58, Vitaly Kuznetsov wrote: > Xiaoyao Li 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 >

Re: [PATCH] KVM: X86: Make fpu allocation a common function

2019-10-14 Thread Xiaoyao Li
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 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

Re: [PATCH] KVM: X86: Make fpu allocation a common function

2019-10-14 Thread Sean Christopherson
On Mon, Oct 14, 2019 at 06:58:49PM +0200, Vitaly Kuznetsov wrote: > Xiaoyao Li 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

Re: [PATCH] KVM: X86: Make fpu allocation a common function

2019-10-14 Thread Vitaly Kuznetsov
Xiaoyao Li 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? > > Signed-off-by:

[PATCH] KVM: X86: Make fpu allocation a common function

2019-10-14 Thread Xiaoyao Li
They are duplicated codes to create vcpu.arch.{user,guest}_fpu in VMX and SVM. Make them common functions. No functional change intended. Signed-off-by: Xiaoyao Li --- arch/x86/kvm/svm.c | 20 +++- arch/x86/kvm/vmx/vmx.c | 20 +++- arch/x86/kvm/x86.h |