DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/mlx5: fix DevX resources memory management.
@ 2020-11-24  8:10 Gregory Etelson
  2020-11-24 10:15 ` Matan Azrad
  0 siblings, 1 reply; 3+ messages in thread
From: Gregory Etelson @ 2020-11-24  8:10 UTC (permalink / raw)
  To: dev
  Cc: getelson, matan, rasland, thomas, Viacheslav Ovsiienko,
	Shahaf Shuler, Michael Baum

Invalid memory release order of DevX resources caused PMD crash.

1. SQ and CQ memory must be unregistered with DevX before it is freed.
2. SQ objects reference to a CQ ones. Hence, SQ should be destroyed in
   advance of CQ it references to.

Fixes: 6deb19e1b2d2 ("net/mlx5: separate Rx queue object creations")
Fixes: 88f2e3f18cc7 ("net/mlx5: rearrange SQ and CQ creation in DevX
module")

Signed-off-by: Gregory Etelson <getelson@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
---
 drivers/net/mlx5/mlx5_devx.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_devx.c b/drivers/net/mlx5/mlx5_devx.c
index 73ee147246..de9b204075 100644
--- a/drivers/net/mlx5/mlx5_devx.c
+++ b/drivers/net/mlx5/mlx5_devx.c
@@ -154,14 +154,14 @@ mlx5_rxq_release_devx_rq_resources(struct mlx5_rxq_ctrl *rxq_ctrl)
 {
 	struct mlx5_devx_dbr_page *dbr_page = rxq_ctrl->rq_dbrec_page;
 
-	if (rxq_ctrl->rxq.wqes) {
-		mlx5_free((void *)(uintptr_t)rxq_ctrl->rxq.wqes);
-		rxq_ctrl->rxq.wqes = NULL;
-	}
 	if (rxq_ctrl->wq_umem) {
 		mlx5_glue->devx_umem_dereg(rxq_ctrl->wq_umem);
 		rxq_ctrl->wq_umem = NULL;
 	}
+	if (rxq_ctrl->rxq.wqes) {
+		mlx5_free((void *)(uintptr_t)rxq_ctrl->rxq.wqes);
+		rxq_ctrl->rxq.wqes = NULL;
+	}
 	if (dbr_page) {
 		claim_zero(mlx5_release_dbr(&rxq_ctrl->priv->dbrpgs,
 					    mlx5_os_get_umem_id(dbr_page->umem),
@@ -181,14 +181,14 @@ mlx5_rxq_release_devx_cq_resources(struct mlx5_rxq_ctrl *rxq_ctrl)
 {
 	struct mlx5_devx_dbr_page *dbr_page = rxq_ctrl->cq_dbrec_page;
 
-	if (rxq_ctrl->rxq.cqes) {
-		rte_free((void *)(uintptr_t)rxq_ctrl->rxq.cqes);
-		rxq_ctrl->rxq.cqes = NULL;
-	}
 	if (rxq_ctrl->cq_umem) {
 		mlx5_glue->devx_umem_dereg(rxq_ctrl->cq_umem);
 		rxq_ctrl->cq_umem = NULL;
 	}
+	if (rxq_ctrl->rxq.cqes) {
+		rte_free((void *)(uintptr_t)rxq_ctrl->rxq.cqes);
+		rxq_ctrl->rxq.cqes = NULL;
+	}
 	if (dbr_page) {
 		claim_zero(mlx5_release_dbr(&rxq_ctrl->priv->dbrpgs,
 					    mlx5_os_get_umem_id(dbr_page->umem),
@@ -1174,8 +1174,8 @@ mlx5_txq_release_devx_cq_resources(struct mlx5_txq_obj *txq_obj)
 static void
 mlx5_txq_release_devx_resources(struct mlx5_txq_obj *txq_obj)
 {
-	mlx5_txq_release_devx_cq_resources(txq_obj);
 	mlx5_txq_release_devx_sq_resources(txq_obj);
+	mlx5_txq_release_devx_cq_resources(txq_obj);
 }
 
 /**
-- 
2.29.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] net/mlx5: fix DevX resources memory management.
  2020-11-24  8:10 [dpdk-dev] [PATCH] net/mlx5: fix DevX resources memory management Gregory Etelson
@ 2020-11-24 10:15 ` Matan Azrad
  2020-11-24 22:18   ` Thomas Monjalon
  0 siblings, 1 reply; 3+ messages in thread
From: Matan Azrad @ 2020-11-24 10:15 UTC (permalink / raw)
  To: Gregory Etelson, dev
  Cc: Raslan Darawsheh, NBU-Contact-Thomas Monjalon, Slava Ovsiienko,
	Shahaf Shuler, Michael Baum



From: Gregory Etelson
> Invalid memory release order of DevX resources caused PMD crash.
> 
> 1. SQ and CQ memory must be unregistered with DevX before it is freed.
> 2. SQ objects reference to a CQ ones. Hence, SQ should be destroyed in
>    advance of CQ it references to.
> 
> Fixes: 6deb19e1b2d2 ("net/mlx5: separate Rx queue object creations")
> Fixes: 88f2e3f18cc7 ("net/mlx5: rearrange SQ and CQ creation in DevX
> module")
> 
> Signed-off-by: Gregory Etelson <getelson@nvidia.com>
> Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] net/mlx5: fix DevX resources memory management.
  2020-11-24 10:15 ` Matan Azrad
@ 2020-11-24 22:18   ` Thomas Monjalon
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2020-11-24 22:18 UTC (permalink / raw)
  To: Gregory Etelson
  Cc: dev, Raslan Darawsheh, Slava Ovsiienko, Shahaf Shuler,
	Michael Baum, Matan Azrad, asafp

> > Invalid memory release order of DevX resources caused PMD crash.
> > 
> > 1. SQ and CQ memory must be unregistered with DevX before it is freed.
> > 2. SQ objects reference to a CQ ones. Hence, SQ should be destroyed in
> >    advance of CQ it references to.
> > 
> > Fixes: 6deb19e1b2d2 ("net/mlx5: separate Rx queue object creations")
> > Fixes: 88f2e3f18cc7 ("net/mlx5: rearrange SQ and CQ creation in DevX
> > module")
> > 
> > Signed-off-by: Gregory Etelson <getelson@nvidia.com>
> > Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
> Acked-by: Matan Azrad <matan@nvidia.com>

Applied, thanks



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-11-24 22:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-24  8:10 [dpdk-dev] [PATCH] net/mlx5: fix DevX resources memory management Gregory Etelson
2020-11-24 10:15 ` Matan Azrad
2020-11-24 22:18   ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).