From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37703) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQR3P-0006sT-V3 for qemu-devel@nongnu.org; Thu, 21 Jul 2016 23:23:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bQR3K-0003su-Tj for qemu-devel@nongnu.org; Thu, 21 Jul 2016 23:23:10 -0400 Received: from ozlabs.org ([103.22.144.67]:41842) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQR3K-0003sL-IS for qemu-devel@nongnu.org; Thu, 21 Jul 2016 23:23:06 -0400 Date: Fri, 22 Jul 2016 11:28:48 +1000 From: David Gibson Message-ID: <20160722012848.GA15941@voom.fritz.box> References: <146914207036.16527.6025809385836923910.stgit@bahia.lan> <146914207969.16527.15568547267031224728.stgit@bahia.lan> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="TB36FDmn/VVEgNH/" Content-Disposition: inline In-Reply-To: <146914207969.16527.15568547267031224728.stgit@bahia.lan> Subject: Re: [Qemu-devel] [PATCH v3 1/2] qdev: ignore GlobalProperty.errp for hotplugged devices List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Greg Kurz Cc: Paolo Bonzini , qemu-devel@nongnu.org, Bharata B Rao , Eduardo Habkost --TB36FDmn/VVEgNH/ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jul 22, 2016 at 01:01:26AM +0200, Greg Kurz wrote: > This patch ensures QEMU won't terminate while hotplugging a device if the > global property cannot be set and errp points to error_fatal or error_abo= rt. >=20 > While here, it also fixes indentation of the typename argument. >=20 > Suggested-by: Eduardo Habkost > Signed-off-by: Greg Kurz This seems kind of bogus to me - we have this whole infrastructure for handling errors, and here we throw it away. It seems like the right solution would be to make the caller in the hotplug case *not* use error_abort or error_fatal, and instead get the error propagated back to the monitor which will display it. > --- > hw/core/qdev-properties.c | 4 ++-- > include/hw/qdev-core.h | 4 +++- > 2 files changed, 5 insertions(+), 3 deletions(-) >=20 > diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c > index 14e544ab17d2..311af6da7684 100644 > --- a/hw/core/qdev-properties.c > +++ b/hw/core/qdev-properties.c > @@ -1084,7 +1084,7 @@ int qdev_prop_check_globals(void) > } > =20 > static void qdev_prop_set_globals_for_type(DeviceState *dev, > - const char *typename) > + const char *typename) > { > GList *l; > =20 > @@ -1100,7 +1100,7 @@ static void qdev_prop_set_globals_for_type(DeviceSt= ate *dev, > if (err !=3D NULL) { > error_prepend(&err, "can't apply global %s.%s=3D%s: ", > prop->driver, prop->property, prop->value); > - if (prop->errp) { > + if (!dev->hotplugged && prop->errp) { > error_propagate(prop->errp, err); > } else { > assert(prop->user_provided); > diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h > index 1d1f8612a9b8..4b4b33bec885 100644 > --- a/include/hw/qdev-core.h > +++ b/include/hw/qdev-core.h > @@ -261,7 +261,9 @@ struct PropertyInfo { > * @used: Set to true if property was used when initializing a device. > * @errp: Error destination, used like first argument of error_setg() > * in case property setting fails later. If @errp is NULL, we > - * print warnings instead of ignoring errors silently. > + * print warnings instead of ignoring errors silently. For > + * hotplugged devices, errp is always ignored and warnings are > + * printed instead. > */ > typedef struct GlobalProperty { > const char *driver; >=20 --=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 --TB36FDmn/VVEgNH/ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJXkXbPAAoJEGw4ysog2bOScAkP/jd9lTEFYI1KyTIhzZ3jhhhP op8eY4qgEfFmsfuD89v92t6VHVq7/epLv62EhjKi4az8Z3kxz88JKQOe3dHyL7B+ J6l+B4qqQBhBHCN9V/HmIVPFo7qndRaGrh9UVkNu/IGmWWamFz2DcFgA4SpUPn0j rXR7q2VdNEt2816hD5Ct3Tzdbut87ErDV0EbTtQRGTCFDXRWy/yHyJPSF0Fprnpt TAcAxeyNIayedR6eUSiqsy72TgPVoT9W+LlAMWPphpvMOu4rXDKI1kFlVhYoLe7B IYIwz5pz3kj9mDJ98Ww1Rzgw1LqoApaMs3maK3sq6kbF4r4jtjL74XdQmy2y1hwo 9rLK3Z3o48mIxWUnZRX82yH3ZfqLVTlqmUtw4piUpgbX+0BYHdAe+39UoJlCL23x g3/mQQ4+4qU27eGryoIkHW0DR4R8G6rK8mqAaC4xBXq0dA/nVmy0yq00EAYt8d+Z GEJ5Tqn311FwgcILSvupwZwnRPlQiW9oxdmYlzUK0Iwi5rAin1So4N7EBbFyzXq/ S9A0cIwOxTypqecLgxO2J4C3w4yh6yx9fSWCTc3Fx5s5pY2+PoZvoayB9zHzDfx0 Y8mV7H8mDGtpHHoOMsonBjaIRkSAXvu7rN/Smr0P9d1oHACVc9QdG4rKulM358Lo JT2NJlBn1Q8zqvXd8iwK =VVNj -----END PGP SIGNATURE----- --TB36FDmn/VVEgNH/--