From: Sean Christopherson <sean.j.christopherson@intel.com>
To: Marc Orr <marcorr@google.com>
Cc: kvm@vger.kernel.org, Jim Mattson <jmattson@google.com>,
David Rientjes <rientjes@google.com>,
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
linux-mm@kvack.org, akpm@linux-foundation.org
Subject: Re: [kvm PATCH 2/2] kvm: vmx: use vmalloc() to allocate vcpus
Date: Wed, 24 Oct 2018 15:31:35 -0700 [thread overview]
Message-ID: <20181024223135.GA23176@linux.intel.com> (raw)
In-Reply-To: <CAA03e5HWA4Vca=_J=VuQ__bLAdO8ohUU4r-hmxY1EbnVzsQHww@mail.gmail.com>
On Tue, Oct 23, 2018 at 05:13:40PM -0400, Marc Orr wrote:
> Adding everyone that's cc'd on [kvm PATCH 1/2] mm: export
> __vmalloc_node_range().
> Thanks,
> Marc
> On Sat, Oct 20, 2018 at 5:13 PM Marc Orr <marcorr@google.com> wrote:
> >
> > Previously, vcpus were allocated through the kmem_cache_zalloc() API,
> > which requires the underlying physical memory to be contiguous.
> > Because the x86 vcpu struct, struct vcpu_vmx, is relatively large
> > (e.g., currently 47680 bytes on my setup), it can become hard to find
> > contiguous memory.
> >
> > At the same time, the comments in the code indicate that the primary
> > reason for using the kmem_cache_zalloc() API is to align the memory
> > rather than to provide physical contiguity.
> >
> > Thus, this patch updates the vcpu allocation logic for vmx to use the
> > vmalloc() API.
> >
> > Signed-off-by: Marc Orr <marcorr@google.com>
> > ---
> > arch/x86/kvm/vmx.c | 98 +++++++++++++++++++++++++++++++++++++++++----
> > virt/kvm/kvm_main.c | 28 +++++++------
> > 2 files changed, 106 insertions(+), 20 deletions(-)
> >
> > diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> > index abeeb45d1c33..d480a2cc0667 100644
> > --- a/arch/x86/kvm/vmx.c
> > +++ b/arch/x86/kvm/vmx.c
> > @@ -898,7 +898,14 @@ struct nested_vmx {
> > #define POSTED_INTR_ON 0
> > #define POSTED_INTR_SN 1
> >
> > -/* Posted-Interrupt Descriptor */
> > +/*
> > + * Posted-Interrupt Descriptor
> > + *
> > + * Note, the physical address of this structure is used by VMX. Furthermore, the
> > + * translation code assumes that the entire pi_desc struct resides within a
> > + * single page, which will be true because the struct is 64 bytes and 64-byte
> > + * aligned.
> > + */
> > struct pi_desc {
> > u32 pir[8]; /* Posted interrupt requested */
> > union {
> > @@ -970,8 +977,25 @@ static inline int pi_test_sn(struct pi_desc *pi_desc)
> >
> > struct vmx_msrs {
> > unsigned int nr;
> > - struct vmx_msr_entry val[NR_AUTOLOAD_MSRS];
> > + struct vmx_msr_entry *val;
> > };
> > +struct kmem_cache *vmx_msr_entry_cache;
The vmx_msr_entry changes should be done as a separate prereq patch,
e.g. for bisecting and/or revert in case there is a bug. AFAICT they
don't depend on moving to vmalloc.
prev parent reply other threads:[~2018-10-24 22:31 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20181020211200.255171-1-marcorr@google.com>
[not found] ` <20181020211200.255171-2-marcorr@google.com>
2018-10-22 20:06 ` [kvm PATCH 1/2] mm: export __vmalloc_node_range() Konrad Rzeszutek Wilk
2018-10-23 12:33 ` Michal Hocko
2018-10-23 21:10 ` Marc Orr
2018-10-24 6:16 ` Michal Hocko
2018-10-24 8:12 ` Marc Orr
2018-10-24 8:22 ` Michal Hocko
2018-10-23 21:13 ` [kvm PATCH 0/2] kvm: vmalloc vmx vcpus Marc Orr
[not found] ` <20181020211200.255171-3-marcorr@google.com>
2018-10-23 21:13 ` [kvm PATCH 2/2] kvm: vmx: use vmalloc() to allocate vcpus Marc Orr
2018-10-24 11:41 ` Matthew Wilcox
2018-10-24 18:05 ` Marc Orr
2018-10-25 12:58 ` Michal Hocko
2018-10-24 22:31 ` Sean Christopherson [this message]
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=20181024223135.GA23176@linux.intel.com \
--to=sean.j.christopherson@intel.com \
--cc=akpm@linux-foundation.org \
--cc=jmattson@google.com \
--cc=konrad.wilk@oracle.com \
--cc=kvm@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=marcorr@google.com \
--cc=rientjes@google.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).