From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34175) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XyMPH-0003nt-FO for qemu-devel@nongnu.org; Tue, 09 Dec 2014 10:09:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XyMP8-0001dm-QQ for qemu-devel@nongnu.org; Tue, 09 Dec 2014 10:08:55 -0500 Received: from cantor2.suse.de ([195.135.220.15]:45336 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XyMP8-0001dR-JX for qemu-devel@nongnu.org; Tue, 09 Dec 2014 10:08:46 -0500 Message-ID: <5487107C.5080506@suse.de> Date: Tue, 09 Dec 2014 16:08:44 +0100 From: =?windows-1252?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1415170983-12981-1-git-send-email-junmuzi@gmail.com> <20141208140741.GC2836@localhost.localdomain> In-Reply-To: <20141208140741.GC2836@localhost.localdomain> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v3] qdev: Avoid type assertion in qdev_build_hotpluggable_device_list() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jun Li , qemu-devel@nongnu.org Cc: peter.crosthwaite@xilinx.com, famz@redhat.com, mst@redhat.com, juli@redhat.com, imammedo@redhat.com, pbonzini@redhat.com Am 08.12.2014 um 15:07 schrieb Jun Li: > Ping, why does this patch has not been merged until now? Could anyone g= ive > some explanations? Thx. I had already applied the previous version of the patch to qom-next. I'll drop it and replace it with this version then. Regards, Andreas > On Wed, 11/05 15:03, Jun Li wrote: >> Currently when *obj is not a TYPE_DEVICE, qemu will abort. This patch = just >> fixed it. When *obj is not a TYPE_DEVICE, just do not add it to hotplu= ggable >> device list. >> >> This patch also fixed the following issue: >> 1, boot qemu using cli: >> $ /opt/qemu-git-arm/bin/qemu-system-x86_64 -monitor stdio -enable-kvm = \ >> -device virtio-scsi-pci,id=3Dscsi0 >> >> 2, device_del scsi0 via hmp using tab key(first input device_del, then= press >> "Tab" key). >> (qemu) device_del >> >> After step2, qemu will abort. >> (qemu) device_del hw/core/qdev.c:930:qdev_build_hotpluggable_device_li= st: >> Object 0x5555563a2460 is not an instance of type device >> >> Signed-off-by: Jun Li >> Reviewed-by: Paolo Bonzini >> --- >> v3: >> According to Andreas's suggestion, do some changes. As followings: >> 1, change the Subject to more meaningful. >> 2, use two "return 0" to return early avoid reindentation. And I hav= e found in qcow2_grow_l1_table has also used two "return 0". So accept An= dreas's suggestion. Thanks. >> >> v2: >> This version just do a little changes for the commit message. >> As following show: >> In v1, >> 1, boot qemu using cli: >> virtio-scsi-pci,id=3Dscsi0 -enable-kvm >> >> In v2, >> 1, boot qemu using cli: >> $ /opt/qemu-git-arm/bin/qemu-system-x86_64 -monitor stdio -enable-kvm = \ >> -device virtio-scsi-pci,id=3Dscsi0 >> --- >> hw/core/qdev.c | 7 ++++++- >> 1 file changed, 6 insertions(+), 1 deletion(-) >> >> diff --git a/hw/core/qdev.c b/hw/core/qdev.c >> index b3d5196..7db3e13 100644 >> --- a/hw/core/qdev.c >> +++ b/hw/core/qdev.c >> @@ -927,7 +927,12 @@ void qdev_alias_all_properties(DeviceState *targe= t, Object *source) >> int qdev_build_hotpluggable_device_list(Object *obj, void *opaque) >> { >> GSList **list =3D opaque; >> - DeviceState *dev =3D DEVICE(obj); >> + DeviceState *dev =3D (DeviceState *)object_dynamic_cast(OBJECT(ob= j), >> + "device"); >> + >> + if (dev =3D=3D NULL) { >> + return 0; >> + } >> =20 >> if (dev->realized && object_property_get_bool(obj, "hotpluggable"= , NULL)) { >> *list =3D g_slist_append(*list, dev); >> --=20 >> 1.9.3 >> >=20 --=20 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 21284 AG N=FCrnbe= rg