diff options
author | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2014-12-03 16:40:26 -0500 |
---|---|---|
committer | David Vrabel <david.vrabel@citrix.com> | 2014-12-04 12:41:58 +0000 |
commit | e8801a7418dda995a70f30874aef77e6d064828e (patch) | |
tree | ee4e691009b468c5397216b9e5776c6c239cc51e /drivers/xen/xen-pciback/xenbus.c | |
parent | 2c3fc8d26dd09b9d7069687eead849ee81c78e46 (diff) | |
download | blackbird-op-linux-e8801a7418dda995a70f30874aef77e6d064828e.tar.gz blackbird-op-linux-e8801a7418dda995a70f30874aef77e6d064828e.zip |
xen/pciback: Don't deadlock when unbinding.
As commit 0a9fd0152929db372ff61b0d6c280fdd34ae8bdb
'xen/pciback: Document the entry points for 'pcistub_put_pci_dev''
explained there are four entry points in this function.
Two of them are when the user fiddles in the SysFS to
unbind a device which might be in use by a guest or not.
Both 'unbind' states will cause a deadlock as the the PCI lock has
already been taken, which then pci_device_reset tries to take.
We can simplify this by requiring that all callers of
pcistub_put_pci_dev MUST hold the device lock. And then
we can just call the lockless version of pci_device_reset.
To make it even simpler we will modify xen_pcibk_release_pci_dev
to quality whether it should take a lock or not - as it ends
up calling xen_pcibk_release_pci_dev and needs to hold the lock.
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Diffstat (limited to 'drivers/xen/xen-pciback/xenbus.c')
-rw-r--r-- | drivers/xen/xen-pciback/xenbus.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/xen/xen-pciback/xenbus.c b/drivers/xen/xen-pciback/xenbus.c index ad8d30c088fe..eeee499d4b3c 100644 --- a/drivers/xen/xen-pciback/xenbus.c +++ b/drivers/xen/xen-pciback/xenbus.c @@ -291,7 +291,7 @@ static int xen_pcibk_remove_device(struct xen_pcibk_device *pdev, /* N.B. This ends up calling pcistub_put_pci_dev which ends up * doing the FLR. */ - xen_pcibk_release_pci_dev(pdev, dev); + xen_pcibk_release_pci_dev(pdev, dev, true /* use the lock. */); out: return err; |