DPDK patches and discussions
 help / color / mirror / Atom feed
From: Congjie Zhou <zcjie0802@qq.com>
To: dev@dpdk.org
Cc: anatoly.burakov@intel.com, stephen@networkplumber.org,
	Congjie Zhou <zcjie0802@qq.com>
Subject: [PATCH v3] eal/linux: fix fbarray name with multiple secondary processes
Date: Sat, 16 Nov 2024 12:07:41 +0800	[thread overview]
Message-ID: <tencent_C757C0BA2AC7438F65C6522E700005F53605@qq.com> (raw)
In-Reply-To: <tencent_B09D0FCCA142E4AE5ABFE584E92DCED8CB0A@qq.com>

add the tsc into the name.

Suggested-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Congjie Zhou <zcjie0802@qq.com>
---

When multiple secondary processes run in different containers, names
identified by PIDs are not unique due to the pid namespace. 
So Add tsc to redefine a unique name.

v1: use monotonic time to redefine the name
v2: use tsc to redefine the name
v3: include <rte_cycles.h> to support all architectures

 lib/eal/linux/eal_memalloc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/eal/linux/eal_memalloc.c b/lib/eal/linux/eal_memalloc.c
index e354efc..ae1e024 100644
--- a/lib/eal/linux/eal_memalloc.c
+++ b/lib/eal/linux/eal_memalloc.c
@@ -16,6 +16,7 @@
 #include <fcntl.h>
 #include <signal.h>
 #include <setjmp.h>
+#include <inttypes.h>
 #ifdef F_ADD_SEALS /* if file sealing is supported, so is memfd */
 #include <linux/memfd.h>
 #define MEMFD_SUPPORTED
@@ -31,6 +32,7 @@
 #include <rte_log.h>
 #include <rte_eal.h>
 #include <rte_memory.h>
+#include <rte_cycles.h>
 
 #include "eal_filesystem.h"
 #include "eal_internal_cfg.h"
@@ -1447,8 +1449,8 @@ secondary_msl_create_walk(const struct rte_memseg_list *msl,
 	local_msl = &local_memsegs[msl_idx];
 
 	/* create distinct fbarrays for each secondary */
-	snprintf(name, RTE_FBARRAY_NAME_LEN, "%s_%i",
-		primary_msl->memseg_arr.name, getpid());
+	snprintf(name, RTE_FBARRAY_NAME_LEN, "%s_%i_%"PRIx64,
+		primary_msl->memseg_arr.name, getpid(), rte_get_tsc_cycles());
 
 	ret = rte_fbarray_init(&local_msl->memseg_arr, name,
 		primary_msl->memseg_arr.len,
-- 
2.34.1


      parent reply	other threads:[~2024-11-16  4:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-14  8:37 [PATCH] eal/linux: redefine the name for rte_fbarray_init() Congjie Zhou
2024-11-14 16:24 ` Stephen Hemminger
2024-11-14 17:06   ` Stephen Hemminger
2024-11-15  2:26     ` Zhou congjie
2024-11-15  5:32       ` Stephen Hemminger
2024-11-15  1:57   ` Zhou congjie
2024-11-15  2:00   ` Zhou congjie
2024-11-15  7:50 ` [PATCH v2] eal/linux: fix fbarray name with multiple secondary processes Congjie Zhou
2024-11-15 16:38   ` Stephen Hemminger
2024-11-15 20:09   ` Stephen Hemminger
2024-11-16  2:16     ` [PATCH v2] eal/linux: fix fbarray name with multiple secondaryprocesses Zhou congjie
2024-11-16  2:53     ` Zhou congjie
2024-11-16  4:07 ` Congjie Zhou [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tencent_C757C0BA2AC7438F65C6522E700005F53605@qq.com \
    --to=zcjie0802@qq.com \
    --cc=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).