Received: from eggs.gnu.org ([2001:4830:134:3::10]:54281) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bP8P9-00070m-Pk for qemu-devel@nongnu.org; Mon, 18 Jul 2016 09:16:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bP8P3-0003iP-UA for qemu-devel@nongnu.org; Mon, 18 Jul 2016 09:16:15 -0400 References: <1468570225-14101-1-git-send-email-thuth@redhat.com> <20160718005236.GD16769@voom.fritz.box> <20160718105944.3908f7ca@bahia.lan> <9c8dae5e-d2bd-fa21-f12e-31fd21ca97bc@redhat.com> <20160718112650.4f831dd3@bahia.lan> <928de718-79e1-9c8a-a05d-ed51e1e31a05@redhat.com> <20160718124409.62e06fb2@bahia.lan> From: Thomas Huth Message-ID: <36d0178c-7012-dbef-7129-8a2cd27c0974@redhat.com> Date: Mon, 18 Jul 2016 15:16:01 +0200 MIME-Version: 1.0 In-Reply-To: <20160718124409.62e06fb2@bahia.lan> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="LVrPUHdfSo6jUXAQOUoTsDdPud6o1gxsK" Subject: [Qemu-devel] assert in memory.c line 1934 (was: 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: David Gibson , qemu-ppc@nongnu.org, qemu-devel@nongnu.org, Xiao Guangrong , Paolo Bonzini This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --LVrPUHdfSo6jUXAQOUoTsDdPud6o1gxsK Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 18.07.2016 12:44, Greg Kurz wrote: > On Mon, 18 Jul 2016 11:33:16 +0200 > Thomas Huth wrote: >=20 >> On 18.07.2016 11:26, Greg Kurz wrote: >>> On Mon, 18 Jul 2016 11:04:39 +0200 >>> Thomas Huth wrote: >>> =20 >>>> On 18.07.2016 10:59, Greg Kurz wrote: =20 >>>>> 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 avai= lable >>>>>>> for main RAM") already made sure that huge page support is not an= nounced >>>>>>> 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 c= an go >>>>>>> wrong: NUMA is enabled, but the RAM of the NUMA nodes are not con= figured >>>>>>> with huge page support (and only the memory of a DIMM is configur= ed with >>>>>>> it). When QEMU is started with the following command line for exa= mple, >>>>>>> the Linux guest currently crashes because it is trying to use hug= e pages >>>>>>> on a memory region that does not support huge pages: >>>>>>> >>>>>>> qemu-system-ppc64 -enable-kvm ... -m 1G,slots=3D4,maxmem=3D32G -= object \ >>>>>>> memory-backend-file,policy=3Ddefault,mem-path=3D/hugepages,siz= e=3D1G,id=3Dmem-mem1 \ >>>>>>> -device pc-dimm,id=3Ddimm-mem1,memdev=3Dmem-mem1 -smp 2 \ >>>>>>> -numa node,nodeid=3D0 -numa node,nodeid=3D1 >>>>>>> >>>>>>> To fix this issue, we've got to make sure to disable huge page su= pport, >>>>>>> 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 >>>>>>> --- >>>>>>> target-ppc/kvm.c | 10 +++++++--- >>>>>>> 1 file changed, 7 insertions(+), 3 deletions(-) =20 >>>>>> >>>>>> Applied to ppc-for-2.7, thanks. >>>>>> =20 >>>>> >>>>> It looks like my replies to this patch were ignored... no big deal = though :) =20 >>>> >>>> I'll try to come up with an additional patch that fixes the remainin= g >>>> problem that you've found... Meanwhile, did you find out why you get= >>>> that assertion that I was not able to recreate? Could you maybe post= the >>>> exact command line to trigger that assertion? >>>> =20 >>> >>> I hit the assertion when I specify pc-dimm devices on the command lin= e: >>> >>> qemu-system-ppc64 -enable-kvm ... -m 2G,slots=3D4,maxmem=3D32G \ >>> -object memory-backend-file,policy=3Ddefault,mem-path=3D/mnt/kvm_hug= epage,size=3D1G,id=3Dmem-mem1 \ >>> -device pc-dimm,id=3Ddimm-mem1,memdev=3Dmem-mem1 \ >>> -object memory-backend-file,policy=3Ddefault,mem-path=3D/mnt,size=3D= 1G,id=3Dmem-mem2 \ >>> -device pc-dimm,id=3Ddimm-mem2,memdev=3Dmem-mem2 \ >>> -smp 2 -numa node,nodeid=3D0,memdev=3Dmem-mem1 \ >>> -numa node,nodeid=3D1,memdev=3Dmem-mem2 =20 >> >> FWIW, with that command line, I still don't get an assertion but a >> normal error message: >> >> qemu-system-ppc64: -device pc-dimm,id=3Ddimm-mem1,memdev=3Dmem-mem1: c= an't >> use already busy memdev: mem-mem1 >> >> Thomas >> >=20 > I hit the assertion with this exact command line: >=20 > qemu-system-ppc64 -machine pseries,accel=3Dkvm \ > -m 1G,slots=3D4,maxmem=3D32G \ > -object memory-backend-file,policy=3Ddefault,mem-path=3D/dev/hugepages,= size=3D1G,id=3Dmem-mem1 \ > -device pc-dimm,id=3Ddimm-mem1,memdev=3Dmem-mem1 \ > -numa node,nodeid=3D0,memdev=3Dmem-mem1 \ > -S >=20 > QEMU was built against David's ppc-for-2.7 branch (commit 159d2e39a). >=20 > But I get the very same error as you with QEMU 2.6... regression ? Not sure why I didn't get the assertion before, but after switching back and forth between another and the current master branch, I now get the assertion, too: qemu-system-ppc64: /home/thuth/devel/qemu/memory.c:1934: memory_region_add_subregion_common: Assertion `!subregion->container' failed. I've bisected it to the following commit: 2aece63c8a9d2c3a8ff41d2febc4cdeff2633331 hostmem: detect host backend memory is being used properly Xiao, Paolo, do you have any idea why this assert() can be triggered now?= Thomas --LVrPUHdfSo6jUXAQOUoTsDdPud6o1gxsK Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAEBAgAGBQJXjNaVAAoJEC7Z13T+cC21Rj0QAKjNTclJyHX5y2UcAXURW5DN BzxdJQAqGiakm5LWrULtGyJnE/Xd0WqRHjtRGpqHiwH6NuOpRz0ly3F09Pad4E0d e62+HWj05yu4GzwjY1jn5wR7+/+q8TI5YjOq2VEZiQIJ4RT7s5u51ZYbXXMSO0Xl nL/obbIFwWxL3rb1SX3UNUY6jiZWXi+N+8zDtaIo3kmeQl6DEUUeesIHAAMXkJBJ sDxO2gRLyAEqoSLMcO8meIDakN0+zGHtLQJdG/8HiNSAea4Xi+qliNrGQVqGbkXr voHabo5U+bzCZPGbAoEbQ3/+xKyQEWYMMFGeTAHYRVYPQCyOqg4gObZbBNdibETm rXS6TcUGkol4+TKSDaW0f9kIojkdjeZ5TRmOjr5/78ePSvvuD1m8U/CZvIW6k8jO vfSAtviTgeW+n79CSiYVQ1wbYPLXfDnZcL+lqoVWMmli9tQ5BAtCARmdJjO0rSiZ S5hLeS5E3Wa2IXVQO/p75fMe/hhdXOcmfgrbldO3ygp4Wd93UJ3s3wvE/uKPdCY0 LgzYeqPpDSSpThbB2W342RRVitGbzg7wJH2alL0c+PAWEiNBsl9BoS9fvKNu5+nf eZDC65N3wTcidt3LfOchjE43w2ucerfFJHkxTxivAsB71RlUdnQrbL69jyjsA8dH 8e31Qa4MzI9oEoSs0shT =TMys -----END PGP SIGNATURE----- --LVrPUHdfSo6jUXAQOUoTsDdPud6o1gxsK--