From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id B18C9A00BE; Fri, 1 Nov 2019 13:02:07 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7AAC51E53B; Fri, 1 Nov 2019 13:02:05 +0100 (CET) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id 90DDF1DFE5; Fri, 1 Nov 2019 13:02:03 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Nov 2019 05:02:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,255,1569308400"; d="scan'208";a="231205702" Received: from irsmsx107.ger.corp.intel.com ([163.33.3.99]) by fmsmga002.fm.intel.com with ESMTP; 01 Nov 2019 05:02:00 -0700 Received: from irsmsx104.ger.corp.intel.com ([169.254.5.252]) by IRSMSX107.ger.corp.intel.com ([169.254.10.18]) with mapi id 14.03.0439.000; Fri, 1 Nov 2019 12:01:59 +0000 From: "Ananyev, Konstantin" To: "yasufum.o@gmail.com" , "Burakov, Anatoly" , "david.marchand@redhat.com" CC: "dev@dpdk.org" , "stable@dpdk.org" , Yasufumi Ogawa Thread-Topic: [PATCH v6 1/1] fbarray: fix duplicated fbarray file in secondary Thread-Index: AQHVkJNcRNJtVG9NS0i9YSGC2FUC2ad2Nvjg Date: Fri, 1 Nov 2019 12:01:59 +0000 Message-ID: <2601191342CEEE43887BDE71AB97725801A8C75306@IRSMSX104.ger.corp.intel.com> References: <20190724082031.45546-1-yasufum.o@gmail.com> <20191101090413.17997-1-yasufum.o@gmail.com> <20191101090413.17997-2-yasufum.o@gmail.com> In-Reply-To: <20191101090413.17997-2-yasufum.o@gmail.com> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNDMzOWQyNTUtYzNmZS00NzJhLTkyNzYtMzE4N2I0ZGYxOGQ0IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiNHJWZjIyNTlRWURYbERDRUYycGpRQlFSWVwvd2pDN3pXUDF3OFZ5NXlya0xcL3ZjZnVqVGlXd2R5UE4zeGtlWGJ1In0= x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v6 1/1] fbarray: fix duplicated fbarray file in secondary X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" >=20 > From: Yasufumi Ogawa >=20 > 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. >=20 > Cc: stable@dpdk.org >=20 > Signed-off-by: Yasufumi Ogawa > --- > lib/librte_eal/common/include/rte_fbarray.h | 2 +- > lib/librte_eal/linux/eal/eal_memalloc.c | 11 ++++++++--- > 2 files changed, 9 insertions(+), 4 deletions(-) >=20 > diff --git a/lib/librte_eal/common/include/rte_fbarray.h b/lib/librte_eal= /common/include/rte_fbarray.h > index 6dccdbec9..5c2815093 100644 > --- a/lib/librte_eal/common/include/rte_fbarray.h > +++ b/lib/librte_eal/common/include/rte_fbarray.h > @@ -39,7 +39,7 @@ extern "C" { > #include > #include >=20 > -#define RTE_FBARRAY_NAME_LEN 64 > +#define RTE_FBARRAY_NAME_LEN NAME_MAX >=20 > struct rte_fbarray { > char name[RTE_FBARRAY_NAME_LEN]; /**< name associated with an array */ > diff --git a/lib/librte_eal/linux/eal/eal_memalloc.c b/lib/librte_eal/lin= ux/eal/eal_memalloc.c > index af6d0d023..24f0275c9 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_l= ist *msl, > struct rte_memseg_list *primary_msl, *local_msl; > char name[PATH_MAX]; > int msl_idx, ret; > + char hostname[HOST_NAME_MAX] =3D { 0 }; >=20 > if (msl->external) > return 0; > @@ -1373,9 +1374,13 @@ secondary_msl_create_walk(const struct rte_memseg_= list *msl, > primary_msl =3D &mcfg->memsegs[msl_idx]; > local_msl =3D &local_memsegs[msl_idx]; >=20 > - /* 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, HOST_NAME_MAX); > + snprintf(name, RTE_FBARRAY_NAME_LEN, "%s_%s_%d", > + primary_msl->memseg_arr.name, hostname, (int)getpid()); >=20 > ret =3D rte_fbarray_init(&local_msl->memseg_arr, name, > primary_msl->memseg_arr.len, > -- Acked-by: Konstantin Ananyev > 2.17.1