From: Sean Christopherson <sean.j.christopherson@intel.com>
To: Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Xiaoyao Li <xiaoyao.li@intel.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
Jim Mattson <jmattson@google.com>
Subject: Re: [PATCH] KVM: X86: Make fpu allocation a common function
Date: Tue, 15 Oct 2019 09:14:28 -0700 [thread overview]
Message-ID: <20191015161427.GC15015@linux.intel.com> (raw)
In-Reply-To: <87lftm3wja.fsf@vitty.brq.redhat.com>
On Tue, Oct 15, 2019 at 04:36:57PM +0200, Vitaly Kuznetsov wrote:
> Paolo Bonzini <pbonzini@redhat.com> 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
> >> vendor-specific details in .create_vcpu().
A union would waste a non-trivial amount of memory on SVM.
SVM: struct size = 14560
VMX: struct size = 16192
There are ways around that, but...
> >
> > Probably "because it's always been like that" is the most accurate answer.
> >
>
> OK, so let me make my question a bit less theoretical: would you be in
> favor of changing the status quo? :-)
... we don't need to invert the strut embedding to re-order the create
flow. 'struct kvm_vcpu' must be at offset zero and the size of the vcpu
is vendor defined, so kvm_arch_vcpu_create() can allocate the struct and
directly cast it to a 'struct kvm_vcpu *'.
next prev parent reply other threads:[~2019-10-15 16:14 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
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 [this message]
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=20191015161427.GC15015@linux.intel.com \
--to=sean.j.christopherson@intel.com \
--cc=jmattson@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=vkuznets@redhat.com \
--cc=xiaoyao.li@intel.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;
as well as URLs for NNTP newsgroup(s).