Received: from eggs.gnu.org ([2001:4830:134:3::10]:59740) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bP4P6-0004Xy-Rl for qemu-devel@nongnu.org; Mon, 18 Jul 2016 04:59:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bP4P2-0001N2-OR for qemu-devel@nongnu.org; Mon, 18 Jul 2016 04:59:55 -0400 Received: from 9.mo178.mail-out.ovh.net ([46.105.75.45]:38771) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bP4P2-0001Mc-Df for qemu-devel@nongnu.org; Mon, 18 Jul 2016 04:59:52 -0400 Received: from player169.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo178.mail-out.ovh.net (Postfix) with ESMTP id 4BD9B101038C for ; Mon, 18 Jul 2016 10:59:51 +0200 (CEST) Date: Mon, 18 Jul 2016 10:59:44 +0200 From: Greg Kurz Message-ID: <20160718105944.3908f7ca@bahia.lan> In-Reply-To: <20160718005236.GD16769@voom.fritz.box> References: <1468570225-14101-1-git-send-email-thuth@redhat.com> <20160718005236.GD16769@voom.fritz.box> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; boundary="Sig_/kqME7CUYgDcNb9=vN8Z66SN"; 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_/kqME7CUYgDcNb9=vN8Z66SN Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Mon, 18 Jul 2016 10:52:36 +1000 David Gibson 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: > >=20 > > qemu-system-ppc64 -enable-kvm ... -m 1G,slots=3D4,maxmem=3D32G -object= \ > > 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 support, > > too, when there is a NUMA node that is not using a memory backend with > > 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 It looks like my replies to this patch were ignored... no big deal though :) > >=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, &hp= size); > > =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 h= uge 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-pa= th" > > + * (what we've checked earlier here already), we can not use huge = 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 mem= ory)."); =20 >=20 --Sig_/kqME7CUYgDcNb9=vN8Z66SN Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iEYEARECAAYFAleMmoAACgkQAvw66wEB28KU0QCgoBRwkMhqHvkCBB5/8lmZRSR7 u2oAoIob+vWhJVBmZA/YSfTQb6UMg3CS =1/1L -----END PGP SIGNATURE----- --Sig_/kqME7CUYgDcNb9=vN8Z66SN--