]> git.baikalelectronics.ru Git - kernel.git/commit
xen/pciback: Don't deadlock when unbinding.
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Wed, 3 Dec 2014 21:40:26 +0000 (16:40 -0500)
committerDavid Vrabel <david.vrabel@citrix.com>
Thu, 4 Dec 2014 12:41:58 +0000 (12:41 +0000)
commit59d62463fe2ff8635e8533c5d60c97a68f3fe5c2
treeee4e691009b468c5397216b9e5776c6c239cc51e
parente7ba97ccef680a64b5c22f457267781c20211c5f
xen/pciback: Don't deadlock when unbinding.

As commit e9a65a972e9f9955fc8ef232692eeffdd35eb8c5
'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>
drivers/xen/xen-pciback/passthrough.c
drivers/xen/xen-pciback/pci_stub.c
drivers/xen/xen-pciback/pciback.h
drivers/xen/xen-pciback/vpci.c
drivers/xen/xen-pciback/xenbus.c