Skip to contentSkip to conversation

vdpa/mlx5: fix device unplug

PATCH Superseded Matan Azrad 2 participants 4 messages May 13, 2021 – May 18, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vdpa/mlx5: fix device unplug

The vDPA PCI device unplug proccess should release all the private device resources and also to unregister the device.

The device unregistration was missed what remained the device data invalid in the rte_vhost library.

Unregister the device in unplug proccess via the remove operation.

Fixes 95276abaaf0a ("vdpa/mlx5: introduce Mellanox vDPA driver")
---
 drivers/vdpa/mlx5/mlx5_vdpa.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/vdpa/mlx5/mlx5_vdpa.c +2 -0
index 40db28b6db..e5e03e6582 100644
@@ -787,6 +787,8 @@ mlx5_vdpa_pci_remove(struct rte_pci_device *pci_dev)
 			mlx5_glue->dv_free_var(priv->var);
 			priv->var = NULL;
 		}
+		if (priv->vdev)
+			rte_vdpa_unregister_device(priv->vdev);
 		mlx5_glue->close_device(priv->ctx);
 		pthread_mutex_destroy(&priv->vq_config_lock);
 		rte_free(priv);
Signature · 1 line
2.25.1
#1 lore raw

PATCH v2 1/1 vdpa/mlx5: fix device unplug

The vDPA PCI device unplug process should release all the private device resources and also to unregister the device.

The device unregistration was missed what remained the device data invalid in the rte_vhost library.

Unregister the device in unplug process via the remove operation.

Fixes 95276abaaf0a ("vdpa/mlx5: introduce Mellanox vDPA driver")
---
 drivers/vdpa/mlx5/mlx5_vdpa.c | 2 ++
 1 file changed, 2 insertions(+)

v2:
fix spelling and email format

drivers/vdpa/mlx5/mlx5_vdpa.c +2 -0
index 40db28b6db..e5e03e6582 100644
@@ -787,6 +787,8 @@ mlx5_vdpa_pci_remove(struct rte_pci_device *pci_dev)
 			mlx5_glue->dv_free_var(priv->var);
 			priv->var = NULL;
 		}
+		if (priv->vdev)
+			rte_vdpa_unregister_device(priv->vdev);
 		mlx5_glue->close_device(priv->ctx);
 		pthread_mutex_destroy(&priv->vq_config_lock);
 		rte_free(priv);
Signature · 1 line
2.25.1
Reviewed-by on v2 1/1
#2 lore raw
Quoted 44 lines

-----Original Message-----
From: stable <[email protected]> On Behalf Of Matan Azrad
Sent: Friday, May 14, 2021 2:40 AM
To: [email protected]
Cc: [email protected]; [email protected]; Eli Britstein <[email protected]>; Xueming Li <[email protected]>
Subject: [dpdk-stable] [PATCH v2] vdpa/mlx5: fix device unplug

The vDPA PCI device unplug process should release all the private device resources and also to unregister the device.

The device unregistration was missed what remained the device data invalid in the rte_vhost library.

Unregister the device in unplug process via the remove operation.

Fixes 95276abaaf0a ("vdpa/mlx5: introduce Mellanox vDPA driver")
---
 drivers/vdpa/mlx5/mlx5_vdpa.c | 2 ++
 1 file changed, 2 insertions(+)

v2:
fix spelling and email format

drivers/vdpa/mlx5/mlx5_vdpa.c +2 -1
index 40db28b6db..e5e03e6582 100644
@@ -787,6 +787,8 @@ mlx5_vdpa_pci_remove(struct rte_pci_device *pci_dev)
 			mlx5_glue->dv_free_var(priv->var);
 			priv->var = NULL;
 		}
+		if (priv->vdev)
+			rte_vdpa_unregister_device(priv->vdev);
 		mlx5_glue->close_device(priv->ctx);
 		pthread_mutex_destroy(&priv->vq_config_lock);
 		rte_free(priv);
--
Quoted 1 line

2.25.1

Applied
#3 lore raw
In reply to Matan Azrad
Quoted 19 lines

-----Original Message-----
From: stable <[email protected]> On Behalf Of Matan Azrad
Sent: Friday, May 14, 2021 2:40 AM
To: [email protected]
Cc: [email protected]; [email protected]; Eli Britstein <[email protected]>; Xueming Li <[email protected]>
Subject: [dpdk-stable] [PATCH v2] vdpa/mlx5: fix device unplug

The vDPA PCI device unplug process should release all the private device resources and also to unregister the device.

The device unregistration was missed what remained the device data invalid in the rte_vhost library.

Unregister the device in unplug process via the remove operation.

Fixes 95276abaaf0a ("vdpa/mlx5: introduce Mellanox vDPA driver")
Quoted 6 lines

---
2.25.1

Applied to next-virtio/main. Thanks.