Patch "vdpa/mlx5: Avoid destroying MR on empty iotlb" has been added to the 5.10-stable tree

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

 



This is a note to let you know that I've just added the patch titled

    vdpa/mlx5: Avoid destroying MR on empty iotlb

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     vdpa-mlx5-avoid-destroying-mr-on-empty-iotlb.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 8bc18ce78d58f28a029ad98894aa6dad07dfd555
Author: Eli Cohen <elic@xxxxxxxxxx>
Date:   Wed Aug 11 08:37:13 2021 +0300

    vdpa/mlx5: Avoid destroying MR on empty iotlb
    
    [ Upstream commit 08dbd5660232bede7916d8568003012c1182cc9a ]
    
    The current code treats an empty iotlb provdied in set_map() as a
    special case and destroy the memory region object. This must not be done
    since the virtqueue objects reference this MR. Doing so will cause the
    driver unload to emit errors and log timeouts caused by the firmware
    complaining on busy resources.
    
    This patch treats an empty iotlb as any other change of mapping. In this
    case, mlx5_vdpa_create_mr() will fail and the entire set_map() call to
    fail.
    
    This issue has not been encountered before but was seen to occur in a
    non-official version of qemu. Since qemu is a userspace program, the
    driver must protect against such case.
    
    Fixes: 94abbccdf291 ("vdpa/mlx5: Add shared memory registration code")
    Signed-off-by: Eli Cohen <elic@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20210811053713.66658-1-elic@xxxxxxxxxx
    Signed-off-by: Michael S. Tsirkin <mst@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/vdpa/mlx5/core/mr.c b/drivers/vdpa/mlx5/core/mr.c
index aa656f57bf5b..32c9925de473 100644
--- a/drivers/vdpa/mlx5/core/mr.c
+++ b/drivers/vdpa/mlx5/core/mr.c
@@ -454,11 +454,6 @@ out:
 	mutex_unlock(&mr->mkey_mtx);
 }
 
-static bool map_empty(struct vhost_iotlb *iotlb)
-{
-	return !vhost_iotlb_itree_first(iotlb, 0, U64_MAX);
-}
-
 int mlx5_vdpa_handle_set_map(struct mlx5_vdpa_dev *mvdev, struct vhost_iotlb *iotlb,
 			     bool *change_map)
 {
@@ -466,10 +461,6 @@ int mlx5_vdpa_handle_set_map(struct mlx5_vdpa_dev *mvdev, struct vhost_iotlb *io
 	int err = 0;
 
 	*change_map = false;
-	if (map_empty(iotlb)) {
-		mlx5_vdpa_destroy_mr(mvdev);
-		return 0;
-	}
 	mutex_lock(&mr->mkey_mtx);
 	if (mr->initialized) {
 		mlx5_vdpa_info(mvdev, "memory map update\n");



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux