From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:44520) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1STWRR-0003Ao-PB for qemu-devel@nongnu.org; Sun, 13 May 2012 06:54:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1STWRQ-0003yJ-3i for qemu-devel@nongnu.org; Sun, 13 May 2012 06:54:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45685) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1STWRP-0003yA-S2 for qemu-devel@nongnu.org; Sun, 13 May 2012 06:54:20 -0400 Date: Sun, 13 May 2012 13:54:19 +0300 From: "Michael S. Tsirkin" Message-ID: <20120513105419.GA23755@redhat.com> References: <4FACB4E4.2070708@redhat.com> <20120511145725.16518.77110.stgit@t> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120511145725.16518.77110.stgit@t> Subject: Re: [Qemu-devel] [PATCH] pci: unplug all devs of same slot once List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Amos Kong Cc: pbonzini@redhat.com, aliguori@us.ibm.com, qemu-devel@nongnu.org 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 > --- This was done as part of 57c9fafe0f759c9f1efa5451662b3627f9bb95e0. Should we just call object_unparent before qdev_free? Anthony? -- MST