Commit 4c6b9741 authored by Dragos Tatulea's avatar Dragos Tatulea Committed by Michael S. Tsirkin
Browse files

vdpa/mlx5: Take cvq iotlb lock during refresh

The reslock is taken while refresh is called but iommu_lock is more
specific to this resource. So take the iommu_lock during cvq iotlb
refresh.

Based on Eugenio's patch [0].

[0] https://lore.kernel.org/lkml/20230112142218.725622-4-eperezma@redhat.com/



Acked-by: default avatarJason Wang <jasowang@redhat.com>
Suggested-by: default avatarEugenio Pérez <eperezma@redhat.com>
Reviewed-by: default avatarEugenio Pérez <eperezma@redhat.com>
Signed-off-by: default avatarDragos Tatulea <dtatulea@nvidia.com>
Message-Id: <20231018171456.1624030-9-dtatulea@nvidia.com>
Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Reviewed-by: default avatarSi-Wei Liu <si-wei.liu@oracle.com>
Tested-by: default avatarSi-Wei Liu <si-wei.liu@oracle.com>
Tested-by: default avatarLei Yang <leiyang@redhat.com>
parent 512c0cdd
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -590,11 +590,19 @@ int mlx5_vdpa_update_cvq_iotlb(struct mlx5_vdpa_dev *mvdev,
				struct vhost_iotlb *iotlb,
				unsigned int asid)
{
	int err;

	if (mvdev->group2asid[MLX5_VDPA_CVQ_GROUP] != asid)
		return 0;

	spin_lock(&mvdev->cvq.iommu_lock);

	prune_iotlb(mvdev);
	return dup_iotlb(mvdev, iotlb);
	err = dup_iotlb(mvdev, iotlb);

	spin_unlock(&mvdev->cvq.iommu_lock);

	return err;
}

int mlx5_vdpa_create_dma_mr(struct mlx5_vdpa_dev *mvdev)