mempool/cnxk: avoid batch op free for empty mempools

Message ID 20220428095935.3612387-1-asekhar@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series mempool/cnxk: avoid batch op free for empty mempools |

Checks

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

Commit Message

Ashwin Sekhar T K April 28, 2022, 9:59 a.m. UTC
  Batch op data is initialized inside mempool alloc. But
in case of empty mempools, the alloc function is not
called and hence the initialization of batch op data is
also not done. So ensure the validity of batch op data
inside mempool free.

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

Comments

Ashwin Sekhar T K May 23, 2022, 6:15 p.m. UTC | #1
PING.

Ashwin Sekhar T K 

> -----Original Message-----
> From: Ashwin Sekhar T K <asekhar@marvell.com>
> Sent: Thursday, April 28, 2022 3:30 PM
> To: dev@dpdk.org
> Cc: Jerin Jacob Kollanukkaran <jerinj@marvell.com>; Sunil Kumar Kori
> <skori@marvell.com>; Satha Koteswara Rao Kottidi
> <skoteshwar@marvell.com>; Pavan Nikhilesh Bhagavatula
> <pbhagavatula@marvell.com>; Kiran Kumar Kokkilagadda
> <kirankumark@marvell.com>; Satheesh Paul Antonysamy
> <psatheesh@marvell.com>; Ashwin Sekhar Thalakalath Kottilveetil
> <asekhar@marvell.com>; Anoob Joseph <anoobj@marvell.com>; Akhil
> Goyal <gakhil@marvell.com>; Nithin Kumar Dabilpuram
> <ndabilpuram@marvell.com>; Harman Kalra <hkalra@marvell.com>
> Subject: [PATCH] mempool/cnxk: avoid batch op free for empty mempools
> 
> Batch op data is initialized inside mempool alloc. But in case of empty
> mempools, the alloc function is not called and hence the initialization of batch
> op data is also not done. So ensure the validity of batch op data inside
> mempool free.
> 
> Signed-off-by: Ashwin Sekhar T K <asekhar@marvell.com>
> ---
>  drivers/mempool/cnxk/cn10k_mempool_ops.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/mempool/cnxk/cn10k_mempool_ops.c
> b/drivers/mempool/cnxk/cn10k_mempool_ops.c
> index 6ebbf91de5..a02e01cea0 100644
> --- a/drivers/mempool/cnxk/cn10k_mempool_ops.c
> +++ b/drivers/mempool/cnxk/cn10k_mempool_ops.c
> @@ -109,6 +109,12 @@ batch_op_fini(struct rte_mempool *mp)
>  	int i;
> 
>  	op_data = batch_op_data_get(mp->pool_id);
> +	if (!op_data) {
> +		/* Batch op data can be uninitialized in case of empty
> +		 * mempools.
> +		 */
> +		return;
> +	}
> 
>  	rte_wmb();
>  	for (i = 0; i < RTE_MAX_LCORE; i++) {
> --
> 2.32.0
  
Thomas Monjalon June 8, 2022, 9:12 a.m. UTC | #2
28/04/2022 11:59, Ashwin Sekhar T K:
> Batch op data is initialized inside mempool alloc. But
> in case of empty mempools, the alloc function is not
> called and hence the initialization of batch op data is
> also not done. So ensure the validity of batch op data
> inside mempool free.
> 
> Signed-off-by: Ashwin Sekhar T K <asekhar@marvell.com>

Applied, thanks.
  

Patch

diff --git a/drivers/mempool/cnxk/cn10k_mempool_ops.c b/drivers/mempool/cnxk/cn10k_mempool_ops.c
index 6ebbf91de5..a02e01cea0 100644
--- a/drivers/mempool/cnxk/cn10k_mempool_ops.c
+++ b/drivers/mempool/cnxk/cn10k_mempool_ops.c
@@ -109,6 +109,12 @@  batch_op_fini(struct rte_mempool *mp)
 	int i;
 
 	op_data = batch_op_data_get(mp->pool_id);
+	if (!op_data) {
+		/* Batch op data can be uninitialized in case of empty
+		 * mempools.
+		 */
+		return;
+	}
 
 	rte_wmb();
 	for (i = 0; i < RTE_MAX_LCORE; i++) {