qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: qemu-devel@nongnu.org, "Paolo Bonzini" <pbonzini@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Andreas Färber" <afaerber@suse.de>
Subject: Re: [Qemu-devel] [PATCH] qdev: Make "hotplugged" property read-only
Date: Fri, 30 Dec 2016 15:28:34 +0100	[thread overview]
Message-ID: <20161230152834.6d1fa963@Igors-MacBook-Pro.local> (raw)
In-Reply-To: <20161229223815.13705-1-ehabkost@redhat.com>

On Thu, 29 Dec 2016 20:38:15 -0200
Eduardo Habkost <ehabkost@redhat.com> wrote:

> The "hotplugged" property is user visible, but it was never meant
> to be set by the user. There are probably multiple ways to break
> or crash device code by overriding the property. One example:
> 
>   $ qemu-system-x86_64 -cpu qemu64,hotplugged=true
>   Segmentation fault (core dumped)
> 
> The DeviceState::hotplugged struct field is set directly by
> device_initfn(), there's no need to provide a setter for the
> property.
this property is meant to be used for individual devices on target side
of migration.
Doing above is a rather big hammer with behavioral change of migrated
instance.

So I'd  fix crash caused by assumption that hotplugged CPU
guarantied to have rtc&fw_cfg available.
I'll post a patch with the fix.

> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
>  hw/core/qdev.c | 9 +--------
>  1 file changed, 1 insertion(+), 8 deletions(-)
> 
> diff --git a/hw/core/qdev.c b/hw/core/qdev.c
> index 57834423b9..f5989c41cb 100644
> --- a/hw/core/qdev.c
> +++ b/hw/core/qdev.c
> @@ -1013,13 +1013,6 @@ static bool device_get_hotplugged(Object *obj, Error **err)
>      return dev->hotplugged;
>  }
>  
> -static void device_set_hotplugged(Object *obj, bool value, Error **err)
> -{
> -    DeviceState *dev = DEVICE(obj);
> -
> -    dev->hotplugged = value;
> -}
> -
>  static void device_initfn(Object *obj)
>  {
>      DeviceState *dev = DEVICE(obj);
> @@ -1039,7 +1032,7 @@ static void device_initfn(Object *obj)
>      object_property_add_bool(obj, "hotpluggable",
>                               device_get_hotpluggable, NULL, NULL);
>      object_property_add_bool(obj, "hotplugged",
> -                             device_get_hotplugged, device_set_hotplugged,
> +                             device_get_hotplugged, NULL,
>                               &error_abort);
>  
>      class = object_get_class(OBJECT(dev));

  reply	other threads:[~2016-12-30 14:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-29 22:38 [Qemu-devel] [PATCH] qdev: Make "hotplugged" property read-only Eduardo Habkost
2016-12-30 14:28 ` Igor Mammedov [this message]
2016-12-30 18:23   ` Eduardo Habkost
2017-01-03 13:02     ` Igor Mammedov
2017-01-03 14:22       ` Eduardo Habkost
2017-01-03 15:07         ` Igor Mammedov
2017-01-03 16:10         ` Paolo Bonzini
2017-01-03 16:53           ` Igor Mammedov
2017-01-03 17:06             ` Eduardo Habkost
2017-02-22 19:21               ` Eduardo Habkost

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=20161230152834.6d1fa963@Igors-MacBook-Pro.local \
    --to=imammedo@redhat.com \
    --cc=afaerber@suse.de \
    --cc=armbru@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=mst@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).