From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33474) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQB1h-0008KK-5i for qemu-devel@nongnu.org; Thu, 21 Jul 2016 06:16:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bQB1d-0007it-7i for qemu-devel@nongnu.org; Thu, 21 Jul 2016 06:16:21 -0400 Received: from 7.mo178.mail-out.ovh.net ([46.105.58.91]:59292) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQB1d-0007in-1V for qemu-devel@nongnu.org; Thu, 21 Jul 2016 06:16:17 -0400 Received: from player169.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo178.mail-out.ovh.net (Postfix) with ESMTP id 27EFB100803D for ; Thu, 21 Jul 2016 12:16:16 +0200 (CEST) Date: Thu, 21 Jul 2016 12:16:05 +0200 From: Greg Kurz Message-ID: <20160721121605.3b927d3b@bahia.lan> In-Reply-To: <20160720201826.GH3337@thinpad.lan.raisama.net> References: <146843310345.22044.7846135644864365198.stgit@bahia.lan> <20160714014240.GK14615@voom.fritz.box> <20160714102957.44124e9e@nial.brq.redhat.com> <20160720201826.GH3337@thinpad.lan.raisama.net> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] vl: exit if a bad property value is passed to -global List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eduardo Habkost Cc: Igor Mammedov , David Gibson , Paolo Bonzini , qemu-devel@nongnu.org, Bharata B Rao On Wed, 20 Jul 2016 17:18:26 -0300 Eduardo Habkost wrote: > Sorry for the long delay: > > On Thu, Jul 14, 2016 at 10:29:57AM +0200, Igor Mammedov wrote: > > On Thu, 14 Jul 2016 11:42:40 +1000 > > David Gibson wrote: > > > > > On Wed, Jul 13, 2016 at 08:05:03PM +0200, Greg Kurz wrote: > > > > When passing '-global driver=host-powerpc64-cpu,property=compat,value=foo' > > > > on the command line, without this patch, we get the following warning per > > > > device (which means many lines if the guests has many cpus): > > > > > > > > qemu-system-ppc64: Warning: can't apply global host-powerpc64-cpu.compat=foo: > > > > Invalid compatibility mode "foo" > > > > > > > > ... and QEMU continues execution, ignoring the property. > > > > > > > > With this patch, we get a single line: > > > > > > > > qemu-system-ppc64: can't apply global host-powerpc64-cpu.compat=foo: > > > > Invalid compatibility mode "foo" > > > > > > > > ... and QEMU exits. > > > > > > > > Signed-off-by: Greg Kurz > > > > > > Reviewed-by: David Gibson > > > > > > Not really up to me to decide if this is the right approach for global > > > option handling, but it seems like the way to go to me. > > CCing Eduardo > > as he basically rewrote that path several times and might know why it's this way now. > > > > > > > > > --- > > > > vl.c | 3 ++- > > > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > > > > > diff --git a/vl.c b/vl.c > > > > index 356713ea075c..a7cc92781687 100644 > > > > --- a/vl.c > > > > +++ b/vl.c > > > > @@ -2922,6 +2922,7 @@ static int global_init_func(void *opaque, QemuOpts *opts, Error **errp) > > > > g->property = qemu_opt_get(opts, "property"); > > > > g->value = qemu_opt_get(opts, "value"); > > > > g->user_provided = true; > > > > + g->errp = errp; > > Exiting QEMU like you suggest is valid, but we can't set errp to > error_fatal here, because it could make QEMU abort when using > device_add. > Indeed QEMU exits :\ > Probably the simplest solution is to ignore GlobalProperty.errp > in qdev_prop_set_globals_for_type() if dev->hotplugged is set. > Then we can safely set errp here. > That should do the trick. I'll send a v2. Thanks ! -- Greg