]> git.baikalelectronics.ru Git - kernel.git/commit
vdpa/mlx5: Avoid destroying MR on empty iotlb
authorEli Cohen <elic@nvidia.com>
Wed, 11 Aug 2021 05:37:13 +0000 (08:37 +0300)
committerMichael S. Tsirkin <mst@redhat.com>
Wed, 11 Aug 2021 10:44:41 +0000 (06:44 -0400)
commit7e71e59f720f7fb528e6b71335c99e8d2206178e
treeb4c941cd0b0622dc517aa346f4ae86bbe668e105
parent41f59b26825f5e7633ee9dc67a6f3aebf4641f47
vdpa/mlx5: Avoid destroying MR on empty iotlb

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: ffc75a8bcf18 ("vdpa/mlx5: Add shared memory registration code")
Signed-off-by: Eli Cohen <elic@nvidia.com>
Link: https://lore.kernel.org/r/20210811053713.66658-1-elic@nvidia.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
drivers/vdpa/mlx5/core/mr.c