Re: [PATCH V2] PCI: AER: fix deadlock in do_recovery

2017-10-05 Thread Wei Yang
On Thu, Oct 05, 2017 at 01:42:09PM -0500, Bjorn Helgaas wrote: >On Thu, Oct 05, 2017 at 11:05:12PM +0800, Wei Yang wrote: >> On Wed, Oct 4, 2017 at 5:15 AM, Bjorn Helgaas wrote: >> > [+cc Alex, Gavin, Wei] >> > >> > On Fri, Sep 29, 2017 at 10:49:38PM -0700, Govindarajulu Varadarajan wrote: >> >> C

Re: [PATCH V2] PCI: AER: fix deadlock in do_recovery

2017-10-05 Thread Bjorn Helgaas
On Thu, Oct 05, 2017 at 11:05:12PM +0800, Wei Yang wrote: > On Wed, Oct 4, 2017 at 5:15 AM, Bjorn Helgaas wrote: > > [+cc Alex, Gavin, Wei] > > > > On Fri, Sep 29, 2017 at 10:49:38PM -0700, Govindarajulu Varadarajan wrote: > >> CPU0 CPU1 > >> --

Re: [PATCH V2] PCI: AER: fix deadlock in do_recovery

2017-10-05 Thread Wei Yang
On Wed, Oct 4, 2017 at 5:15 AM, Bjorn Helgaas wrote: > [+cc Alex, Gavin, Wei] > > On Fri, Sep 29, 2017 at 10:49:38PM -0700, Govindarajulu Varadarajan wrote: >> CPU0 CPU1 >> - >> __driver_attach() >

Re: [PATCH V2] PCI: AER: fix deadlock in do_recovery

2017-10-03 Thread Bjorn Helgaas
[+cc Alex, Gavin, Wei] On Fri, Sep 29, 2017 at 10:49:38PM -0700, Govindarajulu Varadarajan wrote: > CPU0 CPU1 > - > __driver_attach() > device_lock(&dev->mutex) <--- device mutex lock here > driver

Re: [PATCH V2] PCI: AER: fix deadlock in do_recovery

2017-10-03 Thread Christoph Hellwig
On Mon, Oct 02, 2017 at 05:14:09PM -0700, Govindarajulu Varadarajan wrote: > > I would avoid increasing the size of pci_dev. The list_head would be empty > after > we call aer_pci_walk_bus(). We already have pci_bus *subordinate to link all > the > 'device's. Making list_head available to others

Re: [PATCH V2] PCI: AER: fix deadlock in do_recovery

2017-10-02 Thread Govindarajulu Varadarajan
On Sat, 30 Sep 2017, Sinan Kaya wrote: On 9/30/2017 1:49 AM, Govindarajulu Varadarajan wrote: This patch does a pci_bus_walk and adds all the devices to a list. After unlocking (up_read) &pci_bus_sem, we go through the list and call err_handler of the devices with devic_lock() held. This way, w

Re: [PATCH V2] PCI: AER: fix deadlock in do_recovery

2017-10-02 Thread Govindarajulu Varadarajan
On Sun, 1 Oct 2017, Christoph Hellwig wrote: +struct aer_device_list { + struct device *dev; + struct hlist_node node; +}; + extern struct bus_type pcie_port_bus_type; void aer_isr(struct work_struct *work); void aer_print_error(struct pci_dev *dev, struct aer_err_info *info); dif

Re: [PATCH V2] PCI: AER: fix deadlock in do_recovery

2017-10-01 Thread Christoph Hellwig
Can you please start with an explanation of the problem in text and cut down the cycle of involved functions to those actually relevant? That'll make reviewing the patch a bit easier.. > 2 files changed, 48 insertions(+), 2 deletions(-) > diff --git a/drivers/pci/pcie/aer/aerdrv.h b/drivers/pci

Re: [PATCH V2] PCI: AER: fix deadlock in do_recovery

2017-09-30 Thread Sinan Kaya
On 9/30/2017 1:49 AM, Govindarajulu Varadarajan wrote: > This patch does a pci_bus_walk and adds all the devices to a list. After > unlocking (up_read) &pci_bus_sem, we go through the list and call > err_handler of the devices with devic_lock() held. This way, we dont try > to hold both locks at sa

[PATCH V2] PCI: AER: fix deadlock in do_recovery

2017-09-29 Thread Govindarajulu Varadarajan
CPU0CPU1 - __driver_attach() device_lock(&dev->mutex) <--- device mutex lock here driver_probe_device() pci_enable_sriov() pci_iov_add_virtfn() pci_device_add()