From: David Gibson <david@gibson.dropbear.id.au>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Avi Kivity <avi@redhat.com>, Jan Kiszka <jan.kiszka@web.de>,
qemu-devel@nongnu.org, kvm <kvm@vger.kernel.org>,
agraf@suse.de
Subject: Re: [Qemu-devel] [PATCH] Permit -mem-path without sync mmu
Date: Mon, 8 Aug 2011 16:03:28 +1000 [thread overview]
Message-ID: <20110808060328.GB20120@yookeroo.fritz.box> (raw)
In-Reply-To: <20110805153053.GA15083@amt.cnet>
On Fri, Aug 05, 2011 at 12:30:53PM -0300, Marcelo Tosatti wrote:
> On Fri, Aug 05, 2011 at 08:16:42AM +0200, Jan Kiszka wrote:
> > On 2011-08-05 06:02, David Gibson wrote:
> > > At present, an explicit test disallows use of -mem-path when kvm is enabled
> > > but KVM_CAP_SYNC_MMU is not set. In particular, this prevents the user
> > > from using hugetlbfs to back the guest memory.
> > >
> > > I can see no reason for this check, and when I asked about it previously,
> > > the only theory offered was that this was a limitation of the very early
> > > days of kvm which only happened to match the SYNC_MMU flag by accident.
> > >
> > > This patch, therefore, removes the check. This is of particular use to
> > > us on POWER, where we haven't yet implement SYNC_MMU, but where backing
> > > the guest with hugepages is possible, and in fact mandatory (for now).
> > >
> > > Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
> > > ---
> > > exec.c | 5 -----
> > > 1 files changed, 0 insertions(+), 5 deletions(-)
> > >
> > > diff --git a/exec.c b/exec.c
> > > index 476b507..041637c 100644
> > > --- a/exec.c
> > > +++ b/exec.c
> > > @@ -2818,11 +2818,6 @@ static void *file_ram_alloc(RAMBlock *block,
> > > return NULL;
> > > }
> > >
> > > - if (kvm_enabled() && !kvm_has_sync_mmu()) {
> > > - fprintf(stderr, "host lacks kvm mmu notifiers, -mem-path unsupported\n");
> > > - return NULL;
> > > - }
> > > -
> > > if (asprintf(&filename, "%s/qemu_back_mem.XXXXXX", path) == -1) {
> > > return NULL;
> > > }
> >
> > This is nothing trivial, see ce9a92411d in qemu-kvm or
> > http://thread.gmane.org/gmane.comp.emulators.kvm.devel/27380. And it
> > should rather target uq/master. CCing Avi, Marcelo, and the kvm list.
> >
> > Jan
Well, sending the patch flushed out the real reason for that check, at
least, as I thought it might.
> Yes, the check cannot be removed because there is the possibility of
> corruption using hugepages without mmu notifiers (described in the
> archived message above).
Ok, so. If I understand the archived message correctly. First, this
check *is* all about hugepages - which is not obvious from the test
itself.
Second, if userspace qemu passing hugepages to kvm can cause (host)
kernel memory corruption, that is clearly a host kernel bug. So am I
correct in thinking this is basically just a safety feature if qemu is
run on a buggy kernel. Presumably this bug was corrected at some
point? Is the presence of the SYNC_MMU feature just being used as a
proxy for "is this kernel recent enough to have the corruption bug
fixed"?
In any case this test sure as hell needs a big comment next to it
explaining this context.
> Why are mmu notifiers not implemented for PPC again?
It's just not done yet; we're working on it. (That is, mmu notifiers
are certainly present on PPC, it's just they're not wired up to kvm,
yet).
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
next prev parent reply other threads:[~2011-08-08 6:03 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-05 4:02 [Qemu-devel] [PATCH] Permit -mem-path without sync mmu David Gibson
2011-08-05 6:16 ` Jan Kiszka
2011-08-05 15:30 ` Marcelo Tosatti
2011-08-08 6:03 ` David Gibson [this message]
2011-08-08 8:24 ` Avi Kivity
2011-08-10 5:10 ` David Gibson
2011-08-10 9:01 ` Avi Kivity
2011-08-11 6:09 ` David Gibson
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=20110808060328.GB20120@yookeroo.fritz.box \
--to=david@gibson.dropbear.id.au \
--cc=agraf@suse.de \
--cc=avi@redhat.com \
--cc=jan.kiszka@web.de \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=qemu-devel@nongnu.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;
as well as URLs for NNTP newsgroup(s).