Skip to content

Commit 4c6b974

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/[email protected]/ Acked-by: Jason Wang <[email protected]> Suggested-by: Eugenio Pérez <[email protected]> Reviewed-by: Eugenio Pérez <[email protected]> Signed-off-by: Dragos Tatulea <[email protected]> Message-Id: <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]> Reviewed-by: Si-Wei Liu <[email protected]> Tested-by: Si-Wei Liu <[email protected]> Tested-by: Lei Yang <[email protected]>
1 parent 512c0cd commit 4c6b974

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)