diff mbox series

[v2] vdpa/mlx5: fix device unplug

Message ID 20210513184020.672589-1-matan@nvidia.com (mailing list archive)
State Accepted, archived
Delegated to: Maxime Coquelin
Headers show
Series [v2] vdpa/mlx5: fix device unplug | expand

Checks

Context Check Description
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-mellanox-Functional success Functional Testing PASS
ci/github-robot success github build: passed
ci/intel-Testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-abi-testing success Testing PASS
ci/iol-testing success Testing PASS
ci/checkpatch success coding style OK

Commit Message

Matan Azrad May 13, 2021, 6:40 p.m. UTC
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")
Cc: stable@dpdk.org

Reported-by: Eli Britstein <elibr@nvidia.com>
Signed-off-by: Matan Azrad <matan@nvidia.com>
Tested-by: Eli Britstein <elibr@nvidia.com>
Acked-by: Xueming Li <xuemingl@nvidia.com>
---
 drivers/vdpa/mlx5/mlx5_vdpa.c | 2 ++
 1 file changed, 2 insertions(+)

v2:
fix spelling and email format

Comments

Xia, Chenbo May 18, 2021, 8:24 a.m. UTC | #1
> -----Original Message-----
> From: stable <stable-bounces@dpdk.org> On Behalf Of Matan Azrad
> Sent: Friday, May 14, 2021 2:40 AM
> To: dev@dpdk.org
> Cc: maxime.coquelin@redhat.com; stable@dpdk.org; Eli Britstein
> <elibr@nvidia.com>; Xueming Li <xuemingl@nvidia.com>
> 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")
> Cc: stable@dpdk.org
> 
> Reported-by: Eli Britstein <elibr@nvidia.com>
> Signed-off-by: Matan Azrad <matan@nvidia.com>
> Tested-by: Eli Britstein <elibr@nvidia.com>
> Acked-by: Xueming Li <xuemingl@nvidia.com>
> ---
>  drivers/vdpa/mlx5/mlx5_vdpa.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> v2:
> fix spelling and email format
> 
> diff --git a/drivers/vdpa/mlx5/mlx5_vdpa.c b/drivers/vdpa/mlx5/mlx5_vdpa.c
> index 40db28b6db..e5e03e6582 100644
> --- a/drivers/vdpa/mlx5/mlx5_vdpa.c
> +++ b/drivers/vdpa/mlx5/mlx5_vdpa.c
> @@ -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);
> --
> 2.25.1

Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
Xia, Chenbo May 18, 2021, 8:27 a.m. UTC | #2
> -----Original Message-----
> From: stable <stable-bounces@dpdk.org> On Behalf Of Matan Azrad
> Sent: Friday, May 14, 2021 2:40 AM
> To: dev@dpdk.org
> Cc: maxime.coquelin@redhat.com; stable@dpdk.org; Eli Britstein
> <elibr@nvidia.com>; Xueming Li <xuemingl@nvidia.com>
> 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")
> Cc: stable@dpdk.org
> 
> Reported-by: Eli Britstein <elibr@nvidia.com>
> Signed-off-by: Matan Azrad <matan@nvidia.com>
> Tested-by: Eli Britstein <elibr@nvidia.com>
> Acked-by: Xueming Li <xuemingl@nvidia.com>
> ---
> 2.25.1

Applied to next-virtio/main. Thanks.
diff mbox series

Patch

diff --git a/drivers/vdpa/mlx5/mlx5_vdpa.c b/drivers/vdpa/mlx5/mlx5_vdpa.c
index 40db28b6db..e5e03e6582 100644
--- a/drivers/vdpa/mlx5/mlx5_vdpa.c
+++ b/drivers/vdpa/mlx5/mlx5_vdpa.c
@@ -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);