qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: arei.gonglei@huawei.com
Cc: weidong.huang@huawei.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] virtio-pci: fix virtio-net child refcount in transports
Date: Fri, 5 Sep 2014 13:32:47 +0300	[thread overview]
Message-ID: <20140905103247.GB15743@redhat.com> (raw)
In-Reply-To: <1409830892-5056-1-git-send-email-arei.gonglei@huawei.com>

On Thu, Sep 04, 2014 at 07:41:32PM +0800, arei.gonglei@huawei.com wrote:
> From: Gonglei <arei.gonglei@huawei.com>
> 
> object_initialize() leaves the object with a refcount of 1.
> object_property_add_child() adds its own reference which is dropped
> again when the property is deleted.
> 
> The upshot of this is that we always have a refcount >= 1.  Upon hot
> unplug the virtio-net child is not finalized!
> 
> Drop our reference after the child property has been added to the
> parent.
> 
> Signed-off-by: Gonglei <arei.gonglei@huawei.com>

Aren't other virtio devices affected? what about virtio-scsi?

> ---
> Stefan had post virtio-blk in commit c5d49db4, but virtio-net has 
> the same problem. Maybe the other virtio devices have too.
> ---
>  hw/virtio/virtio-pci.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
> index ddb5da1..78dcd68 100644
> --- a/hw/virtio/virtio-pci.c
> +++ b/hw/virtio/virtio-pci.c
> @@ -1456,6 +1456,7 @@ static void virtio_net_pci_instance_init(Object *obj)
>      VirtIONetPCI *dev = VIRTIO_NET_PCI(obj);
>      object_initialize(&dev->vdev, sizeof(dev->vdev), TYPE_VIRTIO_NET);
>      object_property_add_child(obj, "virtio-backend", OBJECT(&dev->vdev), NULL);
> +    object_unref(OBJECT(&dev->vdev));
>  }
>  
>  static const TypeInfo virtio_net_pci_info = {
> -- 
> 1.7.12.4
> 

  parent reply	other threads:[~2014-09-05 10:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-04 11:41 [Qemu-devel] [PATCH] virtio-pci: fix virtio-net child refcount in transports arei.gonglei
2014-09-05  9:08 ` Gonglei (Arei)
2014-09-05 10:32 ` Michael S. Tsirkin [this message]
2014-09-05 15:46   ` Gonglei
2014-09-05 12:10 ` Stefan Hajnoczi
2014-09-05 15:46   ` Gonglei
2014-09-05 16:28     ` Stefan Hajnoczi
2014-09-08 12:47       ` Gonglei

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=20140905103247.GB15743@redhat.com \
    --to=mst@redhat.com \
    --cc=arei.gonglei@huawei.com \
    --cc=qemu-devel@nongnu.org \
    --cc=weidong.huang@huawei.com \
    /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).