Skip to content

Commit f67ad6c

Browse files
dtatuleamstsirkin
authored andcommitted
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: Jason Wang <jasowang@redhat.com> Suggested-by: Eugenio Pérez <eperezma@redhat.com> Reviewed-by: Eugenio Pérez <eperezma@redhat.com> Signed-off-by: Dragos Tatulea <dtatulea@nvidia.com> Message-Id: <20231018171456.1624030-9-dtatulea@nvidia.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
1 parent ef72e58 commit f67ad6c

File tree

1 file changed

+9
-1
lines changed
  • drivers/vdpa/mlx5/core

1 file changed

+9
-1
lines changed

drivers/vdpa/mlx5/core/mr.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,11 +590,19 @@ int mlx5_vdpa_update_cvq_iotlb(struct mlx5_vdpa_dev *mvdev,
590590
struct vhost_iotlb *iotlb,
591591
unsigned int asid)
592592
{
593+
int err;
594+
593595
if (mvdev->group2asid[MLX5_VDPA_CVQ_GROUP] != asid)
594596
return 0;
595597

598+
spin_lock(&mvdev->cvq.iommu_lock);
599+
596600
prune_iotlb(mvdev);
597-
return dup_iotlb(mvdev, iotlb);
601+
err = dup_iotlb(mvdev, iotlb);
602+
603+
spin_unlock(&mvdev->cvq.iommu_lock);
604+
605+
return err;
598606
}
599607

600608
int mlx5_vdpa_create_dma_mr(struct mlx5_vdpa_dev *mvdev)

0 commit comments

Comments
 (0)