From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:53884) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TbuMK-0003Px-1m for qemu-devel@nongnu.org; Fri, 23 Nov 2012 09:36:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TbuMC-0001fA-VL for qemu-devel@nongnu.org; Fri, 23 Nov 2012 09:35:59 -0500 Received: from e06smtp17.uk.ibm.com ([195.75.94.113]:46212) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TbuMC-0001ez-Mg for qemu-devel@nongnu.org; Fri, 23 Nov 2012 09:35:52 -0500 Received: from /spool/local by e06smtp17.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 23 Nov 2012 14:35:51 -0000 Received: from d06av11.portsmouth.uk.ibm.com (d06av11.portsmouth.uk.ibm.com [9.149.37.252]) by b06cxnps3075.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id qANEZfH34325726 for ; Fri, 23 Nov 2012 14:35:41 GMT Received: from d06av11.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av11.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id qANEZmBI020494 for ; Fri, 23 Nov 2012 07:35:49 -0700 Date: Fri, 23 Nov 2012 15:35:47 +0100 From: Cornelia Huck Message-ID: <20121123153547.54fe6c8e@BR9GNB5Z> In-Reply-To: <50AF845D.2070003@greensocs.com> References: <1353595852-30776-1-git-send-email-fred.konrad@greensocs.com> <1353595852-30776-2-git-send-email-fred.konrad@greensocs.com> <20121123130826.285c4d06@BR9GNB5Z> <50AF845D.2070003@greensocs.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC PATCH v2 1/3] virtio-bus : Introduce VirtioBus. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Konrad Frederic Cc: peter.maydell@linaro.org, aliguori@us.ibm.com, e.voevodin@samsung.com, mark.burton@greensocs.com, qemu-devel@nongnu.org, stefanha@redhat.com, afaerber@suse.de On Fri, 23 Nov 2012 15:12:45 +0100 Konrad Frederic wrote: > On 23/11/2012 13:08, Cornelia Huck wrote: > > On Thu, 22 Nov 2012 15:50:50 +0100 > > fred.konrad@greensocs.com wrote: > > > > > >> +/* Create a virtio bus. */ > >> +VirtioBus *virtio_bus_new(DeviceState *host, const VirtioBusInfo *info) > >> +{ > >> + /* > >> + * This is needed, as we want to have different names for each virtio-bus. > >> + * If we don't do that, we can't add more than one VirtIODevice. > >> + */ > >> + static int next_virtio_bus; > >> + char *bus_name = g_strdup_printf("virtio-bus.%d", next_virtio_bus++); > > This still has the overflow/id-reuse problem, hasn't it? > What do you mean by overflow problem ? If you do a lot of hotplugs (and hotunplugs), at some point next_virtio_bus will overflow and the code will start to create virtio-bus.. It's a bit of a pathological case, but I can see it happening on machines with lots of devices that change rapidly (such as somebody running a test script doing device_add/device_del). Maybe use something like the ida stuff the virtio kernel code is using (don't know whether something similar exists in qemu). > > > > >> + > >> + BusState *qbus = qbus_create(TYPE_VIRTIO_BUS, host, bus_name); > >> + VirtioBus *bus = VIRTIO_BUS(qbus); > >> + bus->info = info; > >> + qbus->allow_hotplug = 0; > >> + bus->bus_in_use = false; > >> + DPRINTF("%s bus created\n", bus_name); > >> + return bus; > >> +} > > Don't you need a way to destroy the bus again when the proxy device is > > hotunplugged? > > > Yes, you're right I must add a way to destroy the bus, and the devices > when the proxy is hot unplugged! > > Thanks, > > Fred >