DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] app/testpmd: avoid mbuf pool memzone name collision
@ 2026-11-15 15:03 Mujahed Mohammed
  2026-11-16 11:25 ` [PATCH v2] " Mujahed Mohammed
  2026-11-17 19:34 ` [PATCH v3] mempool: avoid " Mujahed Mohammed
  0 siblings, 2 replies; 4+ messages in thread
From: Mujahed Mohammed @ 2026-11-15 15:03 UTC (permalink / raw)
  To: aman.deep.singh@intel.com, NBU-Contact-Thomas Monjalon (EXTERNAL)
  Cc: dev@dpdk.org, stable@dpdk.org, Maayan Kashani


[-- Attachment #1.1: Type: text/plain, Size: 4 bytes --]




[-- Attachment #1.2: Type: text/html, Size: 451 bytes --]

[-- Attachment #2: 0001-app-testpmd-avoid-mbuf-pool-memzone-name-collision.patch --]
[-- Type: application/octet-stream, Size: 1906 bytes --]

From 87f15e6967bae3d7d066598b17069958e46ae18d Mon Sep 17 00:00:00 2001
From: Mujahed Mohammed <mballas@nvidia.com>
Date: Wed, 11 Nov 2026 10:16:37 +0200
Subject: [PATCH] app/testpmd: avoid mbuf pool memzone name collision

Additional mbuf pools append a numeric size index to the base pool
name. Mempool backing chunks also append a numeric chunk index. If
the base pool needs multiple chunks, its chunk name can therefore
match the metadata memzone name of an additional pool.

Add an s marker before additional pool size indexes to keep the two
namespaces distinct while retaining the original index-zero pool
name.

Fixes: 26cbb4191e91 ("app/testpmd: add multiple pools per core creation")

Cc: stable@dpdk.org

Signed-off-by: Mujahed Mohammed <mballas@nvidia.com>
---
 .mailmap               | 1 +
 app/test-pmd/testpmd.h | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/.mailmap b/.mailmap
index a4af517007..fc7750a006 100644
--- a/.mailmap
+++ b/.mailmap
@@ -1183,6 +1183,7 @@ Morten Brørup <mb@smartsharesystems.com>
 Moti Haimovsky <motih@mellanox.com>
 Muhammad Ahmad <muhammad.ahmad@emumba.com>
 Muhammad Bilal <m.bilal@emumba.com>
+Mujahed Mohammed <mballas@nvidia.com>
 Mukesh Dua <mukesh.dua81@gmail.com>
 Mukul Katiyar <mukul@versa-networks.com>
 Murphy Yang <murphyx.yang@intel.com>
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 2ca4aaf086..5736e60a57 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -893,8 +893,9 @@ mbuf_poolname_build(unsigned int sock_id, char *mp_name,
 		snprintf(mp_name, name_size,
 			 MBUF_POOL_NAME_PFX "_%u", sock_id);
 	else
+		/* Keep pool indexes distinct from mempool chunk suffixes. */
 		snprintf(mp_name, name_size,
-			 MBUF_POOL_NAME_PFX "_%hu_%hu", (uint16_t)sock_id, idx);
+			 MBUF_POOL_NAME_PFX "_%hu_s%hu", (uint16_t)sock_id, idx);
 }
 
 static inline struct rte_mempool *
-- 
2.43.0


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

* [PATCH v2] app/testpmd: avoid mbuf pool memzone name collision
  2026-11-15 15:03 [PATCH] app/testpmd: avoid mbuf pool memzone name collision Mujahed Mohammed
@ 2026-11-16 11:25 ` Mujahed Mohammed
  2026-11-16 18:44   ` Stephen Hemminger
  2026-11-17 19:34 ` [PATCH v3] mempool: avoid " Mujahed Mohammed
  1 sibling, 1 reply; 4+ messages in thread
From: Mujahed Mohammed @ 2026-11-16 11:25 UTC (permalink / raw)
  To: dev
  Cc: Mujahed Mohammed, stable, Thomas Monjalon, Aman Singh,
	Viacheslav Ovsiienko

Additional mbuf pools append a numeric size index to the base pool
name. Mempool backing chunks also append a numeric chunk index. If
the base pool needs multiple chunks, its chunk name can therefore
match the metadata memzone name of an additional pool.

Add an s marker before additional pool size indexes to keep the two
namespaces distinct while retaining the original index-zero pool
name.

Fixes: 26cbb4191e91 ("app/testpmd: add multiple pools per core creation")

Cc: stable@dpdk.org

Signed-off-by: Mujahed Mohammed <mballas@nvidia.com>
---
 .mailmap               | 1 +
 app/test-pmd/testpmd.h | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/.mailmap b/.mailmap
index a4af517007..fc7750a006 100644
--- a/.mailmap
+++ b/.mailmap
@@ -1183,6 +1183,7 @@ Morten Brørup <mb@smartsharesystems.com>
 Moti Haimovsky <motih@mellanox.com>
 Muhammad Ahmad <muhammad.ahmad@emumba.com>
 Muhammad Bilal <m.bilal@emumba.com>
+Mujahed Mohammed <mballas@nvidia.com>
 Mukesh Dua <mukesh.dua81@gmail.com>
 Mukul Katiyar <mukul@versa-networks.com>
 Murphy Yang <murphyx.yang@intel.com>
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 2ca4aaf086..5736e60a57 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -893,8 +893,9 @@ mbuf_poolname_build(unsigned int sock_id, char *mp_name,
 		snprintf(mp_name, name_size,
 			 MBUF_POOL_NAME_PFX "_%u", sock_id);
 	else
+		/* Keep pool indexes distinct from mempool chunk suffixes. */
 		snprintf(mp_name, name_size,
-			 MBUF_POOL_NAME_PFX "_%hu_%hu", (uint16_t)sock_id, idx);
+			 MBUF_POOL_NAME_PFX "_%hu_s%hu", (uint16_t)sock_id, idx);
 }
 
 static inline struct rte_mempool *
-- 
2.43.0


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

* Re: [PATCH v2] app/testpmd: avoid mbuf pool memzone name collision
  2026-11-16 11:25 ` [PATCH v2] " Mujahed Mohammed
@ 2026-11-16 18:44   ` Stephen Hemminger
  0 siblings, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2026-11-16 18:44 UTC (permalink / raw)
  To: Mujahed Mohammed
  Cc: dev, stable, Thomas Monjalon, Aman Singh, Viacheslav Ovsiienko

On Mon, 16 Nov 2026 13:25:53 +0200
Mujahed Mohammed <mballas@nvidia.com> wrote:

> Additional mbuf pools append a numeric size index to the base pool
> name. Mempool backing chunks also append a numeric chunk index. If
> the base pool needs multiple chunks, its chunk name can therefore
> match the metadata memzone name of an additional pool.
> 
> Add an s marker before additional pool size indexes to keep the two
> namespaces distinct while retaining the original index-zero pool
> name.
> 
> Fixes: 26cbb4191e91 ("app/testpmd: add multiple pools per core creation")
> 
> Cc: stable@dpdk.org
> 
> Signed-off-by: Mujahed Mohammed <mballas@nvidia.com>
> ---

Looks ok, but I like the AI suggestion to fix it in mempoll code
not just in testpmd.

---

The collision is not testpmd specific. rte_mempool_populate_default()
names chunks MP_<name>_<id>, which shares a namespace with the pool
metadata memzone MP_<name>. Any application with pools "foo" and
"foo_1" can hit this once "foo" spans more than one chunk.

Please fix it in lib/mempool instead, e.g. use a distinct prefix of
the same length for chunk memzones ("MC_%s_%u"). Nothing looks up
chunk memzones by name, and the name length budget is unchanged.

Also please add the reproduction (command line and memory setup that
forces multiple chunks) to the commit message.

Minor: braces around the else body if a comment is added there, and
no blank line between Fixes: and Cc: stable.

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

* [PATCH v3] mempool: avoid memzone name collision
  2026-11-15 15:03 [PATCH] app/testpmd: avoid mbuf pool memzone name collision Mujahed Mohammed
  2026-11-16 11:25 ` [PATCH v2] " Mujahed Mohammed
@ 2026-11-17 19:34 ` Mujahed Mohammed
  1 sibling, 0 replies; 4+ messages in thread
From: Mujahed Mohammed @ 2026-11-17 19:34 UTC (permalink / raw)
  To: dev
  Cc: Mujahed Mohammed, stable, Thomas Monjalon, Andrew Rybchenko,
	Morten Brørup, Olivier Matz

Mempool metadata uses MP_<name>, while default-populated backing chunks
use MP_<name>_<id>. If a pool named "foo" spans more than one chunk,
chunk 1 is named MP_foo_1. Creating a pool named "foo_1" then fails to
reserve its MP_foo_1 metadata memzone with EEXIST.

This can be reproduced on a two-NUMA-node system using 2 MiB hugepages
with the following memory setup:

    HugePages_Total: 2048
    HugePages_Free:  2048
    Hugepagesize:    2048 kB

Run testpmd in legacy-memory mode so the first pool spans chunks:

    dpdk-testpmd -n 4 \
        -a 0000:08:00.0 -a 0000:08:00.1 \
        --legacy-mem --socket-mem=0,2048 -- \
        -i --nb-cores=3 --rxq=8 --txq=8 \
        --rxd=2048 --txd=2048 --socket-num=1 --no-numa \
        --mbuf-size=2972,612,512 \
        --rxpkts=2844,612,512 \
        --total-num-mbufs=196608 --enable-scatter

The first pool's chunk 1 and the second pool's metadata both request
MP_mb_pool_1_1.

Use MC_<name>_<id> for chunk memzones, keeping MP_<name> for mempool
metadata. Chunk memzones are not looked up by name, and the new prefix
keeps the existing name-length budget.

Fixes: d1d914ebbc25 ("mempool: allocate in several memory chunks by default")
Cc: stable@dpdk.org

Signed-off-by: Mujahed Mohammed <mballas@nvidia.com>
---
v3:
- Move the fix from testpmd to the mempool library.
- Use the MC_ prefix for backing chunk memzones.
- Add the reproducer and hugepage setup to the commit message.
 .mailmap                  | 1 +
 lib/mempool/rte_mempool.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/.mailmap b/.mailmap
index a4af517007..fc7750a006 100644
--- a/.mailmap
+++ b/.mailmap
@@ -1183,6 +1183,7 @@ Morten Brørup <mb@smartsharesystems.com>
 Moti Haimovsky <motih@mellanox.com>
 Muhammad Ahmad <muhammad.ahmad@emumba.com>
 Muhammad Bilal <m.bilal@emumba.com>
+Mujahed Mohammed <mballas@nvidia.com>
 Mukesh Dua <mukesh.dua81@gmail.com>
 Mukul Katiyar <mukul@versa-networks.com>
 Murphy Yang <murphyx.yang@intel.com>
diff --git a/lib/mempool/rte_mempool.c b/lib/mempool/rte_mempool.c
index 069aabaa70..8f3c88aeb4 100644
--- a/lib/mempool/rte_mempool.c
+++ b/lib/mempool/rte_mempool.c
@@ -565,7 +565,7 @@ rte_mempool_populate_default(struct rte_mempool *mp)
 		}
 
 		ret = snprintf(mz_name, sizeof(mz_name),
-			RTE_MEMPOOL_MZ_FORMAT "_%d", mp->name, mz_id);
+			"MC_%s_%u", mp->name, mz_id);
 		if (ret < 0 || ret >= (int)sizeof(mz_name)) {
 			ret = -ENAMETOOLONG;
 			goto fail;
-- 
2.43.0


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

end of thread, other threads:[~2026-11-17 19:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-15 15:03 [PATCH] app/testpmd: avoid mbuf pool memzone name collision Mujahed Mohammed
2026-11-16 11:25 ` [PATCH v2] " Mujahed Mohammed
2026-11-16 18:44   ` Stephen Hemminger
2026-11-17 19:34 ` [PATCH v3] mempool: avoid " Mujahed Mohammed

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox