[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: |
Cornelia Huck |
Subject: |
Re: [PATCH Kernel v22 3/8] vfio iommu: Cache pgsize_bitmap in struct vfio_iommu |
Date: |
Wed, 20 May 2020 12:08:25 +0200 |
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().
> {
> 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>
- [PATCH Kernel v22 0/8] Add UAPIs to support migration for VFIO devices, Kirti Wankhede, 2020/05/18
- [PATCH Kernel v22 1/8] vfio: UAPI for migration interface for device state, Kirti Wankhede, 2020/05/18
- [PATCH Kernel v22 2/8] vfio iommu: Remove atomicity of ref_count of pinned pages, Kirti Wankhede, 2020/05/18
- [PATCH Kernel v22 3/8] vfio iommu: Cache pgsize_bitmap in struct vfio_iommu, Kirti Wankhede, 2020/05/18
- Re: [PATCH Kernel v22 3/8] vfio iommu: Cache pgsize_bitmap in struct vfio_iommu,
Cornelia Huck <=
- [PATCH Kernel v22 4/8] vfio iommu: Add ioctl definition for dirty pages tracking, Kirti Wankhede, 2020/05/18
- [PATCH Kernel v22 5/8] vfio iommu: Implementation of ioctl for dirty pages tracking, Kirti Wankhede, 2020/05/18
- [PATCH Kernel v22 6/8] vfio iommu: Update UNMAP_DMA ioctl to get dirty bitmap before unmap, Kirti Wankhede, 2020/05/18