qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Greg Kurz <groug@kaod.org>
Cc: Thomas Huth <thuth@redhat.com>,
	qemu-ppc@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH] ppc: Yet another fix for the huge page support detection mechanism
Date: Mon, 18 Jul 2016 19:21:08 +1000	[thread overview]
Message-ID: <20160718092108.GN16769@voom.fritz.box> (raw)
In-Reply-To: <20160718105944.3908f7ca@bahia.lan>

[-- Attachment #1: Type: text/plain, Size: 3350 bytes --]

On Mon, Jul 18, 2016 at 10:59:44AM +0200, Greg Kurz wrote:
> On Mon, 18 Jul 2016 10:52:36 +1000
> David Gibson <david@gibson.dropbear.id.au> wrote:
> 
> > On Fri, Jul 15, 2016 at 10:10:25AM +0200, Thomas Huth wrote:
> > > Commit 86b50f2e1bef ("Disable huge page support if it is not available
> > > for main RAM") already made sure that huge page support is not announced
> > > to the guest if the normal RAM of non-NUMA configurations is not backed
> > > by a huge page filesystem. However, there is one more case that can go
> > > wrong: NUMA is enabled, but the RAM of the NUMA nodes are not configured
> > > with huge page support (and only the memory of a DIMM is configured with
> > > it). When QEMU is started with the following command line for example,
> > > the Linux guest currently crashes because it is trying to use huge pages
> > > on a memory region that does not support huge pages:
> > > 
> > >  qemu-system-ppc64 -enable-kvm ... -m 1G,slots=4,maxmem=32G -object \
> > >    memory-backend-file,policy=default,mem-path=/hugepages,size=1G,id=mem-mem1 \
> > >    -device pc-dimm,id=dimm-mem1,memdev=mem-mem1 -smp 2 \
> > >    -numa node,nodeid=0 -numa node,nodeid=1
> > > 
> > > To fix this issue, we've got to make sure to disable huge page support,
> > > too, when there is a NUMA node that is not using a memory backend with
> > > huge page support.
> > > 
> > > Fixes: 86b50f2e1befc33407bdfeb6f45f7b0d2439a740
> > > Signed-off-by: Thomas Huth <thuth@redhat.com>
> > > ---
> > >  target-ppc/kvm.c | 10 +++++++---
> > >  1 file changed, 7 insertions(+), 3 deletions(-)  
> > 
> > Applied to ppc-for-2.7, thanks.
> > 
> 
> It looks like my replies to this patch were ignored... no big deal
> though :)

I saw them.  IIUC, though, this patch still improves the situation,
even if it doesn't get every case right, so I was inclined to include
it earlier rather than later.

> 
> > > 
> > > diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
> > > index 884d564..7a8f555 100644
> > > --- a/target-ppc/kvm.c
> > > +++ b/target-ppc/kvm.c
> > > @@ -389,12 +389,16 @@ static long getrampagesize(void)
> > >  
> > >      object_child_foreach(memdev_root, find_max_supported_pagesize, &hpsize);
> > >  
> > > -    if (hpsize == LONG_MAX) {
> > > +    if (hpsize == LONG_MAX || hpsize == getpagesize()) {
> > >          return getpagesize();
> > >      }
> > >  
> > > -    if (nb_numa_nodes == 0 && hpsize > getpagesize()) {
> > > -        /* No NUMA nodes and normal RAM without -mem-path ==> no huge pages! */
> > > +    /* If NUMA is disabled or the NUMA nodes are not backed with a
> > > +     * memory-backend, then there is at least one node using "normal"
> > > +     * RAM. And since normal RAM has not been configured with "-mem-path"
> > > +     * (what we've checked earlier here already), we can not use huge pages!
> > > +     */
> > > +    if (nb_numa_nodes == 0 || numa_info[0].node_memdev == NULL) {
> > >          static bool warned;
> > >          if (!warned) {
> > >              error_report("Huge page support disabled (n/a for main memory).");  
> > 
> 



-- 
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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  parent reply	other threads:[~2016-07-18  9:39 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-15  8:10 [Qemu-devel] [PATCH] ppc: Yet another fix for the huge page support detection mechanism Thomas Huth
2016-07-15  8:35 ` David Gibson
2016-07-15 12:28   ` Thomas Huth
2016-07-15 15:18     ` Greg Kurz
2016-07-15 15:54       ` Thomas Huth
2016-07-15 16:31         ` Greg Kurz
2016-07-15  9:28 ` Greg Kurz
2016-07-18  9:21   ` Thomas Huth
2016-07-18  9:36     ` Greg Kurz
2016-07-18  0:52 ` David Gibson
2016-07-18  8:59   ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
2016-07-18  9:04     ` Thomas Huth
2016-07-18  9:26       ` Greg Kurz
2016-07-18  9:33         ` Thomas Huth
2016-07-18 10:44           ` Greg Kurz
2016-07-18 13:16             ` [Qemu-devel] assert in memory.c line 1934 (was: Yet another fix for the huge page support detection mechanism) Thomas Huth
2016-07-18 13:23             ` [Qemu-devel] [Qemu-ppc] [PATCH] ppc: Yet another fix for the huge page support detection mechanism Greg Kurz
2016-07-18  9:21     ` David Gibson [this message]
2016-07-18 10:01       ` Greg Kurz

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=20160718092108.GN16769@voom.fritz.box \
    --to=david@gibson.dropbear.id.au \
    --cc=groug@kaod.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=thuth@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;
as well as URLs for NNTP newsgroup(s).