qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eduardo Habkost <ehabkost@redhat.com>
To: Igor Mammedov <imammedo@redhat.com>
Cc: David Gibson <david@gibson.dropbear.id.au>,
	Greg Kurz <groug@kaod.org>, Paolo Bonzini <pbonzini@redhat.com>,
	qemu-devel@nongnu.org, Bharata B Rao <bharata@linux.vnet.ibm.com>
Subject: Re: [Qemu-devel] [PATCH] vl: exit if a bad property value is passed to -global
Date: Wed, 20 Jul 2016 17:18:26 -0300	[thread overview]
Message-ID: <20160720201826.GH3337@thinpad.lan.raisama.net> (raw)
In-Reply-To: <20160714102957.44124e9e@nial.brq.redhat.com>

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 <david@gibson.dropbear.id.au> 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 <groug@kaod.org>  
> > 
> > Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
> > 
> > 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.

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.

-- 
Eduardo

  reply	other threads:[~2016-07-20 20:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-13 18:05 [Qemu-devel] [PATCH] vl: exit if a bad property value is passed to -global Greg Kurz
2016-07-14  1:42 ` David Gibson
2016-07-14  8:29   ` Igor Mammedov
2016-07-20 20:18     ` Eduardo Habkost [this message]
2016-07-21 10:16       ` Greg Kurz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160720201826.GH3337@thinpad.lan.raisama.net \
    --to=ehabkost@redhat.com \
    --cc=bharata@linux.vnet.ibm.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=groug@kaod.org \
    --cc=imammedo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).