From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43825) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a8I7m-0001eE-T5 for qemu-devel@nongnu.org; Sun, 13 Dec 2015 20:40:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a8I7j-0004T8-Mn for qemu-devel@nongnu.org; Sun, 13 Dec 2015 20:40:26 -0500 Date: Mon, 14 Dec 2015 12:04:46 +1100 From: David Gibson Message-ID: <20151214010446.GD22783@voom.fritz.box> References: <1449792685-17000-1-git-send-email-david@gibson.dropbear.id.au> <1449792685-17000-3-git-send-email-david@gibson.dropbear.id.au> <566AE3B8.7010100@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="48TaNjbzBVislYPb" Content-Disposition: inline In-Reply-To: <566AE3B8.7010100@redhat.com> Subject: Re: [Qemu-devel] [PATCH 02/11] pseries: Cleanup error handling of spapr_cpu_init() 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 --48TaNjbzBVislYPb Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Dec 11, 2015 at 07:54:48AM -0700, Eric Blake wrote: > On 12/10/2015 05:11 PM, David Gibson wrote: > > Currently spapr_cpu_init() is hardcoded to handle any errors as fatal. > > That works for now, since it's only called from initial setup where an > > error here means we really can't proceed. > >=20 > > However, we'll want to handle this more flexibly for cpu hotplug in fut= ure > > so generalize this using the error reporting infrastructure. While we'= re > > at it make a small cleanup in a related part of ppc_spapr_init() to use > > the error infrastructure instead of an old-style explicit fprintf / exi= t. > >=20 > > Signed-off-by: David Gibson > > --- > > hw/ppc/spapr.c | 10 +++++----- > > 1 file changed, 5 insertions(+), 5 deletions(-) >=20 > > @@ -1633,7 +1634,7 @@ static void spapr_cpu_init(sPAPRMachineState *spa= pr, PowerPCCPU *cpu) > > } > > =20 > > if (cpu->max_compat) { > > - ppc_set_compat(cpu, cpu->max_compat, &error_fatal); > > + ppc_set_compat(cpu, cpu->max_compat, errp); > > } > > =20 > > xics_cpu_setup(spapr->icp, cpu); >=20 > Pre-patch: you can't reach the xics_cpu_setup() call on error. >=20 > Post-patch: depending on what the caller passed in, you can fall through > to xics_cpu_setup() with a potentially incomplete cpu. >=20 > I think a more robust solution is probably along the lines of: >=20 > Error *err =3D NULL; > if (cpu->max_compat) { > ppc_set_compat(cpu, cpu->max_compat, &err); > if (err) { > error_propagate(errp, err); > return; > } > } > xics_cpu_setup(spapr_icp, cpu); Yes, good point. I _think_ xics_cpu_setup() would be safe to call even if ppc_set_compat() fails, but checking for the error immediately is safer indeed. I'll adjust in the next spin. --=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 --48TaNjbzBVislYPb Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJWbhWuAAoJEGw4ysog2bOSed8P/0BJVHi4A1LXdcEd3ACPeavt ufDDj6lRtyG5c6zZkLoTbsRv0x5XNQHp8MMT++NmMkivOdJziHHqBTsPCJ976TrY tij02D9Pd1qiT4Y1Nl/TfpXNVHkUcwrKegbEOtQ2omugKa4ewyIrSFecjVSaKeG7 ADN02YKSBfl52//59cmP9pXNnKdAqYwLn3hJNI3V6qcUcznaDV+MOmGqxP07BSj9 2cvO/D3TuFN6U4/aiMfUkhQYnQF/q8KvFJ2CjQRDbVvpGkzGf5ThLWlerCFhyxfb uxBD4oEDhtRTQewcSNO3NaYKrwALZKuqtQNNMRTfJHBbKyqBhJWL1uTGOzMPUQhL TlSivMqP3ekbDtwn+4BvZS77bLk+zvIYtC4NfGS2AwOy1NUrEj02vCZLY2KbeCJc QvDAA988LqbupKQAIJSvUs5xIn+2k1HWs2ty2JrvwpUeohYYUv4qPZYf+t3LBfT1 B5/Wxxre7LrekICs8/3i+X19OMk21Rtkq8fyXPkT3hwxSy1JjTDOu7yJl3miTUAh JEoIkGDqp8FLsp+sYFvFAU6UgFmhBCVRrmZ1yPA6VkWd1ko5AFGjIhYR0AAD6QDb C5EE6GXpZtt4rs3W7x6TlQ36cDkaFAn5sx6p57q5j4rqWr9dhEnrp/Hhoq1Gi+XJ qdim/+64GMHzf9qqkcpo =r3OP -----END PGP SIGNATURE----- --48TaNjbzBVislYPb--