From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49099) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZvoB0-0004p4-HV for qemu-devel@nongnu.org; Mon, 09 Nov 2015 10:16:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZvoAx-0002Tb-P1 for qemu-devel@nongnu.org; Mon, 09 Nov 2015 10:16:10 -0500 Date: Mon, 9 Nov 2015 23:31:59 +1100 From: David Gibson Message-ID: <20151109123159.GI18558@voom.redhat.com> References: <1446545299-19446-1-git-send-email-bharata@linux.vnet.ibm.com> <20151109042415.GD18558@voom.redhat.com> <20151109084655.GG18558@voom.redhat.com> <20151109121258.GD14232@in.ibm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="y96v7rNg6HAoELs5" Content-Disposition: inline In-Reply-To: <20151109121258.GD14232@in.ibm.com> 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 Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com --y96v7rNg6HAoELs5 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Nov 09, 2015 at 05:42:58PM +0530, Bharata B Rao wrote: > On Mon, Nov 09, 2015 at 07:46:55PM +1100, David Gibson wrote: > > On Mon, Nov 09, 2015 at 03:24:15PM +1100, David Gibson wrote: > > > On Tue, Nov 03, 2015 at 03:38:19PM +0530, Bharata B Rao wrote: > > > > KVM_PPC_ALLOCATE_HTAB ioctl can return -ENOMEM for KVM guests and Q= EMU > > > > never handled this correctly. But this didn't cause any problems ti= ll > > > > now as KVM_PPC_ALLOCATE_HTAB ioctl returned with smaller than reque= sted > > > > HTAB when enough contiguous memory wasn't available in the host. > > > > After the proposed kernel change: https://patchwork.ozlabs.org/patc= h/530501/, > > > > 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 doi= ng > > > > graceful exit when host is unable to allocate requested HTAB. > > > >=20 > > > > Signed-off-by: Bharata B Rao > > >=20 > > > I'm going to apply this, since it fixes a real problem. > > >=20 > > > I'm not entirely happy with the way it's done though - I'd prefer to > > > see a separate case for (shift < 0) giving an unconditional error. > > > Handling both the HV success case and the failure case in that first > > > branch is unnecessarily subtle and confusing, IMO. > >=20 > > Ugh.. actually.. this patch seems to cause make check failures when > > configured for powerpc guest on an x86 host. I haven't debugged yet, > > but I'm guessing the shift !=3D 0 is now catching the TCG (or PR) case > > where we need to allocate the htab ourselves. >=20 > For ppc64 on x86, CONFIG_KVM doesn't get defined in config-target.h and > hence the HTAB reset routine that gets picked up is >=20 > static inline int kvmppc_reset_htab(int shift_hint) > { =20 > return -1; > } >=20 > from target-ppc/kvm_ppc.h. I guess we should change this to return > 0 so that we allocate HTAB ourselves. Negative values should always > mean error and we should abort in such cases. Yes, that makes sense. > Should I send the next version with above routine fixed to return 0 > and spapr_alloc_htab/spapr_reset_htab changed to explicitly check and > fail for shift < 0 ? Yes please. > I had tested both TCG and PR modes for ppc64 guest on ppc64 host where > both boot and reboot tests passed. Didn't realize that ppc64 emulation > on x86 could be different like this. I think it would also fail on a ppc64 host, if you explicitly disabled KVM in the config. --=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 --y96v7rNg6HAoELs5 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJWQJI/AAoJEGw4ysog2bOS/M8P/ihW6wypA5cKqSWKcCvXWft9 IBqclVL2kSH2+BIJ1yjogWH2Q0GMyyMsbWFT6dYlSMxFSFZP+gKUo0rhCZX4KPsw R0nLjPm7sYm0LoYeOmNPMoLtzS/C9ErIErfzlNx6eo2MuApUSnQdisPx4ELjdZzG a+GZQ14ioH9TSG9pJCACo4C2g4MzWsVmKL8hVNgKEHmzMwlej02in+24QJFhLGY6 03xyxJnmdoq1+vC9tDVO9p2u+wCihgXtX/FXtiPW7shY7EPxKh3HASX1L1JlQlXA Xq85rkgc52fOIZpZcFQZBzBYhcNvpgPUJLKKVPkaxFy0KRXyNmu8clzGByWwt+KW TogSe323idQyhCP//yBMnu0K3V2TILNdV/QbWIYYtI8dnRAIcg2PjL8ZEe8bqpu5 qDSgs3TFureSETWCW8DH8o1V6GDjX3etmPxehOe73hONL5tjxcUkGDlRBvbDpKSa X1lGTNw5y5Mj+U5ysRUz4UrLU2aVvSSyrLisQxR5VJ3qjCinYlA0aIHV9Duu3dqv SFelhkyKegTuc3RJKKQnERahOAG2gr//GvanDs8KGG0rxoCoVlqq3mYV2WmVUo4H l4SGA3gaMCg7w/4z63XlwWXbEEe3OS9mcGlQ/e+t6xZBF5o0O89IoMTcFgfimMMv 8SK9swX+UYZWytzWCa2a =M8bS -----END PGP SIGNATURE----- --y96v7rNg6HAoELs5--