From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49845) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZteIq-0000kY-Tf for qemu-devel@nongnu.org; Tue, 03 Nov 2015 11:19:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZteIj-0005x4-VY for qemu-devel@nongnu.org; Tue, 03 Nov 2015 11:19:20 -0500 Received: from e39.co.us.ibm.com ([32.97.110.160]:56893) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZteIj-0005w6-My for qemu-devel@nongnu.org; Tue, 03 Nov 2015 11:19:13 -0500 Received: from localhost by e39.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 3 Nov 2015 09:19:12 -0700 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Michael Roth In-Reply-To: <1446545299-19446-1-git-send-email-bharata@linux.vnet.ibm.com> References: <1446545299-19446-1-git-send-email-bharata@linux.vnet.ibm.com> Message-ID: <20151103161900.11522.24549@loki> Date: Tue, 03 Nov 2015 10:19:00 -0600 Subject: Re: [Qemu-devel] [PATCH for-2.5 1/1] spapr: Handle failure of KVM_PPC_ALLOCATE_HTAB ioctl List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Bharata B Rao , qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au Quoting Bharata B Rao (2015-11-03 04:08:19) > 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/5305= 01/, > KVM_PPC_ALLOCATE_HTAB ioctl will not fallback to lower sized HTAB > allocation and will fail if requested HTAB size can't be met. > = > 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. > = > Signed-off-by: Bharata B Rao Reviewed-by: Michael Roth > --- > hw/ppc/spapr.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > = > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c > index e1202ce..ec6e141 100644 > --- a/hw/ppc/spapr.c > +++ b/hw/ppc/spapr.c > @@ -1022,7 +1022,7 @@ static void spapr_alloc_htab(sPAPRMachineState *spa= pr) > = > shift =3D kvmppc_reset_htab(spapr->htab_shift); > = > - if (shift > 0) { > + if (shift !=3D 0) { > /* Kernel handles htab, we don't need to allocate one */ > if (shift !=3D spapr->htab_shift) { > error_setg(&error_abort, "Failed to allocate HTAB of request= ed size, try with smaller maxmem"); > @@ -1055,7 +1055,7 @@ static void spapr_reset_htab(sPAPRMachineState *spa= pr) > int index; > = > shift =3D kvmppc_reset_htab(spapr->htab_shift); > - if (shift > 0) { > + if (shift !=3D 0) { > if (shift !=3D spapr->htab_shift) { > error_setg(&error_abort, "Requested HTAB allocation failed d= uring reset"); > } > -- = > 2.1.0 >=20