From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43759) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a8I7k-0001e0-Pm for qemu-devel@nongnu.org; Sun, 13 Dec 2015 20:40:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a8I7j-0004St-Ln for qemu-devel@nongnu.org; Sun, 13 Dec 2015 20:40:24 -0500 Date: Mon, 14 Dec 2015 12:11:27 +1100 From: David Gibson Message-ID: <20151214011127.GF22783@voom.fritz.box> References: <1449792685-17000-1-git-send-email-david@gibson.dropbear.id.au> <1449792685-17000-4-git-send-email-david@gibson.dropbear.id.au> <566AE553.10103@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="qftxBdZWiueWNAVY" Content-Disposition: inline In-Reply-To: <566AE553.10103@redhat.com> Subject: Re: [Qemu-devel] [PATCH 03/11] pseries: Clean up hash page table allocation error handling List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, aik@ozlabs.ru, armbru@redhat.com, agraf@suse.de, qemu-ppc@nongnu.org --qftxBdZWiueWNAVY Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Dec 11, 2015 at 08:01:39AM -0700, Eric Blake wrote: > On 12/10/2015 05:11 PM, David Gibson wrote: > > The spapr_alloc_htab() and spapr_reset_htab() functions currently handle > > all errors with error_setg(&error_abort, ...). That's correct for > > spapr_reset_htab() - if anything goes wrong there, there's really nothi= ng > > we can do about it. For spapr_alloc_htab() &error_fatal would make more > > sense, since it occurs during initialization. > >=20 > > But in any case the callers are really better placed to decide on the e= rror > > handling. So, instead make the functions use the error propagation > > infrastructure. > >=20 > > While we're at it improve the messages themselves a bit, and clean up t= he > > indentation a little. > >=20 > > Signed-off-by: David Gibson > > --- > > hw/ppc/spapr.c | 26 ++++++++++++++++++-------- > > 1 file changed, 18 insertions(+), 8 deletions(-) >=20 > > @@ -1030,7 +1030,9 @@ static void spapr_alloc_htab(sPAPRMachineState *s= papr) > > * 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"); > > + error_setg(errp, > > + "Error allocating KVM hash page table, try smaller maxmem:= %s", > > + strerror(-shift)); >=20 > error_setg_errno() is nicer than calling strerror(). Will adjust in next spin, thanks. --=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 --qftxBdZWiueWNAVY Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJWbhc/AAoJEGw4ysog2bOSLh0P/16sLFYrHiFp37XWi/QRPRKc XYjqnOzE1RpT9zfANTlrNTT+2P5HAd7qfxwlCJJvJoLWrcxJwtRWhHThVkeXEVA8 FclfmoGug0mx8YfNvp2NFO4qKHXeuunIKfGjb60UK5WbtOV4uRUYnvui/zqSlJ+c AqhU3cQ2ID/Zb223+zWwarU/WNttvSXKNoKz74ZgEZvkaJzx3bu65Mdv1aJNJZMq pluCmM+ZGC3okk6mN3cVRBEgSb5IgBoGOUOkoxtwqHCT+eXmAYzLyRdUf2UaRmCx cZIksmbfvgJziF5pdy01v2uUDxKMzIdf5J5vHt02c4V9DTtpNbjMNo5pc17XoAGh JkxUajeQ+9woIRaDR3IWib77b+bmTu5Pl3mOe91keXudRmfDCIgr81ejiEexmUzg 8jZGOaTlF4AisamyBJ0cBvVn5SaF20qaXKSM3b0NbYPbc9MpTlfeLTk35HSXalwA ZW/2huq4sIGvFVl99gJER1msuhHzVK40EvrbEhzPe99890N/wsuYRmg/Ez2E+AiI gOCRsUwCocQL++mkr/K2mE3WVuCoju/PTu+aatkYVlApFctub6P7vMWntoqIE0bu TiomueeD7hEMiGa0BTJu1/JrBkrpg+rh/wwcM/p8AZZuv5f91vF8hyH7jGcwDPiw rm6UZPIEf5dSIyPCmMHD =MT3/ -----END PGP SIGNATURE----- --qftxBdZWiueWNAVY--