qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH Kernel v22 3/8] vfio iommu: Cache pgsize_bitmap in struct vfi


From: Kirti Wankhede
Subject: Re: [PATCH Kernel v22 3/8] vfio iommu: Cache pgsize_bitmap in struct vfio_iommu
Date: Wed, 20 May 2020 20:16:16 +0530
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0



On 5/20/2020 3:38 PM, Cornelia Huck wrote:
On Mon, 18 May 2020 11:26:32 +0530
Kirti Wankhede <address@hidden> wrote:

Calculate and cache pgsize_bitmap when iommu->domain_list is updated
and iommu->external_domain is set for mdev device.
Add iommu->lock protection when cached pgsize_bitmap is accessed.

Signed-off-by: Kirti Wankhede <address@hidden>
Reviewed-by: Neo Jia <address@hidden>
---
  drivers/vfio/vfio_iommu_type1.c | 88 +++++++++++++++++++++++------------------
  1 file changed, 49 insertions(+), 39 deletions(-)


(...)

@@ -805,15 +806,14 @@ static void vfio_remove_dma(struct vfio_iommu *iommu, 
struct vfio_dma *dma)
        iommu->dma_avail++;
  }
-static unsigned long vfio_pgsize_bitmap(struct vfio_iommu *iommu)
+static void vfio_pgsize_bitmap(struct vfio_iommu *iommu)

Minor nit: I'd have renamed this function to
vfio_update_pgsize_bitmap().


Done.

  {
        struct vfio_domain *domain;
-       unsigned long bitmap = ULONG_MAX;
- mutex_lock(&iommu->lock);
+       iommu->pgsize_bitmap = ULONG_MAX;
+
        list_for_each_entry(domain, &iommu->domain_list, next)
-               bitmap &= domain->domain->pgsize_bitmap;
-       mutex_unlock(&iommu->lock);
+               iommu->pgsize_bitmap &= domain->domain->pgsize_bitmap;
/*
         * In case the IOMMU supports page sizes smaller than PAGE_SIZE

(...)

Reviewed-by: Cornelia Huck <address@hidden>


Thanks.

Kirti



reply via email to

[Prev in Thread] Current Thread [Next in Thread]