From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38175) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bP51m-0002c3-T3 for qemu-devel@nongnu.org; Mon, 18 Jul 2016 05:39:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bP51k-0000W1-Oc for qemu-devel@nongnu.org; Mon, 18 Jul 2016 05:39:53 -0400 Date: Mon, 18 Jul 2016 19:21:08 +1000 From: David Gibson Message-ID: <20160718092108.GN16769@voom.fritz.box> References: <1468570225-14101-1-git-send-email-thuth@redhat.com> <20160718005236.GD16769@voom.fritz.box> <20160718105944.3908f7ca@bahia.lan> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="uMPAU7A2Er6+wvsD" Content-Disposition: inline In-Reply-To: <20160718105944.3908f7ca@bahia.lan> 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: Greg Kurz Cc: Thomas Huth , qemu-ppc@nongnu.org, qemu-devel@nongnu.org --uMPAU7A2Er6+wvsD Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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: > > > Commit 86b50f2e1bef ("Disable huge page support if it is not available > > > for main RAM") already made sure that huge page support is not announ= ced > > > to the guest if the normal RAM of non-NUMA configurations is not back= ed > > > 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 configu= red > > > with huge page support (and only the memory of a DIMM is configured w= ith > > > it). When QEMU is started with the following command line for example, > > > the Linux guest currently crashes because it is trying to use huge pa= ges > > > on a memory region that does not support huge pages: > > >=20 > > > qemu-system-ppc64 -enable-kvm ... -m 1G,slots=3D4,maxmem=3D32G -obje= ct \ > > > memory-backend-file,policy=3Ddefault,mem-path=3D/hugepages,size=3D= 1G,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 suppor= t, > > > 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 >=20 > 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. >=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 "normal" > > > + * RAM. And since normal RAM has not been configured with "-mem-= path" > > > + * (what we've checked earlier here already), we can not use hug= e pages! > > > + */ > > > + if (nb_numa_nodes =3D=3D 0 || numa_info[0].node_memdev =3D=3D NU= LL) { > > > static bool warned; > > > if (!warned) { > > > error_report("Huge page support disabled (n/a for main m= emory)."); =20 > >=20 >=20 --=20 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 --uMPAU7A2Er6+wvsD Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJXjJ+EAAoJEGw4ysog2bOS3D0QAObBTYGrWxOtGEcwqc7hzHED R+MSCwsmYHZQYwu99Lt/wyi8Tfb5DwGGHUdlT32gJPNq5q0gjQb/+N/vrKFpNkBf G9OjyDY3PuooyL3wvMj8r7qNE5J3QeI2HRqm31J91ySYlNLwjhgzJky1yo1GWuc7 J10etsjpiCtDBPYdtzldQOf6RqToBUGJ/zJMEEHR4T+4P4MgWcyjXzdJLK/FvIUW jG3+K5VZiDbGA0xqGPxBdqYJ+uCvje4AAaiB1IH1myHpGUc+rVszObSBhgtaHR9c HhGvCbAeOZ+VzBIbdOWshZLaQ7s5k9kC6v2AJCfEfkY1o/mvbvXU6qws9hS7k3qi Cbot61Y0mMRWN+J5fPLr8dmHrqVPh3D3PpQD/j1enF1gcc+dV6iNTliO8aYaGrBk WtVEPmuCM+7sfjorEWli1bbNp1+f3AgXd3oY76Sz4ZlUSaYe/yjZPApMENWjQOob uUxEHzBzvYeYrWI518KD6gW+LbaQRIDOpTwYFqOvAXE00j+wVNsXl/2MgIaknoNU f+xaMEefIFNRmr+3nos10J7qy2g8I1rhN05Je4zk+AdLFxPfgaqZYMFY8ByFPRRZ S5WRfsz/fTr/gvIRrYB+po0iUShet7B+pNsKmd3dsmbk21rUh06xxJeCaIQ1AdBd Lo41SipcRnERZmwUqEH+ =nF7m -----END PGP SIGNATURE----- --uMPAU7A2Er6+wvsD--