qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Cornelia Huck <cornelia.huck@de.ibm.com>
To: Konrad Frederic <fred.konrad@greensocs.com>
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
Subject: Re: [Qemu-devel] [RFC PATCH v2 1/3] virtio-bus : Introduce VirtioBus.
Date: Fri, 23 Nov 2012 15:35:47 +0100	[thread overview]
Message-ID: <20121123153547.54fe6c8e@BR9GNB5Z> (raw)
In-Reply-To: <50AF845D.2070003@greensocs.com>

On Fri, 23 Nov 2012 15:12:45 +0100
Konrad Frederic <fred.konrad@greensocs.com> 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.<existing number>. 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
> 

  reply	other threads:[~2012-11-23 14:36 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-22 14:50 [Qemu-devel] [RFC PATCH v2 0/3] Virtio-refactoring fred.konrad
2012-11-22 14:50 ` [Qemu-devel] [RFC PATCH v2 1/3] virtio-bus : Introduce VirtioBus fred.konrad
2012-11-23 12:08   ` Cornelia Huck
2012-11-23 14:12     ` Konrad Frederic
2012-11-23 14:35       ` Cornelia Huck [this message]
2012-11-26 13:55     ` Konrad Frederic
2012-11-26 14:03       ` Cornelia Huck
2012-11-23 12:23   ` Stefan Hajnoczi
2012-11-23 14:21     ` Konrad Frederic
2012-11-23 16:13       ` Stefan Hajnoczi
2012-11-24 22:29   ` Andreas Färber
2012-11-26 14:33   ` Anthony Liguori
2012-11-26 14:37     ` Peter Maydell
2012-11-26 16:59       ` Anthony Liguori
2012-11-29 12:37         ` Konrad Frederic
2012-11-29 13:09           ` Peter Maydell
2012-11-29 13:47             ` Konrad Frederic
2012-11-29 13:53               ` Peter Maydell
2012-11-29 13:55               ` Andreas Färber
2012-11-29 14:28                 ` Konrad Frederic
2012-11-29 13:52           ` Anthony Liguori
2012-11-26 14:45     ` Andreas Färber
2012-11-26 16:55       ` Anthony Liguori
2012-11-26 15:33     ` Konrad Frederic
2012-11-26 15:40     ` Stefan Hajnoczi
2012-11-22 14:50 ` [Qemu-devel] [RFC PATCH v2 2/3] virtio-pci : add a virtio-bus interface fred.konrad
2012-11-23 12:11   ` Cornelia Huck
2012-11-23 12:29   ` Stefan Hajnoczi
2012-11-23 12:34     ` Peter Maydell
2012-11-23 14:23       ` Konrad Frederic
2012-11-23 14:26         ` Peter Maydell
2012-11-23 14:33           ` Konrad Frederic
2012-11-26 14:43   ` Anthony Liguori
2012-11-22 14:50 ` [Qemu-devel] [RFC PATCH v2 3/3] virtio-blk : add the virtio-blk device fred.konrad
2012-11-23 12:32   ` Stefan Hajnoczi
2012-11-22 15:08 ` [Qemu-devel] [RFC PATCH v2 0/3] Virtio-refactoring Peter Maydell
2012-11-22 15:15   ` KONRAD Frédéric
2012-11-23 12:38 ` Stefan Hajnoczi
2012-11-23 14:29   ` Konrad Frederic
2012-11-23 16:18     ` Stefan Hajnoczi
2012-11-26  9:00       ` Konrad Frederic

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121123153547.54fe6c8e@BR9GNB5Z \
    --to=cornelia.huck@de.ibm.com \
    --cc=afaerber@suse.de \
    --cc=aliguori@us.ibm.com \
    --cc=e.voevodin@samsung.com \
    --cc=fred.konrad@greensocs.com \
    --cc=mark.burton@greensocs.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).