Re: [PATCH 4/5] PCI/IOV: simplify code by hotplug safe pci_get_domain_bus_and_slot()

2012-09-21 Thread Yinghai Lu
On Fri, Sep 21, 2012 at 7:15 AM, Don Dutile wrote: > On 09/21/2012 02:22 AM, Yinghai Lu wrote: >> >> On Thu, Sep 20, 2012 at 7:56 PM, Bjorn Helgaas >> wrote: >>> >>> This is another thing I'm curious about. How do you handle this >>> situation today (before host bridge hot-add)? >>> >>> The DMAR

Re: [PATCH 4/5] PCI/IOV: simplify code by hotplug safe pci_get_domain_bus_and_slot()

2012-09-21 Thread Don Dutile
On 09/21/2012 02:22 AM, Yinghai Lu wrote: On Thu, Sep 20, 2012 at 7:56 PM, Bjorn Helgaas wrote: This is another thing I'm curious about. How do you handle this situation today (before host bridge hot-add)? The DMAR I'm not so worried about because as far as I know, there's no such thing as a

Re: [PATCH 4/5] PCI/IOV: simplify code by hotplug safe pci_get_domain_bus_and_slot()

2012-09-20 Thread Yinghai Lu
On Thu, Sep 20, 2012 at 7:56 PM, Bjorn Helgaas wrote: > This is another thing I'm curious about. How do you handle this > situation today (before host bridge hot-add)? > > The DMAR I'm not so worried about because as far as I know, there's no > such thing as a DMAR that's discovered by PCI enumer

Re: [PATCH 4/5] PCI/IOV: simplify code by hotplug safe pci_get_domain_bus_and_slot()

2012-09-20 Thread Bjorn Helgaas
On Thu, Sep 20, 2012 at 7:51 PM, Yinghai Lu wrote: > On Thu, Sep 20, 2012 at 4:59 PM, Bjorn Helgaas wrote: >> On Thu, Sep 20, 2012 at 2:38 PM, Yinghai Lu wrote: >>> in that case, VFs are stopped before PF, so they are not in device >>> tree anymore. >>> so pci_get_domain_bus_and_slot will not f

Re: [PATCH 4/5] PCI/IOV: simplify code by hotplug safe pci_get_domain_bus_and_slot()

2012-09-20 Thread Yinghai Lu
On Thu, Sep 20, 2012 at 4:59 PM, Bjorn Helgaas wrote: > On Thu, Sep 20, 2012 at 2:38 PM, Yinghai Lu wrote: >> in that case, VFs are stopped before PF, so they are not in device >> tree anymore. >> so pci_get_domain_bus_and_slot will not find those VFs. >> >> So the reference to PF is not release

Re: [PATCH 4/5] PCI/IOV: simplify code by hotplug safe pci_get_domain_bus_and_slot()

2012-09-20 Thread Jiang Liu
On 09/21/2012 07:59 AM, Bjorn Helgaas wrote: > On Thu, Sep 20, 2012 at 2:38 PM, Yinghai Lu wrote: >> On Tue, Aug 28, 2012 at 8:43 AM, Jiang Liu wrote: >>> Following code has a race window between pci_find_bus() and pci_get_slot() >>> if PCI hotplug operation happens between them which removes the

Re: [PATCH 4/5] PCI/IOV: simplify code by hotplug safe pci_get_domain_bus_and_slot()

2012-09-20 Thread Bjorn Helgaas
On Thu, Sep 20, 2012 at 2:38 PM, Yinghai Lu wrote: > On Tue, Aug 28, 2012 at 8:43 AM, Jiang Liu wrote: >> Following code has a race window between pci_find_bus() and pci_get_slot() >> if PCI hotplug operation happens between them which removes the pci_bus. >> So use PCI hotplug safe interface pci

Re: [PATCH 4/5] PCI/IOV: simplify code by hotplug safe pci_get_domain_bus_and_slot()

2012-09-20 Thread Yinghai Lu
On Tue, Aug 28, 2012 at 8:43 AM, Jiang Liu wrote: > Following code has a race window between pci_find_bus() and pci_get_slot() > if PCI hotplug operation happens between them which removes the pci_bus. > So use PCI hotplug safe interface pci_get_domain_bus_and_slot() instead, > which also reduces

[PATCH 4/5] PCI/IOV: simplify code by hotplug safe pci_get_domain_bus_and_slot()

2012-08-28 Thread Jiang Liu
Following code has a race window between pci_find_bus() and pci_get_slot() if PCI hotplug operation happens between them which removes the pci_bus. So use PCI hotplug safe interface pci_get_domain_bus_and_slot() instead, which also reduces code complexity. struct pci_bus *pci_bus = pci_find_bus(do