Re: [PATCH] qemu: Fix PCI address allocation

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

 



> > 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.
> 
> > -    for (i = addrs->nextslot ; i <= QEMU_PCI_ADDRESS_LAST_SLOT ; i++) {
> > +    for (i = 0 ; i <= QEMU_PCI_ADDRESS_LAST_SLOT ; i++) {
> 
> Don't we still want to start from the last slot, and wrap around the
> search only when we reach the end, rather than always starting from 0?
> I'm thinking particularly about compatibility with older qemu, where
> always starting from 0 risks interleaving new assignments among the
> pre-assigned slots, and may end up allocating slots in a way that throws
> off Windows.  Or am I worried about a non-issue?

TBH I don't know. If qemu can get upset about it, we probably can't change the
logic at all. Or at the best we can have it variable depending on qemu
version. So if someone knows better if we can safely change this or not, that
would be great. (too bad Daniel is on vacation)

Anyway, going from the nextslot and wrapping wouldn't really help with this
situation. It would only postpone the possible compatibility issues until
nextslot wraps around.

Jirka

--
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]