From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33740) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZwJ7G-000365-94 for qemu-devel@nongnu.org; Tue, 10 Nov 2015 19:18:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZwJ7F-0001Gb-8i for qemu-devel@nongnu.org; Tue, 10 Nov 2015 19:18:22 -0500 Date: Wed, 11 Nov 2015 11:07:52 +1100 From: David Gibson Message-ID: <20151111000752.GJ18558@voom.redhat.com> References: <1447133094-32676-1-git-send-email-bharata@linux.vnet.ibm.com> <1447133094-32676-3-git-send-email-bharata@linux.vnet.ibm.com> <20151110143857.25378.51227@loki> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="MzdA25v054BPvyZa" Content-Disposition: inline In-Reply-To: <20151110143857.25378.51227@loki> Subject: Re: [Qemu-devel] [PATCH v1 2/2] spapr: Handle failure of KVM_PPC_ALLOCATE_HTAB ioctl List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Michael Roth Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, Bharata B Rao --MzdA25v054BPvyZa Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Nov 10, 2015 at 08:38:57AM -0600, Michael Roth wrote: > Quoting Bharata B Rao (2015-11-09 23:24:54) > > KVM_PPC_ALLOCATE_HTAB ioctl can return -ENOMEM for KVM guests and QEMU > > never handled this correctly. But this didn't cause any problems till > > now as KVM_PPC_ALLOCATE_HTAB ioctl returned with smaller than requested > > HTAB when enough contiguous memory wasn't available in the host. > > After the proposed kernel change: https://patchwork.ozlabs.org/patch/53= 0501/, > > KVM_PPC_ALLOCATE_HTAB ioctl will not fallback to lower sized HTAB > > allocation and will fail if requested HTAB size can't be met. > >=20 > > Check for such failures in QEMU and abort appropriately. This will > > prevent guest kernel from hanging/freezing during early boot by doing > > graceful exit when host is unable to allocate requested HTAB. > >=20 > > Signed-off-by: Bharata B Rao > > --- > > hw/ppc/spapr.c | 20 ++++++++++++++++---- > > 1 file changed, 16 insertions(+), 4 deletions(-) > >=20 > > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c > > index e1202ce..a64a1b5 100644 > > --- a/hw/ppc/spapr.c > > +++ b/hw/ppc/spapr.c > > @@ -1021,9 +1021,19 @@ static void spapr_alloc_htab(sPAPRMachineState *= spapr) > > * RAM */ > >=20 > > shift =3D kvmppc_reset_htab(spapr->htab_shift); > > - > > - if (shift > 0) { > > - /* Kernel handles htab, we don't need to allocate one */ > > + if (shift < 0) { > > + /* > > + * For HV KVM, host kernel will return -ENOMEM when requested > > + * HTAB size can't be allocated. > > + */ > > + error_setg(&error_abort, "Failed to allocate HTAB of requested= size, try with smaller maxmem"); >=20 > Wording is appropriate, but maybe just "Failed to allocate HTAB, try with > smaller maxmem" to distinguish it from the error below where the call suc= ceeds > but there's a size mismatch? Possibly the message could be a little better, but I'm not going to hold up the patches just for that. I've applied tentatively to spapr-next, and I hope to send a pull req with it soon, assuming it survives my tests. --=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 --MzdA25v054BPvyZa Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJWQobYAAoJEGw4ysog2bOS+PoQAJODql9Yq/HZ0Zjw52FUktPY 1vjENum82ARaNkvb9QRV35Iw1Otn0erToXslBrzWv5IUgg3awYxAiw3i3n2ICbsl SZYhKooSYJaqLO10WxmNdQ+yyRYdjVhB48PuHeENNm3KxxCWIAF4HCuIDxBot7Ps t9Lk5gsGa4U144ELisrCdPNqo19ncolTjWahz+gyc8ke4z5rDopW7MTXdWbTRDWp 5SGVxtd6ZQyM2ujmS8T/9xUEFhLzcyHG3+gkVYGr+ZLgnLEzRuJBOAQfsAMDVhoZ bqLbJITGsKvOmRf8IBS0iDNYSQURG38TTIaUejipdzqGo+dZWJ7fpG8V8xTFGw9Y YmI3JFm5XvqzlYelpVo5wbPpR04iTP9ojBJha4ZEZbBtRHPrMHj1GOnkw5x5TM0g 1SuLv6i8jFUYTISYPXc6ImgKgS+5aM4Ha8+Vn+zveh/vyibamu+I14N4Q982JfST 3bdL7u1hxhHejf0DPIeuKjPpmXo7g8t1M06lOkla9dM/NX3CZozzKhV+IGSNlnAJ 7TS7mC0MyjF5eqYqEDC6L8xiCB2n++AYo11vrz1zk+RooemRY4mG7+32y4Jn8fWl FLTnUJk173whzLzIQ7G8RS+GN1WFxieV0I4QSIEFjZ2vcG793h2PRvEvN6l6CBAD 7tPxPfcgFwRQs2SnLUjo =1hjl -----END PGP SIGNATURE----- --MzdA25v054BPvyZa--