From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:50294) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UUGn0-0001VP-Rx for qemu-devel@nongnu.org; Mon, 22 Apr 2013 09:28:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UUGmi-00058n-CE for qemu-devel@nongnu.org; Mon, 22 Apr 2013 09:28:14 -0400 Received: from cantor2.suse.de ([195.135.220.15]:57612 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UUGmh-00058O-TE for qemu-devel@nongnu.org; Mon, 22 Apr 2013 09:27:56 -0400 Message-ID: <51753ADA.5010504@suse.de> Date: Mon, 22 Apr 2013 15:27:54 +0200 From: =?ISO-8859-1?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1366077021-28882-1-git-send-email-afaerber@suse.de> <20130418104156.7a5349f0@nial.usersys.redhat.com> <20130418110151.316c17b6@nial.usersys.redhat.com> <5D9ACBBCF6B270468D615C4719A59BE33A469646@szxeml548-mbx.china.huawei.com> In-Reply-To: <5D9ACBBCF6B270468D615C4719A59BE33A469646@szxeml548-mbx.china.huawei.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] qdev: Fix device_add bus assumptions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Libaiqing , =?ISO-8859-1?Q?KONRAD_Fr=E9d=E9ri?= =?ISO-8859-1?Q?c?= Cc: "ehabkost@redhat.com" , Haofeng , "armbru@redhat.com" , "qemu-devel@nongnu.org" , "anthony@codemonkey.ws" , "pbonzini@redhat.com" , Igor Mammedov , "lcapitulino@redhat.com" Hi, Am 22.04.2013 13:51, schrieb Libaiqing: > When I use the config below,an error occurs.Is there anything wrong? >=20 > Qemu-kvm -enable-kvm -name win7 -M pc-0.15 -m 1024 -smp 2 -boot c -d= evice virtio-serial-pci,id=3Dvirtio-serial0,bus=3Dpci.0,addr=3D0x4 -chard= ev spicevmc,id=3Dcharchannel0,name=3Dvdagent -device virtserialport,bus=3D= virtio-serial0.0,chardev=3Dcharchannel0,id=3Dchannel0,name=3Dcom.redhat.s= pice.0 -drive file=3D/home/img/win7.qed,if=3Dvirtio,index=3D0,format=3Dq= ed -monitor stdio -vga qxl -vnc :1 >=20 > Error output: > -device virtserialport,bus=3Dvirtio-serial0.0,chardev=3Dcharchannel= 0,id=3Dchannel0,name=3Dcom.redhat.spice.0: Bus 'virtio-serial0.0' is full > -device virtserialport,bus=3Dvirtio-serial0.0,chardev=3Dcharchannel= 0,id=3Dchannel0,name=3Dcom.redhat.spice.0: Bus 'virtio-serial0.0' not fou= nd >=20 > Any feedback are appliciated. This does not sound related to this patch at all... Instead it sounds as if the virtio refactorings had some effect not only on virtio-net but also on virtio-serial. Fred? Andreas > -----Original Message----- > From: qemu-devel-bounces+libaiqing=3Dhuawei.com@nongnu.org [mailto:qemu= -devel-bounces+libaiqing=3Dhuawei.com@nongnu.org] On Behalf Of Igor Mamme= dov > Sent: Thursday, April 18, 2013 5:02 PM > To: Igor Mammedov > Cc: ehabkost@redhat.com; qemu-devel@nongnu.org; armbru@redhat.com; anth= ony@codemonkey.ws; pbonzini@redhat.com; lcapitulino@redhat.com; Andreas F= =E4rber > Subject: Re: [Qemu-devel] [PATCH] qdev: Fix device_add bus assumptions >=20 > On Thu, 18 Apr 2013 10:41:56 +0200 > Igor Mammedov wrote: >=20 > [...] >>> - if (!bus) { >>> - bus =3D sysbus_get_default(); >>> - } >>> - >> I've checked all direct childs of TYPE_DEVICE and they all set k->bus_= type, >> with only one exception of TYPE_CPU. So it should be safe to remove fa= llback >> from qdev_device_add POV. >> However TYPE_CPU breaks assumption that device always has parent_bus = set >> to not NULL in qdev_unplug() and qdev_print() > Err, qdev_print() is safe since it's called on bus children only, so it= has > parent_bus. >=20 >> >> It would be better to add something like this: >> // untested >> >> diff --git a/hw/core/qdev.c b/hw/core/qdev.c >> index 4eb0134..45009ba 100644 >> --- a/hw/core/qdev.c >> +++ b/hw/core/qdev.c >> @@ -207,7 +207,7 @@ void qdev_unplug(DeviceState *dev, Error **errp) >> { >> DeviceClass *dc =3D DEVICE_GET_CLASS(dev); >> =20 >> - if (!dev->parent_bus->allow_hotplug) { >> + if (dev->parent_bus && !dev->parent_bus->allow_hotplug) { >> error_set(errp, QERR_BUS_NO_HOTPLUG, dev->parent_bus->name); >> return; >> } >> diff --git a/qdev-monitor.c b/qdev-monitor.c >> index 9a78ccf..2476e4e 100644 >> --- a/qdev-monitor.c >> +++ b/qdev-monitor.c >> @@ -557,7 +557,9 @@ static void qdev_print(Monitor *mon, DeviceState *= dev, >> int indent) qdev_print_props(mon, dev, DEVICE_CLASS(class)->props, ind= ent); >> class =3D object_class_get_parent(class); >> } while (class !=3D object_class_by_name(TYPE_DEVICE)); >> - bus_print_dev(dev->parent_bus, mon, dev, indent); >> + if (dev->parent_bus) { >> + bus_print_dev(dev->parent_bus, mon, dev, indent); >> + } >> QLIST_FOREACH(child, &dev->child_bus, sibling) { >> qbus_print(mon, child, indent); >> } >> >>> /* create device, set properties */ >>> qdev =3D DEVICE(object_new(driver)); >>> - qdev_set_parent_bus(qdev, bus); >>> + >>> + if (bus) { >>> + qdev_set_parent_bus(qdev, bus); >>> + } >>> =20 >>> id =3D qemu_opts_id(opts); >>> if (id) { >> >> >=20 >=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