From: Paul Mackerras <paulus@samba.org>
To: Alexander Graf <agraf@suse.de>
Cc: kvm-ppc <kvm-ppc@vger.kernel.org>,
DValeev@suse.com, "kvm@vger.kernel.org" <kvm@vger.kernel.org>,
David Gibson <david@gibson.dropbear.id.au>
Subject: Re: HV KVM fails on 970 due to HTAB allocation
Date: Fri, 13 Jan 2012 16:11:13 +1100 [thread overview]
Message-ID: <20120113051113.GA15875@drongo> (raw)
In-Reply-To: <4F0F2393.6010102@suse.de>
On Thu, Jan 12, 2012 at 07:16:51PM +0100, Alexander Graf wrote:
> While trying to run HV KVM for something useful on 970, we stumbled
> over the following code path:
>
> /* Allocate guest's hashed page table */
> hpt =
> __get_free_pages(GFP_KERNEL|__GFP_ZERO|__GFP_REPEAT|__GFP_NOWARN,
> HPT_ORDER - PAGE_SHIFT);
> if (!hpt) {
> pr_err("kvm_alloc_hpt: Couldn't alloc HPT\n");
> return -ENOMEM;
> }
> kvm->arch.hpt_virt = hpt;
>
> We're most of the time running into the !hpt case, because we simply
> don't have 16MB of contiguous memory lying around.
>
> I was trying to check if we could maybe allocate a huge_tlb page
> from within kernel space, since that usually matches the 16MB pretty
> well. However that seems to be very tricky. Maybe something similar
> to the RMA thing would be a good idea?
In discussing this with David Gibson in the past, one idea we have had
is to have userspace allocate the HPT using hugetlbfs and supply it to
KVM via an ioctl. If userspace doesn't call that ioctl then we try to
do a high-order allocation, as at present, when they do the first
VCPU_RUN ioctl.
The other thing the code could do is to fall back to lower-order
allocations. The HPT doesn't have to be 16MB in size; any power of 2
that is at least 256kB will do (there is an upper limit, but it is
enormous). Smaller sizes will potentially reduce performance, of
course (and the size of the VRMA on POWER7, but on 970 we have to use
an RMO region, which isn't affected by the HPT size).
Paul.
next prev parent reply other threads:[~2012-01-13 5:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-12 18:16 HV KVM fails on 970 due to HTAB allocation Alexander Graf
2012-01-13 5:11 ` Paul Mackerras [this message]
2012-01-13 12:36 ` Alexander Graf
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=20120113051113.GA15875@drongo \
--to=paulus@samba.org \
--cc=DValeev@suse.com \
--cc=agraf@suse.de \
--cc=david@gibson.dropbear.id.au \
--cc=kvm-ppc@vger.kernel.org \
--cc=kvm@vger.kernel.org \
/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