From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44899) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VbXwe-0006ET-5C for qemu-devel@nongnu.org; Wed, 30 Oct 2013 11:44:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VbXwW-0007RQ-Gt for qemu-devel@nongnu.org; Wed, 30 Oct 2013 11:44:31 -0400 Received: from cantor2.suse.de ([195.135.220.15]:56395 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VbXwW-0007RI-6u for qemu-devel@nongnu.org; Wed, 30 Oct 2013 11:44:24 -0400 Message-ID: <52712952.8010203@suse.de> Date: Wed, 30 Oct 2013 16:44:18 +0100 From: =?ISO-8859-15?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1383141276-19230-1-git-send-email-stefanha@redhat.com> In-Reply-To: <1383141276-19230-1-git-send-email-stefanha@redhat.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v3 0/7] qdev and blockdev refcount leak fixes List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi , qemu-devel@nongnu.org, Anthony Liguori Cc: Paolo Bonzini , Markus Armbruster Am 30.10.2013 14:54, schrieb Stefan Hajnoczi: > v3: > * I lost track of this patch, now I'm pushing it again Part of this series is in a pending qom-next pull of mine (on a different base), which Anthony didn't merge due to some questions or problems, and during Hackathon he disappeared and so far hasn't followed up further. :( I can surely send a rebased PULL v2 now that the block fix I think is in, but not sure if that is all to do... Regards, Andreas > * Rebase onto qemu.git/master > * Add Patch 7 to do s/qdev_free()/object_unparent()/ [afaerber] >=20 > It started with a bug report along these lines: >=20 > (qemu) device_add virtio-blk-pci,drive=3Ddrive0,x-data-plane=3Don > device is incompatible with x-data-plane, use scsi=3Doff > Device initialization failed. > Device initialization failed. > Device 'virtio-blk-pci' could not be initialized > (qemu) drive_del drive0 > (qemu) drive_add 0 if=3Dnone,id=3Ddrive0 > Duplicate ID 'drive0' for drive >=20 > The drive_add command should succeed since the old "drive0" was deleted= . >=20 > With the help of Andreas and Paolo we figured out that the problem is n= ot > virtio-blk or dataplane. There are actually two problems: >=20 > 1. qdev_device_add() must release its DeviceState reference if > qdev_init() failed. >=20 > 2. blockdev_init() must release its QemuOpts on failure or early return= when no > file=3D option was specified. >=20 > This series fixes these problems and then qtest test cases for both bug= s. In > order to do this we need to add QMP response objects to the libqtest AP= I, which > currently discards QMP responses. >=20 > Patches 1 & 2 fix the leaks. > Patches 2 & 3 add QMP response objects to libqtest. > Patches 5 & 6 add qtest test cases for the bugs. > Patch 7 replaces the confusing qdev_free() function with object_unparen= t() >=20 > Stefan Hajnoczi (7): > blockdev: fix drive_init() opts and bs_opts leaks > qdev: unref qdev when device_add fails > libqtest: rename qmp() to qmp_discard_response() > libqtest: add qmp(fmt, ...) -> QDict* function > blockdev-test: add test case for drive_add duplicate IDs > qdev-monitor-test: add device_add leak test cases > qdev: drop misleading qdev_free() function >=20 > blockdev.c | 27 +++++++++------- > hw/acpi/piix4.c | 2 +- > hw/core/qdev.c | 12 ++----- > hw/pci/pci-hotplug-old.c | 2 +- > hw/pci/pci_bridge.c | 2 +- > hw/pci/pcie.c | 2 +- > hw/pci/shpc.c | 2 +- > hw/s390x/virtio-ccw.c | 2 +- > hw/scsi/scsi-bus.c | 6 ++-- > hw/usb/bus.c | 7 ++-- > hw/usb/dev-storage.c | 2 +- > hw/usb/host-legacy.c | 2 +- > hw/virtio/virtio-bus.c | 4 +-- > hw/xen/xen_platform.c | 2 +- > include/hw/qdev-core.h | 1 - > qdev-monitor.c | 6 ++-- > tests/Makefile | 4 +++ > tests/blockdev-test.c | 59 ++++++++++++++++++++++++++++++++++ > tests/boot-order-test.c | 4 +-- > tests/fdc-test.c | 15 +++++---- > tests/ide-test.c | 10 +++--- > tests/libqtest.c | 72 +++++++++++++++++++++++++++++++--------= -- > tests/libqtest.h | 51 +++++++++++++++++++++++++---- > tests/qdev-monitor-test.c | 81 +++++++++++++++++++++++++++++++++++++++= ++++++++ > 24 files changed, 299 insertions(+), 78 deletions(-) > create mode 100644 tests/blockdev-test.c > create mode 100644 tests/qdev-monitor-test.c >=20 --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg