From: Xiaoyao Li <xiaoyao.li@intel.com>
To: Sean Christopherson <sean.j.christopherson@intel.com>,
Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Radim Krčmář" <rkrcmar@redhat.com>,
"Jim Mattson" <jmattson@google.com>
Subject: Re: [PATCH] KVM: X86: Make fpu allocation a common function
Date: Tue, 15 Oct 2019 08:48:02 +0800 [thread overview]
Message-ID: <5a7aebc9-2d4d-e202-5f89-8f5f2bc462db@intel.com> (raw)
In-Reply-To: <20191014183723.GE22962@linux.intel.com>
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@intel.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.
next prev parent reply other threads:[~2019-10-15 0:48 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-14 16:22 [PATCH] KVM: X86: Make fpu allocation a common function Xiaoyao Li
2019-10-14 16:58 ` Vitaly Kuznetsov
2019-10-14 18:37 ` Sean Christopherson
2019-10-15 0:48 ` Xiaoyao Li [this message]
2019-10-15 10:53 ` Vitaly Kuznetsov
2019-10-15 14:27 ` Paolo Bonzini
2019-10-15 14:36 ` Vitaly Kuznetsov
2019-10-15 16:14 ` Sean Christopherson
2019-10-15 16:36 ` Paolo Bonzini
2019-10-15 9:28 ` Paolo Bonzini
2019-10-16 1:52 ` Xiaoyao Li
2019-10-16 7:35 ` Paolo Bonzini
2019-10-16 7:48 ` Xiaoyao Li
2019-10-16 9:41 ` Paolo Bonzini
2019-10-17 16:05 ` Sean Christopherson
2019-10-21 13:09 ` Paolo Bonzini
2019-10-22 0:57 ` Xiaoyao Li
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5a7aebc9-2d4d-e202-5f89-8f5f2bc462db@intel.com \
--to=xiaoyao.li@intel.com \
--cc=jmattson@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=rkrcmar@redhat.com \
--cc=sean.j.christopherson@intel.com \
--cc=vkuznets@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox