DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH v1] mempool/cnxk: destroy NPA pool only if its created
@ 2022-11-08  6:18 Ashwin Sekhar T K
  2022-11-08  6:41 ` [PATCH v2] " Ashwin Sekhar T K
  2022-11-08  6:55 ` [PATCH v3] mempool/cnxk: fix mempool destroy for empty pools Ashwin Sekhar T K
  0 siblings, 2 replies; 4+ messages in thread
From: Ashwin Sekhar T K @ 2022-11-08  6:18 UTC (permalink / raw)
  To: dev, Ashwin Sekhar T K, Pavan Nikhilesh
  Cc: jerinj, skori, skoteshwar, kirankumark, psatheesh, anoobj,
	gakhil, hkalra, ndabilpuram

In scenarios where rte_mempool_free() is called immediately
after rte_mempool_create_empty(), the NPA pool will not be
created. In such cases the free path should not call
roc_npa_pool_destroy().

Signed-off-by: Ashwin Sekhar T K <asekhar@marvell.com>
---
 drivers/mempool/cnxk/cnxk_mempool_ops.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/mempool/cnxk/cnxk_mempool_ops.c b/drivers/mempool/cnxk/cnxk_mempool_ops.c
index a0b94bb95c..e3026136cf 100644
--- a/drivers/mempool/cnxk/cnxk_mempool_ops.c
+++ b/drivers/mempool/cnxk/cnxk_mempool_ops.c
@@ -126,6 +126,14 @@ cnxk_mempool_free(struct rte_mempool *mp)
 	int rc = 0;
 
 	plt_npa_dbg("aura_handle=0x%" PRIx64, mp->pool_id);
+
+	/* It can happen that rte_mempool_free() is called immediately after
+	 * rte_mempool_create_empty(). In such cases the NPA pool will not be
+	 * allocated.
+	 */
+	if (roc_npa_aura_handle_to_base(mp->pool_id) == NULL)
+		return;
+
 	rc = roc_npa_pool_destroy(mp->pool_id);
 	if (rc)
 		plt_err("Failed to free pool or aura rc=%d", rc);
-- 
2.25.1


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

* [PATCH v2] mempool/cnxk: destroy NPA pool only if its created
  2022-11-08  6:18 [PATCH v1] mempool/cnxk: destroy NPA pool only if its created Ashwin Sekhar T K
@ 2022-11-08  6:41 ` Ashwin Sekhar T K
  2022-11-08  6:55 ` [PATCH v3] mempool/cnxk: fix mempool destroy for empty pools Ashwin Sekhar T K
  1 sibling, 0 replies; 4+ messages in thread
From: Ashwin Sekhar T K @ 2022-11-08  6:41 UTC (permalink / raw)
  To: dev, Ashwin Sekhar T K, Pavan Nikhilesh
  Cc: jerinj, skori, skoteshwar, kirankumark, psatheesh, anoobj,
	gakhil, hkalra, ndabilpuram

In scenarios where rte_mempool_free() is called immediately
after rte_mempool_create_empty(), the NPA pool will not be
created. In such cases the free path should not call
roc_npa_pool_destroy().

Signed-off-by: Ashwin Sekhar T K <asekhar@marvell.com>
---
 drivers/mempool/cnxk/cnxk_mempool_ops.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/mempool/cnxk/cnxk_mempool_ops.c b/drivers/mempool/cnxk/cnxk_mempool_ops.c
index a0b94bb95c..3769afd3d1 100644
--- a/drivers/mempool/cnxk/cnxk_mempool_ops.c
+++ b/drivers/mempool/cnxk/cnxk_mempool_ops.c
@@ -126,6 +126,14 @@ cnxk_mempool_free(struct rte_mempool *mp)
 	int rc = 0;
 
 	plt_npa_dbg("aura_handle=0x%" PRIx64, mp->pool_id);
+
+	/* It can happen that rte_mempool_free() is called immediately after
+	 * rte_mempool_create_empty(). In such cases the NPA pool will not be
+	 * allocated.
+	 */
+	if (roc_npa_aura_handle_to_base(mp->pool_id) == 0)
+		return;
+
 	rc = roc_npa_pool_destroy(mp->pool_id);
 	if (rc)
 		plt_err("Failed to free pool or aura rc=%d", rc);
-- 
2.25.1


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

* [PATCH v3] mempool/cnxk: fix mempool destroy for empty pools
  2022-11-08  6:18 [PATCH v1] mempool/cnxk: destroy NPA pool only if its created Ashwin Sekhar T K
  2022-11-08  6:41 ` [PATCH v2] " Ashwin Sekhar T K
@ 2022-11-08  6:55 ` Ashwin Sekhar T K
  2022-11-15  3:24   ` Thomas Monjalon
  1 sibling, 1 reply; 4+ messages in thread
From: Ashwin Sekhar T K @ 2022-11-08  6:55 UTC (permalink / raw)
  To: dev, Ashwin Sekhar T K, Pavan Nikhilesh
  Cc: jerinj, skori, skoteshwar, kirankumark, psatheesh, anoobj,
	gakhil, hkalra, ndabilpuram

In scenarios where rte_mempool_free() is called immediately
after rte_mempool_create_empty(), the NPA pool will not be
created. In such cases the free path should not call
roc_npa_pool_destroy().

Fixes: bbf19e89b87c ("mempool/cnxk: add generic operations")

Signed-off-by: Ashwin Sekhar T K <asekhar@marvell.com>
---
 drivers/mempool/cnxk/cnxk_mempool_ops.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/mempool/cnxk/cnxk_mempool_ops.c b/drivers/mempool/cnxk/cnxk_mempool_ops.c
index a0b94bb95c..3769afd3d1 100644
--- a/drivers/mempool/cnxk/cnxk_mempool_ops.c
+++ b/drivers/mempool/cnxk/cnxk_mempool_ops.c
@@ -126,6 +126,14 @@ cnxk_mempool_free(struct rte_mempool *mp)
 	int rc = 0;
 
 	plt_npa_dbg("aura_handle=0x%" PRIx64, mp->pool_id);
+
+	/* It can happen that rte_mempool_free() is called immediately after
+	 * rte_mempool_create_empty(). In such cases the NPA pool will not be
+	 * allocated.
+	 */
+	if (roc_npa_aura_handle_to_base(mp->pool_id) == 0)
+		return;
+
 	rc = roc_npa_pool_destroy(mp->pool_id);
 	if (rc)
 		plt_err("Failed to free pool or aura rc=%d", rc);
-- 
2.25.1


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

* Re: [PATCH v3] mempool/cnxk: fix mempool destroy for empty pools
  2022-11-08  6:55 ` [PATCH v3] mempool/cnxk: fix mempool destroy for empty pools Ashwin Sekhar T K
@ 2022-11-15  3:24   ` Thomas Monjalon
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2022-11-15  3:24 UTC (permalink / raw)
  To: Ashwin Sekhar T K
  Cc: dev, Pavan Nikhilesh, jerinj, skori, skoteshwar, kirankumark,
	psatheesh, anoobj, gakhil, hkalra, ndabilpuram, stable

08/11/2022 07:55, Ashwin Sekhar T K:
> In scenarios where rte_mempool_free() is called immediately
> after rte_mempool_create_empty(), the NPA pool will not be
> created. In such cases the free path should not call
> roc_npa_pool_destroy().
> 
> Fixes: bbf19e89b87c ("mempool/cnxk: add generic operations")
> 
> Signed-off-by: Ashwin Sekhar T K <asekhar@marvell.com>

+ Cc: stable@dpdk.org

Applied with the title "fix destroying empty pool".





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

end of thread, other threads:[~2022-11-15  3:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-08  6:18 [PATCH v1] mempool/cnxk: destroy NPA pool only if its created Ashwin Sekhar T K
2022-11-08  6:41 ` [PATCH v2] " Ashwin Sekhar T K
2022-11-08  6:55 ` [PATCH v3] mempool/cnxk: fix mempool destroy for empty pools Ashwin Sekhar T K
2022-11-15  3:24   ` 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).