[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 28.10.14 at 17:56, <konrad.wilk@xxxxxxxxxx> wrote:
> On Tue, Oct 28, 2014 at 04:25:16PM +0000, Jan Beulich wrote:
>> --- 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'.

But we're not after the psdev matching the incoming pdev.

> However I am not entirely sure what ought to be done if the VF is
> in _use_ ? Should we still do it?

Of course not (as being insecure) - that's what the !psdev->pdev
check is there for.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.