[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] xl/SR-IOV: disposition of VFs when PF disappears?
On Tue, Oct 28, 2014 at 04:25:16PM +0000, Jan Beulich wrote: > >>> On 28.10.14 at 16:18, <JBeulich@xxxxxxxx> wrote: > > That flag doesn't inhibit the PF driver unloading. It only suppresses > > it freeing the VFs in that process (and afaics nothing will ever allow > > them to be released subsequently in that case). I'm about to test a > > change to pciback (it's building right now). > > Attached a raw patch for you or anyone else to comment on from > a conceptual perspective. The main thing probably is to determine > whether any further serialization needs to be added. > > Jan > > --- sle12.orig/drivers/xen/xen-pciback/pci_stub.c > +++ sle12/drivers/xen/xen-pciback/pci_stub.c > @@ -1502,6 +1502,44 @@ parse_error: > fs_initcall(pcistub_init); > #endif > > +#ifdef CONFIG_PCI_IOV > +static int pci_stub_notifier(struct notifier_block *nb, > + unsigned long action, void *data) > +{ > + struct device *dev = data; > + struct pci_dev *pdev = to_pci_dev(dev); > + > + switch (action) { > + case BUS_NOTIFY_UNBIND_DRIVER: > + for (;;) { > + struct pcistub_device *psdev; > + unsigned long flags; > + bool found = false; > + > + spin_lock_irqsave(&pcistub_devices_lock, flags); > + > + list_for_each_entry(psdev, &pcistub_devices, dev_list) > + if (!psdev->pdev && psdev->dev != pdev > + && pci_physfn(psdev->dev) == pdev) { > + found = true; > + break; > + } > + spin_unlock_irqrestore(&pcistub_devices_lock, flags); There are existing functions in the PCI back driver to find an device based on the 'struct pci_dev'. That should make this piece of code much simpler by just looking for it and if found call the 'device_release_driver'. However I am not entirely sure what ought to be done if the VF is in _use_ ? Should we still do it? > + if (!found) > + break; > + device_release_driver(&psdev->dev->dev); > + } > + break; > + } > + > + return NOTIFY_DONE; > +} > + > +static struct notifier_block pci_stub_nb = { > + .notifier_call = pci_stub_notifier, > +}; > +#endif > + > static int __init xen_pcibk_init(void) > { > int err; > @@ -1523,6 +1561,10 @@ static int __init xen_pcibk_init(void) > err = xen_pcibk_xenbus_register(); > if (err) > pcistub_exit(); > +#ifdef CONFIG_PCI_IOV > + else > + bus_register_notifier(&pci_bus_type, &pci_stub_nb); > +#endif > > return err; > } _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |