diff mbox series

mbuf: Improved error message. Added check if shared memory already allocated

Message ID 20211027111118.395928-1-asb.tyum@gmail.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers show
Series mbuf: Improved error message. Added check if shared memory already allocated | expand

Checks

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

Commit Message

Alexander Bechikov Oct. 27, 2021, 11:11 a.m. UTC
Signed-off-by: Alexander Bechikov <asb.tyum@gmail.com>
---
 lib/mbuf/rte_mbuf_dyn.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Olivier Matz Oct. 29, 2021, 7:31 a.m. UTC | #1
Hi Alexander,

Thanks for submitting this patch. Few comments below.

On Wed, Oct 27, 2021 at 07:11:18AM -0400, Alexander Bechikov wrote:
> mbuf: Improved error message. Added check if shared memory already allocated

I suggest another title:

  mbuf: fix dump of dynamic fields and flags

Indeed, it appears that the dump is currently broken. We can see it
in the unit tests:

  RTE>>mbuf_autotest
  ...
  MBUF: Failed to get mbuf dyn shared memory

As the function returns void, we failure is not detected by the test.

Can you add a small commit log?

I suppose this issue is introduced by d4902ed31c63 ("mbuf: check shared
memory before dumping dynamic space"). Do you confirm?

Can you please also add:

  Cc: stable@dpdk.org
  Fixes: d4902ed31c63 ("mbuf: check shared memory before dumping dynamic space")

> Signed-off-by: Alexander Bechikov <asb.tyum@gmail.com>
> ---
>  lib/mbuf/rte_mbuf_dyn.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/mbuf/rte_mbuf_dyn.c b/lib/mbuf/rte_mbuf_dyn.c
> index db8e020665..a3bc9b66d2 100644
> --- a/lib/mbuf/rte_mbuf_dyn.c
> +++ b/lib/mbuf/rte_mbuf_dyn.c
> @@ -116,7 +116,8 @@ init_shared_mem(void)
>  		mz = rte_memzone_lookup(RTE_MBUF_DYN_MZNAME);
>  	}
>  	if (mz == NULL) {
> -		RTE_LOG(ERR, MBUF, "Failed to get mbuf dyn shared memory\n");
> +		RTE_LOG(ERR, MBUF, "Failed to get mbuf dyn shared memory: %s (%d)\n",
> +			rte_strerror(rte_errno), rte_errno);
>  		return -1;
>  	}
>  

I think rte_errno is not set when rte_memzone_lookup() returns NULL (this
happens when init_shared_mem() is called from a secondary process). You can
set it in this function to ENOENT, or just drop this change.


> @@ -531,7 +532,7 @@ void rte_mbuf_dyn_dump(FILE *out)
>  	size_t i;
>  
>  	rte_mcfg_tailq_write_lock();
> -	if (init_shared_mem() < 0) {
> +	if (shm == NULL && init_shared_mem() < 0) {
>  		rte_mcfg_tailq_write_unlock();
>  		return;
>  	}
> -- 
> 2.30.2
> 


Thanks,
Olivier
diff mbox series

Patch

diff --git a/lib/mbuf/rte_mbuf_dyn.c b/lib/mbuf/rte_mbuf_dyn.c
index db8e020665..a3bc9b66d2 100644
--- a/lib/mbuf/rte_mbuf_dyn.c
+++ b/lib/mbuf/rte_mbuf_dyn.c
@@ -116,7 +116,8 @@  init_shared_mem(void)
 		mz = rte_memzone_lookup(RTE_MBUF_DYN_MZNAME);
 	}
 	if (mz == NULL) {
-		RTE_LOG(ERR, MBUF, "Failed to get mbuf dyn shared memory\n");
+		RTE_LOG(ERR, MBUF, "Failed to get mbuf dyn shared memory: %s (%d)\n",
+			rte_strerror(rte_errno), rte_errno);
 		return -1;
 	}
 
@@ -531,7 +532,7 @@  void rte_mbuf_dyn_dump(FILE *out)
 	size_t i;
 
 	rte_mcfg_tailq_write_lock();
-	if (init_shared_mem() < 0) {
+	if (shm == NULL && init_shared_mem() < 0) {
 		rte_mcfg_tailq_write_unlock();
 		return;
 	}