Message ID | CAE5WV7OXKGvOCTOyZyK5cOCA2nxpN1WcDdqj9h+pakyhgT2sTA@mail.gmail.com (mailing list archive) |
---|---|
State | New, archived |
Delegated to: | Bjorn Helgaas |
Headers | show |
On Thu, Oct 24, 2013 at 09:52:31AM +0300, Niilona wrote: > Hi. > > As Bjorn Helgaas recommend, this might be the item to discuss in the wider area. > ----------------------------------- > > There is a behavior effecting virtfn -entries in sysfs, when amount of > them increases over 10. > Run VM's through LIBVIRT -> QEMU/KVM, this causes : > - MAC address setting by LIBVIRT disordered ie. setting targeted to wrong VF. > - VLAN setting by LIBVIRT overall failed > > Basics of this are in "/libvirt-x.x.x/src/util/virpci.c" ; in function below, > which don't order virtfn entries correctly. > > /* > * Returns virtual functions of a physical function > */ > int > virPCIGetVirtualFunctions(const char *sysfs_path, > virPCIDeviceAddressPtr **virtual_functions, > unsigned int *num_virtual_functions) > { > > But I let you to decide which is best way to fix this, as if every > application reads "virtfn" entries from PF's directory, they all need > to sort entries in alphabet. order to avoid this > influence. > So personally I did get over this by adding pre-zeroes to names to > have them in sorted order in PF's directory. Libvirt has to work correctly with all existing released kernels, so we have to fix libvirt to deal with ordering correctly. Thus changing the kernel naming here doesn't really help. We need to fix libvirt to deal with this. Daniel
diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c index 21a7182..fbd1209 100644 --- a/drivers/pci/iov.c +++ b/drivers/pci/iov.c @@ -106,7 +106,7 @@ static int virtfn_add(struct pci_dev *dev, int id, int reset) mutex_unlock(&iov->dev->sriov->lock); rc = pci_bus_add_device(virtfn); - sprintf(buf, "virtfn%u", id); + sprintf(buf, "virtfn%02u", id); rc = sysfs_create_link(&dev->dev.kobj, &virtfn->dev.kobj, buf); if (rc)