Received: from eggs.gnu.org ([2001:4830:134:3::10]:41914) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bP5Mv-0003WB-Fu for qemu-devel@nongnu.org; Mon, 18 Jul 2016 06:01:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bP5Ms-0004es-B2 for qemu-devel@nongnu.org; Mon, 18 Jul 2016 06:01:45 -0400 Received: from 8.mo178.mail-out.ovh.net ([46.105.74.227]:34526) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bP5Mr-0004ef-Vp for qemu-devel@nongnu.org; Mon, 18 Jul 2016 06:01:42 -0400 Received: from player169.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo178.mail-out.ovh.net (Postfix) with ESMTP id D46A1101062E for ; Mon, 18 Jul 2016 12:01:40 +0200 (CEST) Date: Mon, 18 Jul 2016 12:01:34 +0200 From: Greg Kurz Message-ID: <20160718120134.2c3af212@bahia.lan> In-Reply-To: <20160718092108.GN16769@voom.fritz.box> References: <1468570225-14101-1-git-send-email-thuth@redhat.com> <20160718005236.GD16769@voom.fritz.box> <20160718105944.3908f7ca@bahia.lan> <20160718092108.GN16769@voom.fritz.box> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; boundary="Sig_/l10NitxTCm7RRDe2J5uMqR+"; protocol="application/pgp-signature" Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH] ppc: Yet another fix for the huge page support detection mechanism List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: David Gibson Cc: Thomas Huth , qemu-ppc@nongnu.org, qemu-devel@nongnu.org --Sig_/l10NitxTCm7RRDe2J5uMqR+ Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Mon, 18 Jul 2016 19:21:08 +1000 David Gibson wrote: > On Mon, Jul 18, 2016 at 10:59:44AM +0200, Greg Kurz wrote: > > On Mon, 18 Jul 2016 10:52:36 +1000 > > David Gibson wrote: > > =20 > > > On Fri, Jul 15, 2016 at 10:10:25AM +0200, Thomas Huth wrote: =20 > > > > Commit 86b50f2e1bef ("Disable huge page support if it is not availa= ble > > > > for main RAM") already made sure that huge page support is not anno= unced > > > > to the guest if the normal RAM of non-NUMA configurations is not ba= cked > > > > 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 confi= gured > > > > 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 examp= le, > > > > the Linux guest currently crashes because it is trying to use huge = pages > > > > on a memory region that does not support huge pages: > > > >=20 > > > > qemu-system-ppc64 -enable-kvm ... -m 1G,slots=3D4,maxmem=3D32G -ob= ject \ > > > > memory-backend-file,policy=3Ddefault,mem-path=3D/hugepages,size= =3D1G,id=3Dmem-mem1 \ > > > > -device pc-dimm,id=3Ddimm-mem1,memdev=3Dmem-mem1 -smp 2 \ > > > > -numa node,nodeid=3D0 -numa node,nodeid=3D1 > > > >=20 > > > > To fix this issue, we've got to make sure to disable huge page supp= ort, > > > > too, when there is a NUMA node that is not using a memory backend w= ith > > > > huge page support. > > > >=20 > > > > Fixes: 86b50f2e1befc33407bdfeb6f45f7b0d2439a740 > > > > Signed-off-by: Thomas Huth > > > > --- > > > > target-ppc/kvm.c | 10 +++++++--- > > > > 1 file changed, 7 insertions(+), 3 deletions(-) =20 > > >=20 > > > Applied to ppc-for-2.7, thanks. > > > =20 > >=20 > > It looks like my replies to this patch were ignored... no big deal > > though :) =20 >=20 > 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. >=20 Of course it does and I acked that ! It was more about the 'Fixes:' syntax and credits but nevermind. :) > > =20 > > > >=20 > > > > 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) > > > > =20 > > > > object_child_foreach(memdev_root, find_max_supported_pagesize,= &hpsize); > > > > =20 > > > > - if (hpsize =3D=3D LONG_MAX) { > > > > + if (hpsize =3D=3D LONG_MAX || hpsize =3D=3D getpagesize()) { > > > > return getpagesize(); > > > > } > > > > =20 > > > > - if (nb_numa_nodes =3D=3D 0 && hpsize > getpagesize()) { > > > > - /* No NUMA nodes and normal RAM without -mem-path =3D=3D> = 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 "norm= al" > > > > + * RAM. And since normal RAM has not been configured with "-me= m-path" > > > > + * (what we've checked earlier here already), we can not use h= uge pages! > > > > + */ > > > > + if (nb_numa_nodes =3D=3D 0 || numa_info[0].node_memdev =3D=3D = NULL) { > > > > static bool warned; > > > > if (!warned) { > > > > error_report("Huge page support disabled (n/a for main= memory)."); =20 > > > =20 > > =20 >=20 >=20 >=20 --Sig_/l10NitxTCm7RRDe2J5uMqR+ Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iEYEARECAAYFAleMqP4ACgkQAvw66wEB28KVxQCfVQUt+FWlxSzJGQuVbHw87DhT p74AoIKkf9GA9r2ZbDcnhGCi49xoMy1e =vNNM -----END PGP SIGNATURE----- --Sig_/l10NitxTCm7RRDe2J5uMqR+--