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

Re: [libvirt] [PATCH] qemu: Fix PCI address allocation



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


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