qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Amos Kong <akong@redhat.com>
Cc: pbonzini@redhat.com, aliguori@us.ibm.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] pci: unplug all devs of same slot once
Date: Sun, 13 May 2012 13:54:19 +0300	[thread overview]
Message-ID: <20120513105419.GA23755@redhat.com> (raw)
In-Reply-To: <20120511145725.16518.77110.stgit@t>

On Fri, May 11, 2012 at 10:57:25PM +0800, Amos Kong wrote:
> The whole PCI slot should be removed once. Currently only one func
> is cleaned in pci_unplug_device(), if you try to remove a single
> func by monitor cmd.
> 
> Start VM with 8 multiple-function block devs, hot-removing
> those block devs by 'device_del ...' would cause qemu abort.
> 
> | (qemu) device_del virti0-0-0
> | (qemu) **
> |ERROR:qom/object.c:389:object_delete: assertion failed: (obj->ref == 0)
> 
> Execute 'device_del $blkid' in monitor
>  \_handle_user_command()
>     \_qmp_device_del()
>        \_qdev_unplug()
>           \_pci_unplug_device()
>                | //only one obj(func) is unpluged
>                v //need process funcs here
>    object_unparent()
>     \_object_finalize_child_property()

This is the bug IMO. PCI device delete request
through monitor simply notifies guest. It should not unparent
the object or do anything else.

> Guest sets pci dev by ioport write (eject from acpi)
>  \_kvm_handle_io()
>     \_pciej_write()
>       \_acpi_piix_eject_slot()
>            |
>            v  //all qdevs(funcs) will be free
>  QTAILQ_FOREACH_SAFE(qdev, &bus->children, sibling, next) {
>      PCIDevice *dev = PCI_DEVICE(qdev);
>      if (PCI_SLOT(dev->devfn) == slot) {
>          qdev_free()
> 
> Signed-off-by: Amos Kong <akong@redhat.com>
> ---

This was done as part of 57c9fafe0f759c9f1efa5451662b3627f9bb95e0.
Should we just call object_unparent before qdev_free?
Anthony?

-- 
MST

  parent reply	other threads:[~2012-05-13 10:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-11  2:15 [Qemu-devel] [PATCH] qom: fix refcounting in object_property_del_child() Amos Kong
2012-05-11  6:42 ` Paolo Bonzini
2012-05-11 14:52   ` Amos Kong
2012-05-11 14:57   ` [Qemu-devel] [PATCH] pci: unplug all devs of same slot once Amos Kong
2012-05-13  0:40     ` Amos Kong
2012-05-13 10:54     ` Michael S. Tsirkin [this message]
2012-05-14  7:55       ` Paolo Bonzini
2012-05-20  9:57     ` [Qemu-devel] [PATCH v3] pci: call object_unparent() before free_qdev() Amos Kong
2012-05-20 10:22       ` Michael S. Tsirkin
2012-06-04 20:15       ` Jason Baron
2012-06-04 21:52         ` Michael S. Tsirkin
2012-06-07 14:06           ` Jason Baron

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=20120513105419.GA23755@redhat.com \
    --to=mst@redhat.com \
    --cc=akong@redhat.com \
    --cc=aliguori@us.ibm.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).