[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen master] IOMMU/x86: drop locking from quarantine_init() hooks



commit 02b0e2d0303869a222bb8c2a888756394e99d15b
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Wed Apr 20 10:52:13 2022 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Apr 20 10:52:13 2022 +0200

    IOMMU/x86: drop locking from quarantine_init() hooks
    
    Prior extension of these functions to enable per-device quarantine page
    tables already didn't add more locking there, but merely left in place
    what had been there before. But really locking is unnecessary here:
    We're running with pcidevs_lock held (i.e. multiple invocations of the
    same function [or their teardown equivalents] are impossible, and hence
    there are no "local" races), while all consuming of the data being
    populated here can't race anyway due to happening sequentially
    afterwards, and unlike ordinary domains' page tables quarantine ones
    are never modified once fully constructed. See also the comment in
    struct arch_pci_dev.
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
    Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx>
---
 xen/drivers/passthrough/amd/iommu_map.c | 4 ----
 xen/drivers/passthrough/vtd/iommu.c     | 4 ----
 2 files changed, 8 deletions(-)

diff --git a/xen/drivers/passthrough/amd/iommu_map.c 
b/xen/drivers/passthrough/amd/iommu_map.c
index 1f5eae9b7d..6d42bcea0e 100644
--- a/xen/drivers/passthrough/amd/iommu_map.c
+++ b/xen/drivers/passthrough/amd/iommu_map.c
@@ -699,15 +699,11 @@ int cf_check amd_iommu_quarantine_init(struct pci_dev 
*pdev, bool scratch_page)
         union amd_iommu_pte *root;
         struct page_info *pgs[IOMMU_MAX_PT_LEVELS] = {};
 
-        spin_lock(&hd->arch.mapping_lock);
-
         root = __map_domain_page(pdev->arch.amd.root_table);
         rc = fill_qpt(root, level - 1, pgs);
         unmap_domain_page(root);
 
         pdev->arch.leaf_mfn = page_to_mfn(pgs[0]);
-
-        spin_unlock(&hd->arch.mapping_lock);
     }
 
     page_list_move(&pdev->arch.pgtables_list, &hd->arch.pgtables.list);
diff --git a/xen/drivers/passthrough/vtd/iommu.c 
b/xen/drivers/passthrough/vtd/iommu.c
index 42b76af73f..dbff56fe6a 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -3054,15 +3054,11 @@ static int cf_check intel_iommu_quarantine_init(struct 
pci_dev *pdev,
         struct dma_pte *root;
         struct page_info *pgs[6] = {};
 
-        spin_lock(&hd->arch.mapping_lock);
-
         root = map_vtd_domain_page(pdev->arch.vtd.pgd_maddr);
         rc = fill_qpt(root, level - 1, pgs);
         unmap_vtd_domain_page(root);
 
         pdev->arch.leaf_mfn = page_to_mfn(pgs[0]);
-
-        spin_unlock(&hd->arch.mapping_lock);
     }
 
     page_list_move(&pdev->arch.pgtables_list, &hd->arch.pgtables.list);
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.