DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] mbuf: Improved error message. Added check if shared memory already allocated
@ 2021-10-27 11:11 Alexander Bechikov
  2021-10-29  7:31 ` Olivier Matz
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Alexander Bechikov @ 2021-10-27 11:11 UTC (permalink / raw)
  To: olivier.matz; +Cc: dev, Alexander Bechikov

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;
 	}
 
@@ -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


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

* Re: [dpdk-dev] [PATCH] mbuf: Improved error message. Added check if shared memory already allocated
  2021-10-27 11:11 [dpdk-dev] [PATCH] mbuf: Improved error message. Added check if shared memory already allocated Alexander Bechikov
@ 2021-10-29  7:31 ` Olivier Matz
  2021-10-29 19:35 ` [dpdk-dev] [PATCH v2 1/2] " Alexander Bechikov
  2021-11-24 12:57 ` [PATCH v3] " Olivier Matz
  2 siblings, 0 replies; 6+ messages in thread
From: Olivier Matz @ 2021-10-29  7:31 UTC (permalink / raw)
  To: Alexander Bechikov; +Cc: dev

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

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

* [dpdk-dev] [PATCH v2 1/2] mbuf: Improved error message. Added check if shared memory already allocated
  2021-10-27 11:11 [dpdk-dev] [PATCH] mbuf: Improved error message. Added check if shared memory already allocated Alexander Bechikov
  2021-10-29  7:31 ` Olivier Matz
@ 2021-10-29 19:35 ` Alexander Bechikov
  2021-10-29 19:35   ` [dpdk-dev] [PATCH v2 2/2] mbuf: fix dump of dynamic fields and flags Alexander Bechikov
  2021-11-24 12:57 ` [PATCH v3] " Olivier Matz
  2 siblings, 1 reply; 6+ messages in thread
From: Alexander Bechikov @ 2021-10-29 19:35 UTC (permalink / raw)
  To: dev; +Cc: Alexander Bechikov

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;
 	}
 
@@ -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


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

* [dpdk-dev] [PATCH v2 2/2] mbuf: fix dump of dynamic fields and flags
  2021-10-29 19:35 ` [dpdk-dev] [PATCH v2 1/2] " Alexander Bechikov
@ 2021-10-29 19:35   ` Alexander Bechikov
  0 siblings, 0 replies; 6+ messages in thread
From: Alexander Bechikov @ 2021-10-29 19:35 UTC (permalink / raw)
  To: dev; +Cc: Alexander Bechikov, stable

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

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

Signed-off-by: Alexander Bechikov <asb.tyum@gmail.com>
---
v2:
* Drop changes with log message from v1, because rte_errno is not always set
---
 lib/mbuf/rte_mbuf_dyn.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lib/mbuf/rte_mbuf_dyn.c b/lib/mbuf/rte_mbuf_dyn.c
index a3bc9b66d2..4ae79383b5 100644
--- a/lib/mbuf/rte_mbuf_dyn.c
+++ b/lib/mbuf/rte_mbuf_dyn.c
@@ -116,8 +116,7 @@ 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: %s (%d)\n",
-			rte_strerror(rte_errno), rte_errno);
+		RTE_LOG(ERR, MBUF, "Failed to get mbuf dyn shared memory\n");
 		return -1;
 	}
 
-- 
2.30.2


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

* [PATCH v3] mbuf: fix dump of dynamic fields and flags
  2021-10-27 11:11 [dpdk-dev] [PATCH] mbuf: Improved error message. Added check if shared memory already allocated Alexander Bechikov
  2021-10-29  7:31 ` Olivier Matz
  2021-10-29 19:35 ` [dpdk-dev] [PATCH v2 1/2] " Alexander Bechikov
@ 2021-11-24 12:57 ` Olivier Matz
  2021-11-24 14:08   ` Thomas Monjalon
  2 siblings, 1 reply; 6+ messages in thread
From: Olivier Matz @ 2021-11-24 12:57 UTC (permalink / raw)
  To: dev; +Cc: Alexander Bechikov, stable

From: Alexander Bechikov <asb.tyum@gmail.com>

The dump of dynamic fields and flags fails if the shm is already
allocated. Add a check to fix the issue.

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

Signed-off-by: Alexander Bechikov <asb.tyum@gmail.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
---
Hi Alexander,

Sorry for late feedback, I forgot to reply to your v2.
I'm resending your fix with the 2 patches merged together, so it
can be included in 21.11.

Thanks,
Olivier


v3:
* Merge the 2 patches from v2 and add a commit log
v2:
* Drop changes with log message from v1, because rte_errno is not always set
---
 lib/mbuf/rte_mbuf_dyn.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/mbuf/rte_mbuf_dyn.c b/lib/mbuf/rte_mbuf_dyn.c
index db8e020665..4ae79383b5 100644
--- a/lib/mbuf/rte_mbuf_dyn.c
+++ b/lib/mbuf/rte_mbuf_dyn.c
@@ -531,7 +531,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


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

* Re: [PATCH v3] mbuf: fix dump of dynamic fields and flags
  2021-11-24 12:57 ` [PATCH v3] " Olivier Matz
@ 2021-11-24 14:08   ` Thomas Monjalon
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Monjalon @ 2021-11-24 14:08 UTC (permalink / raw)
  To: Alexander Bechikov, Olivier Matz; +Cc: dev, stable

24/11/2021 13:57, Olivier Matz:
> From: Alexander Bechikov <asb.tyum@gmail.com>
> 
> The dump of dynamic fields and flags fails if the shm is already
> allocated. Add a check to fix the issue.
> 
> Cc: stable@dpdk.org
> Fixes: d4902ed31c63 ("mbuf: check shared memory before dumping dynamic space")
> 
> Signed-off-by: Alexander Bechikov <asb.tyum@gmail.com>
> Acked-by: Olivier Matz <olivier.matz@6wind.com>
> ---
> Hi Alexander,
> 
> Sorry for late feedback, I forgot to reply to your v2.
> I'm resending your fix with the 2 patches merged together, so it
> can be included in 21.11.

Applied for 21.11, thanks.




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

end of thread, other threads:[~2021-11-24 14:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-27 11:11 [dpdk-dev] [PATCH] mbuf: Improved error message. Added check if shared memory already allocated Alexander Bechikov
2021-10-29  7:31 ` Olivier Matz
2021-10-29 19:35 ` [dpdk-dev] [PATCH v2 1/2] " Alexander Bechikov
2021-10-29 19:35   ` [dpdk-dev] [PATCH v2 2/2] mbuf: fix dump of dynamic fields and flags Alexander Bechikov
2021-11-24 12:57 ` [PATCH v3] " Olivier Matz
2021-11-24 14:08   ` Thomas Monjalon

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ http://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git