From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53504) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bOxSG-0002fN-TW for qemu-devel@nongnu.org; Sun, 17 Jul 2016 21:34:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bOxSB-0007Og-UO for qemu-devel@nongnu.org; Sun, 17 Jul 2016 21:34:43 -0400 Date: Mon, 18 Jul 2016 10:52:36 +1000 From: David Gibson Message-ID: <20160718005236.GD16769@voom.fritz.box> References: <1468570225-14101-1-git-send-email-thuth@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="SO98HVl1bnMOfKZd" Content-Disposition: inline In-Reply-To: <1468570225-14101-1-git-send-email-thuth@redhat.com> Subject: Re: [Qemu-devel] [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: Thomas Huth Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org --SO98HVl1bnMOfKZd Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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,i= d=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(-) Applied to ppc-for-2.7, thanks. >=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, &hpsi= ze); > =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 hug= e 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 pa= ges! > + */ > + 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 memor= y)."); --=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 --SO98HVl1bnMOfKZd Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJXjChUAAoJEGw4ysog2bOSFnMQALr4svapClzdChJZC+fGb+Hx 6NFJNhAfpmaWgULbeUdFqZOBjgMFEqAfN18z3EOWzxao0OcPq/X/nz5olXT6LW9c E4Lztzba2pYfBwBJVPaEY7zI9XjDixkn+VPI1leM9WL7SydPWd4lgqZIC5PjLnuC ZeIZgvFESJye8uwvOQ85A6ZP7ApJj+KWbuGVYcCGS+26vxjVssrD9wjV4RxhTTvE Nh3wgaOfS1pKGd06hgEQN8Ft0D7TLC1By1WRsLmAK+nZkwemzLXKUHW+g3tqEAh0 Rtb7ONAPcjhN0EgaFDN4R+oP06l94OlMuNZE1LrAiNp766Wltpo/kILzk9Lzq2zw G3nFiw1afpiQ8t4HdrncBuZYwmtB/DrNuO886J5D85xDapbWSKe1vlGPbM/VvEvL /4FC3UaaerjuPxz48/r/0j6INjy0XJV3tFx8UnMGHO+gng41DsQUdaOALfX/M23n DGe74pv+Lu4WI14E6i7xBmb62FcQBSjyZ+Cg54zkbe/UbcdYGxnhAfCRfS4T97Mi UiknvOrQ0HLkdfJLIjPCSZUmcghrhM3K1jlZrtaZcsTxtfABqoCI6rgHAhbszuYk Gt5mli7dKaRyO1a/Yd5UPNRYgBZFZ4an4WDrPcY/o5MEgLp3j8arlJOfppMDXt1M MJOl8idYIi5LkLDN7Mf8 =fau3 -----END PGP SIGNATURE----- --SO98HVl1bnMOfKZd--