Re: [libvirt] [PATCH 06/13] Rewrite way QEMU PCI addresses are allocated

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Feb 01, 2010 at 06:39:35PM +0000, Daniel P. Berrange wrote:
> The current QEMU code allocates PCI addresses incrementally starting
> at 4. This is not satisfactory because the user may have given some
> addresses in their XML config, which need to be skipped over when
> allocating addresses to remaining devices.

  Ah, right !

> It is thus neccessary to maintain a list of already allocated PCI
> addresses and then only allocate ones that remain unused. This is
> also required for domain device hotplug to work properly later.
> 
> * src/qemu/qemu_conf.c, src/qemu/qemu_conf.h: Add APIs for creating
>   list of existing PCI addresses, and allocating new addresses.
>   Refactor address assignment to use this code
> * src/qemu/qemu_driver.c: Pull PCI address assignment up into the
>   qemuStartVMDaemon() method, as a prelude to moving it into the
>   'define' method. Update list of allocated addresses when connecting
>   to a running VM at daemon startup.
> * tests/qemuxml2argvtest.c, tests/qemuargv2xmltest.c,
>   tests/qemuxml2xmltest.c: Remove USB product test since all
>   passthrough is done based on address
> * tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-product.args,
>   tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-product.xml: Kil
>   unused data files
[...]

> +    addr = qemuPCIAddressAsString(&dev);
> +    if (!addr)
> +        return -1;
> +
> +    if (virHashLookup(addrs->used, addr)) {
> +        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
> +                         _("unable to reserve PCI address %s"), addr);
> +        VIR_FREE(addr);
> +        return -1;
> +    }
> +
> +    if (virHashAddEntry(addrs->used, addr, addr)) {
> +        VIR_FREE(addr);
> +        return -1;
> +    }

  is using a hash table really that simpler in that case ? I doubt we
need an optimized lookup, and this mean always saving to a standardized
string to then do string comparisons instead of directly checking
domain/bus/slot values. But that's a minor point.

ACK,

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel@xxxxxxxxxxxx  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]