DPDK patches and discussions
 help / color / Atom feed
From: "Ananyev, Konstantin" <konstantin.ananyev@intel.com>
To: Yasufumi Ogawa <yasufum.o@gmail.com>,
	"Burakov, Anatoly" <anatoly.burakov@intel.com>,
	"david.marchand@redhat.com" <david.marchand@redhat.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
	"stable@dpdk.org" <stable@dpdk.org>,
	Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
Subject: Re: [dpdk-dev] [PATCH v5 1/1] fbarray: fix duplicated fbarray file in secondary
Date: Thu, 31 Oct 2019 10:32:50 +0000
Message-ID: <2601191342CEEE43887BDE71AB97725801A8C736F3@IRSMSX104.ger.corp.intel.com> (raw)
In-Reply-To: <5fef8e2a-c819-8dcb-2206-dff5f12a0499@gmail.com>


> >> -----Original Message-----
> >> From: Yasufumi Ogawa <yasufum.o@gmail.com>
> >> Sent: Wednesday, October 30, 2019 1:42 PM
> >> To: Ananyev, Konstantin <konstantin.ananyev@intel.com>; Burakov, Anatoly <anatoly.burakov@intel.com>;
> david.marchand@redhat.com
> >> Cc: dev@dpdk.org; stable@dpdk.org; Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
> >> Subject: Re: [dpdk-dev] [PATCH v5 1/1] fbarray: fix duplicated fbarray file in secondary
> >>
> >> On 2019/10/29 21:03, Ananyev, Konstantin wrote:
> >>>
> >>>
> >>>> -----Original Message-----
> >>>> From: dev <dev-bounces@dpdk.org> On Behalf Of yasufum.o@gmail.com
> >>>> Sent: Monday, October 28, 2019 8:08 AM
> >>>> To: Burakov, Anatoly <anatoly.burakov@intel.com>; david.marchand@redhat.com
> >>>> Cc: dev@dpdk.org; stable@dpdk.org; yasufum.o@gmail.com; Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
> >>>> Subject: [dpdk-dev] [PATCH v5 1/1] fbarray: fix duplicated fbarray file in secondary
> >>>>
> >>>> 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 instead of PID only if PID is 1.
> >>>>
> >>>> Cc: stable@dpdk.org
> >>>>
> >>>> Signed-off-by: Yasufumi Ogawa <yasufum.o@gmail.com>
> >>>> ---
> >>>>    lib/librte_eal/linux/eal/eal_memalloc.c | 15 +++++++++++++--
> >>>>    1 file changed, 13 insertions(+), 2 deletions(-)
> >>>>
> >>>> diff --git a/lib/librte_eal/linux/eal/eal_memalloc.c b/lib/librte_eal/linux/eal/eal_memalloc.c
> >>>> index af6d0d023..699079791 100644
> >>>> --- a/lib/librte_eal/linux/eal/eal_memalloc.c
> >>>> +++ b/lib/librte_eal/linux/eal/eal_memalloc.c
> >>>> @@ -1365,6 +1365,7 @@ 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 proc_id[HOST_NAME_MAX] = { 0 };
> >>>>
> >>>>    	if (msl->external)
> >>>>    		return 0;
> >>>> @@ -1374,8 +1375,18 @@ 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());
> >>>> +	/* If run secondary in a container, the name of fbarray file should
> >>>> +	 * not be decided with pid because getpid() always returns 1.
> >>>
> >>>
> >>> I wonder why is that?
> >>> What will prevent user to do something like:
> >>> docker run -it --cpuset-cpus=7-8 -v /local/kananye1:/local/kananye1 ubuntu-dpdk-local:latest /bin/bash
> >>> And then start dpdk app manually within the container?
> >> Hi Konstantin,
> >>
> >> Thank you for your comment.
> >>
> >> My concern is running secondary as app container. In current
> >> implementation, the name of fbarray file is decided by using PID and it
> >> must be overlapped with other process because assigning PID is started
> >> from 1 in each of app container. This patch is to fix the issue.
> >>
> >> I think it is doable running app from bash for testing, but not
> >> acceptable for a realistic usecase in which user manages several app
> >> containers.
> >
> > User can have a bash script to start inside container first, that
> > would do some preparation work (setup env variables, etc.)....
> > Or some different scenario when user needs/wants to
> > spawn several processes within container.
> I don't know how to avoid to overlap PID from bash script because I
> think PIDs on host cannot see from inside of a container. So, I'm not
> sure it is possible.
> 
> > Inside the lib you can't assume that your usage scenario is the
> > only possible one.
> I don't want to modify it for a specific usecase, but just to avoid to
> overlap filenames. I think it is better this filename is decided by lib
> itself without any of user configuration because user don't need to care
> about the file which is used by DPDK internally.
> 
> > I think solution needs to be generic enough to cover all such cases.
> 
> > BTW, why we can't always use hostname in fbarray format?
> Sorry, I don't know. But I wonder using PID is more assured to get
> unique name, but does not work only for secondary app container
> accidentally.


My thought was - probably we always can use the same format:
snprintf(name, RTE_FBARRAY_NAME_LEN, "%s_%s_%u",
	primary_msl->memseg_arr.name,  gethostname(), getpid());
to fix that problem?

Konstantin


> 
> Yasufumi
> >
> >>
> >> Regards,
> >> Yasufumi
> >>
> >>>
> >>>> +	 * In docker, hostname is assigned as a short form of full container
> >>>> +	 * ID. So use hostname as unique ID among containers instead.
> >>>> +	 */
> >>>> +	if (getpid() == 1)
> >>>> +		gethostname(proc_id, HOST_NAME_MAX);
> >>>> +	else
> >>>> +		sprintf(proc_id, "%d", (int)getpid());
> >>>> +
> >>>> +	snprintf(name, RTE_FBARRAY_NAME_LEN, "%s_%s",
> >>>> +			primary_msl->memseg_arr.name, proc_id);
> >>>>
> >>>>    	ret = rte_fbarray_init(&local_msl->memseg_arr, name,
> >>>>    		primary_msl->memseg_arr.len,
> >>>> --
> >>>> 2.17.1
> >>>

  reply index

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-16  1:59 [dpdk-dev] [PATCH] fbarray: get fbarrays from containerized secondary ogawa.yasufumi
2019-04-16  1:59 ` ogawa.yasufumi
2019-04-16  3:43 ` [dpdk-dev] [PATCH v2 0/1] Get " ogawa.yasufumi
2019-04-16  3:43   ` ogawa.yasufumi
2019-04-16  3:43   ` [dpdk-dev] [PATCH v2 1/1] fbarray: get " ogawa.yasufumi
2019-04-16  3:43     ` ogawa.yasufumi
2019-07-04 20:17     ` Thomas Monjalon
2019-07-05  8:53     ` Burakov, Anatoly
2019-07-09 10:22       ` 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-dev] [PATCH v3 0/1] " yasufum.o
2019-07-11 10:31   ` [dpdk-dev] [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-dev] [PATCH v4 0/1] " yasufum.o
2019-07-24  8:20     ` [dpdk-dev] [PATCH v4 1/1] " yasufum.o
2019-07-24  9:59       ` Burakov, Anatoly
2019-07-30  8:16         ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
2019-07-30  9:18           ` Burakov, Anatoly
2019-07-31  5:48             ` Yasufumi Ogawa
2019-10-11  9:36       ` [dpdk-dev] " 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-dev] [PATCH v5 0/1] fbarray: fix duplicated fbarray file in secondary yasufum.o
2019-10-28  8:07       ` [dpdk-dev] [PATCH v5 1/1] " yasufum.o
2019-10-29 12:03         ` 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 [this message]
2019-11-01  9:04     ` [dpdk-dev] [PATCH v6 0/1] " yasufum.o
2019-11-01  9:04       ` [dpdk-dev] [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-dev] [PATCH v7 0/1] " yasufum.o
2019-11-13 21:43       ` [dpdk-dev] [PATCH v7 1/1] " yasufum.o
2019-11-14 10:01         ` 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-29  5:44                   ` Yasufumi Ogawa
2019-12-02 10:43                     ` Burakov, Anatoly
2019-12-05 20:13                       ` Yasufumi Ogawa
2019-11-14 12:55         ` David Marchand
2019-11-14 17:32         ` Ananyev, Konstantin
2019-11-27  8:48       ` [dpdk-dev] [PATCH v8 0/1] " Yasufumi Ogawa
2019-11-27  8:48         ` [dpdk-dev] [PATCH v8 1/1] " Yasufumi Ogawa
2019-12-06 10:44           ` Burakov, Anatoly
2019-12-06 13:18             ` Yasufumi Ogawa
2020-02-14  7:46             ` Yasufumi Ogawa
2020-02-14 15:08               ` David Marchand
2020-02-14 15:29                 ` Thomas Monjalon
2020-02-17 12:54                   ` Yasufumi Ogawa

Reply instructions:

You may reply publically 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=2601191342CEEE43887BDE71AB97725801A8C736F3@IRSMSX104.ger.corp.intel.com \
    --to=konstantin.ananyev@intel.com \
    --cc=anatoly.burakov@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=ogawa.yasufumi@lab.ntt.co.jp \
    --cc=stable@dpdk.org \
    --cc=yasufum.o@gmail.com \
    /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

DPDK patches and discussions

Archives are clonable:
	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


Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


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