[libvirt] [PATCH] qemu: Fix PCI address allocation
Chris Lalancette
clalance at redhat.com
Fri Jul 30 15:13:28 UTC 2010
On 07/30/10 - 04:56:47PM, Jiri Denemark wrote:
> When attaching a PCI device which doesn't explicitly set its PCI
> address, libvirt allocates the address automatically. The problem is
> that when checking which PCI address is unused, we only check for those
> with slot number higher than the highest slot number ever used.
>
> Thus attaching/detaching such device several times in a row (31 is the
> theoretical limit, less then 30 tries are enough in practise) makes any
> further device attachment fail. Furthermore, attaching a device with
> predefined PCI address to 0:0:31 immediately forbids attachment of any
> PCI device without explicit address.
>
> This patch changes the logic so that we always check all PCI addresses
> before we say there is no PCI address available.
Yes, makes perfect sense. Most of the patch is adding VIR_DEBUG() lines
and removing the "nextslot"; the real change is this line:
> @@ -2217,7 +2212,7 @@ int qemuDomainPCIAddressSetNextAddr(qemuDomainPCIAddressSetPtr addrs,
> {
> int i;
>
> - for (i = addrs->nextslot ; i <= QEMU_PCI_ADDRESS_LAST_SLOT ; i++) {
> + for (i = 0 ; i <= QEMU_PCI_ADDRESS_LAST_SLOT ; i++) {
> virDomainDeviceInfo maybe;
> char *addr;
>
ACK
--
Chris Lalancette
More information about the libvir-list
mailing list