qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Amos Kong <kongjianjun@gmail.com>
Cc: pbonzini@redhat.com, aliguori@us.ibm.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v3] pci: call object_unparent() before free_qdev()
Date: Sun, 20 May 2012 13:22:07 +0300	[thread overview]
Message-ID: <20120520102206.GD14085@redhat.com> (raw)
In-Reply-To: <1337507865-28504-1-git-send-email-kongjianjun@gmail.com>

On Sun, May 20, 2012 at 05:57:45PM +0800, Amos Kong wrote:
> 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)
> 
> It's a regression introduced by commit 57c9fafe
> 
> 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.
> 
> free_qdev() are called for all functions in slot,
> but unparent_delete() is only called for one
> function.
> 
> ---
> aliguori has a better resolution, better to do it in 1.2
> 
> v2: fix warning: too many arguments for format
> v3: move object_unparent() to acpi_piix_eject_slot()
> 
> Signed-off-by: Amos Kong <kongjianjun@gmail.com>

commit is mangled up a bit.  It should be:

subject: xxxx

commit log

Signed-off-by: XXXX

--- 

Versioning info

diff


No need to repost just we that. But we also need to update other pci
hotplug users: hw//shpc.c hw//pcie.c
Not sure about pci-hotplug.c (calls qdev_free on error
handling) - add a virtio blk function with wrong drive
parameter using pci_add and see. Anything else?

> ---
>  hw/acpi_piix4.c |    1 +
>  hw/pci.c        |    1 -
>  2 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/hw/acpi_piix4.c b/hw/acpi_piix4.c
> index 585da4e..0345490 100644
> --- a/hw/acpi_piix4.c
> +++ b/hw/acpi_piix4.c
> @@ -299,6 +299,7 @@ static void acpi_piix_eject_slot(PIIX4PMState *s, unsigned slots)
>              if (pc->no_hotplug) {
>                  slot_free = false;
>              } else {
> +                object_unparent(OBJECT(dev));
>                  qdev_free(qdev);
>              }
>          }
> diff --git a/hw/pci.c b/hw/pci.c
> index b706e69..c1ebdde 100644
> --- a/hw/pci.c
> +++ b/hw/pci.c
> @@ -1527,7 +1527,6 @@ static int pci_unplug_device(DeviceState *qdev)
>          qerror_report(QERR_DEVICE_NO_HOTPLUG, object_get_typename(OBJECT(dev)));
>          return -1;
>      }
> -    object_unparent(OBJECT(dev));
>      return dev->bus->hotplug(dev->bus->hotplug_qdev, dev,
>                               PCI_HOTPLUG_DISABLED);
>  }
> -- 
> 1.7.1

  reply	other threads:[~2012-05-20 10:22 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
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 [this message]
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=20120520102206.GD14085@redhat.com \
    --to=mst@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=kongjianjun@gmail.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).