From: yasufum.o@gmail.com To: anatoly.burakov@intel.com, david.marchand@redhat.com, konstantin.ananyev@intel.com Cc: dev@dpdk.org, stable@dpdk.org, yasufum.o@gmail.com, Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp> Subject: [dpdk-stable] [PATCH v7 1/1] fbarray: fix duplicated fbarray file in secondary Date: Thu, 14 Nov 2019 06:43:46 +0900 Message-ID: <20191113214346.33749-2-yasufum.o@gmail.com> (raw) In-Reply-To: <20191113214346.33749-1-yasufum.o@gmail.com> From: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp> In secondary_msl_create_walk(), it creates a file for fbarrays with its PID for reserving unique name among secondary processes. However, it does not work if several secondaries run as app containers because each of containerized secondary has PID 1, and failed to reserve unique name other than first one. To reserve unique name in each of containers, use hostname in addition to PID. Cc: stable@dpdk.org Signed-off-by: Yasufumi Ogawa <yasufum.o@gmail.com> --- lib/librte_eal/linux/eal/eal_memalloc.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/lib/librte_eal/linux/eal/eal_memalloc.c b/lib/librte_eal/linux/eal/eal_memalloc.c index af6d0d023..11de6d4d6 100644 --- a/lib/librte_eal/linux/eal/eal_memalloc.c +++ b/lib/librte_eal/linux/eal/eal_memalloc.c @@ -1365,6 +1365,12 @@ secondary_msl_create_walk(const struct rte_memseg_list *msl, struct rte_memseg_list *primary_msl, *local_msl; char name[PATH_MAX]; int msl_idx, ret; + char hostname[HOST_NAME_MAX+1] = { 0 }; + /* filename of secondary's fbarray is defined such as + * "fbarray_memseg-1048576k-0-0_PID_HOSTNAME" and length of PID + * can be 7 digits maximumly. + */ + int fbarray_sec_name_len = 32 + 7 + 1 + HOST_NAME_MAX + 1; if (msl->external) return 0; @@ -1373,9 +1379,13 @@ secondary_msl_create_walk(const struct rte_memseg_list *msl, primary_msl = &mcfg->memsegs[msl_idx]; 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()); + /* Create distinct fbarrays for each secondary by using PID and + * hostname. The reason why using hostname is because PID could be + * duplicated among secondaries if it is launched in a container. + */ + gethostname(hostname, sizeof(hostname)); + snprintf(name, fbarray_sec_name_len, "%s_%d_%s", + primary_msl->memseg_arr.name, (int)getpid(), hostname); ret = rte_fbarray_init(&local_msl->memseg_arr, name, primary_msl->memseg_arr.len, -- 2.17.1
next prev parent reply other threads:[~2019-11-13 21:44 UTC|newest] Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-04-16 1:59 [dpdk-stable] [PATCH] fbarray: get fbarrays from containerized secondary ogawa.yasufumi 2019-04-16 3:43 ` [dpdk-stable] [PATCH v2 0/1] Get " ogawa.yasufumi 2019-04-16 3:43 ` [dpdk-stable] [PATCH v2 1/1] fbarray: get " ogawa.yasufumi 2019-07-04 20:17 ` [dpdk-stable] [dpdk-dev] " Thomas Monjalon 2019-07-05 8:53 ` [dpdk-stable] " Burakov, Anatoly 2019-07-09 10:22 ` [dpdk-stable] [dpdk-dev] " Yasufumi Ogawa 2019-07-09 10:24 ` Burakov, Anatoly 2019-07-09 10:26 ` Burakov, Anatoly 2019-07-11 9:37 ` Yasufumi Ogawa 2019-07-11 9:43 ` Burakov, Anatoly 2019-07-11 10:31 ` [dpdk-stable] [PATCH v3 0/1] " yasufum.o 2019-07-11 10:31 ` [dpdk-stable] [PATCH v3 1/1] " yasufum.o 2019-07-11 10:53 ` Burakov, Anatoly 2019-07-11 11:57 ` Yasufumi Ogawa 2019-07-11 13:14 ` Burakov, Anatoly 2019-07-12 2:22 ` Yasufumi Ogawa 2019-07-22 1:06 ` Ogawa Yasufumi 2019-07-22 9:33 ` Burakov, Anatoly 2019-07-22 9:25 ` Burakov, Anatoly 2019-07-24 8:20 ` [dpdk-stable] [PATCH v4 0/1] " yasufum.o 2019-07-24 8:20 ` [dpdk-stable] [PATCH v4 1/1] " yasufum.o 2019-07-24 9:59 ` Burakov, Anatoly 2019-07-30 8:16 ` Thomas Monjalon 2019-07-30 9:18 ` Burakov, Anatoly 2019-07-31 5:48 ` Yasufumi Ogawa 2019-10-11 9:36 ` David Marchand 2019-10-25 15:36 ` David Marchand 2019-10-25 19:54 ` Yasufumi Ogawa 2019-10-26 16:15 ` David Marchand 2019-10-26 18:11 ` Yasufumi Ogawa 2019-10-28 8:07 ` [dpdk-stable] [PATCH v5 0/1] fbarray: fix duplicated fbarray file in secondary yasufum.o 2019-10-28 8:07 ` [dpdk-stable] [PATCH v5 1/1] " yasufum.o 2019-10-29 12:03 ` [dpdk-stable] [dpdk-dev] " Ananyev, Konstantin 2019-10-30 13:42 ` Yasufumi Ogawa 2019-10-30 19:00 ` Ananyev, Konstantin 2019-10-31 10:03 ` Yasufumi Ogawa 2019-10-31 10:32 ` Ananyev, Konstantin 2019-11-01 9:04 ` [dpdk-stable] [PATCH v6 0/1] " yasufum.o 2019-11-01 9:04 ` [dpdk-stable] [PATCH v6 1/1] " yasufum.o 2019-11-01 12:01 ` Ananyev, Konstantin 2019-11-04 10:20 ` Burakov, Anatoly 2019-11-05 10:13 ` David Marchand 2019-11-05 11:31 ` Burakov, Anatoly 2019-11-05 11:41 ` Ananyev, Konstantin 2019-11-06 10:37 ` Burakov, Anatoly 2019-11-08 3:19 ` Yasufumi Ogawa 2019-11-13 21:43 ` [dpdk-stable] [PATCH v7 0/1] " yasufum.o 2019-11-13 21:43 ` yasufum.o [this message] 2019-11-14 10:01 ` [dpdk-stable] [PATCH v7 1/1] " Burakov, Anatoly 2019-11-14 11:42 ` Yasufumi Ogawa 2019-11-14 12:27 ` David Marchand 2019-11-26 19:40 ` Yasufumi Ogawa 2019-11-27 10:26 ` Burakov, Anatoly 2019-11-14 12:55 ` David Marchand 2019-11-14 17:32 ` Ananyev, Konstantin
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=20191113214346.33749-2-yasufum.o@gmail.com \ --to=yasufum.o@gmail.com \ --cc=anatoly.burakov@intel.com \ --cc=david.marchand@redhat.com \ --cc=dev@dpdk.org \ --cc=konstantin.ananyev@intel.com \ --cc=ogawa.yasufumi@lab.ntt.co.jp \ --cc=stable@dpdk.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
patches for DPDK stable branches This inbox may be cloned and mirrored by anyone: git clone --mirror https://inbox.dpdk.org/stable/0 stable/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 stable stable/ https://inbox.dpdk.org/stable \ stable@dpdk.org public-inbox-index stable Example config snippet for mirrors. Newsgroup available over NNTP: nntp://inbox.dpdk.org/inbox.dpdk.stable AGPL code for this site: git clone https://public-inbox.org/public-inbox.git