From: Wei Wang2 <wei.wang2@amd.com>
To: xen-devel <xen-devel@lists.xensource.com>
Subject: [PATCH] AMD IOMMU: Fix a dead lock in device assignment.
Date: Tue, 13 Jan 2009 16:09:58 +0100 [thread overview]
Message-ID: <1231859398.3380.285.camel@gran.amd.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 466 bytes --]
Do not obtain pcidevs_lock in reassign_device() to avoid the dead lock.
Thanks,
Wei
Signed-off-by: Wei Wang <wei.wang2@amd.com>
--
AMD GmbH, Germany
Operating System Research Center
Legal Information:
Advanced Micro Devices GmbH
Karl-Hammerschmidt-Str. 34
85609 Dornach b. München
Geschäftsführer: Jochen Polster, Thomas M. McCoy, Giuliano Meroni
Sitz: Dornach, Gemeinde Aschheim, Landkreis München
Registergericht München, HRB Nr. 43632
[-- Attachment #2: deadlock.patch --]
[-- Type: text/x-patch, Size: 1269 bytes --]
diff -r 95d8788bf4be xen/drivers/passthrough/amd/pci_amd_iommu.c
--- a/xen/drivers/passthrough/amd/pci_amd_iommu.c Mon Jan 12 10:23:55 2009 +0000
+++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c Mon Jan 12 15:43:35 2009 +0100
@@ -271,26 +271,22 @@ static int reassign_device( struct domai
struct amd_iommu *iommu;
int bdf;
- spin_lock(&pcidevs_lock);
+ ASSERT(spin_is_locked(&pcidevs_lock));
pdev = pci_get_pdev_by_domain(source, bus, devfn);
if ( !pdev )
- {
- spin_unlock(&pcidevs_lock);
- return -ENODEV;
- }
+ return -ENODEV;
bdf = (bus << 8) | devfn;
/* supported device? */
iommu = (bdf < ivrs_bdf_entries) ?
- find_iommu_for_device(bus, pdev->devfn) : NULL;
+ find_iommu_for_device(bus, pdev->devfn) : NULL;
if ( !iommu )
{
- spin_unlock(&pcidevs_lock);
amd_iov_error("Fail to find iommu."
- " %x:%x.%x cannot be assigned to domain %d\n",
- bus, PCI_SLOT(devfn), PCI_FUNC(devfn), target->domain_id);
- return -ENODEV;
+ " %x:%x.%x cannot be assigned to domain %d\n",
+ bus, PCI_SLOT(devfn), PCI_FUNC(devfn), target->domain_id);
+ return -ENODEV;
}
amd_iommu_disable_domain_device(source, iommu, bdf);
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
reply other threads:[~2009-01-13 15:09 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1231859398.3380.285.camel@gran.amd.com \
--to=wei.wang2@amd.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.