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 9A73CA04C5; Thu, 14 Nov 2019 18:32:31 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2F09D2BAF; Thu, 14 Nov 2019 18:32:31 +0100 (CET) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id E5132271; Thu, 14 Nov 2019 18:32:28 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Nov 2019 09:32:28 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,304,1569308400"; d="scan'208";a="216817046" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga002.jf.intel.com with ESMTP; 14 Nov 2019 09:32:27 -0800 Received: from fmsmsx112.amr.corp.intel.com (10.18.116.6) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 14 Nov 2019 09:32:27 -0800 Received: from FMSEDG002.ED.cps.intel.com (10.1.192.134) by FMSMSX112.amr.corp.intel.com (10.18.116.6) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 14 Nov 2019 09:32:27 -0800 Received: from NAM03-CO1-obe.outbound.protection.outlook.com (104.47.40.50) by edgegateway.intel.com (192.55.55.69) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 14 Nov 2019 09:32:27 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Kjy//1I/oD+eG75Db78AonwuPwb/80ple60SmjDG0t2hwuDBEnNZ7Gs6O4VGqfGFpqWnaTUIK+iSq4u29MX3wY24yRJJC4QaMGeOjiBln/ATTOky03sHEiOCKynPMY4OKeKryOT7Nm7ttjPDFfQZahIPjP5SkGy3t8yKRHUR6oQ7EZD4b61pOitDyn2Q9bozAwP0buLM7m+UQPNTilQMvphav0Dq2KegbKiixTKyrnRAfV0c3uY0O1vOXJz6PCunouyR6oI1feBeOTOBKTrtujPUXtwTiNR7/ogaEPgKDP5Zn0KRGib1nii1UouzvA+rdyVq2KjIwgBj8+odCaeMpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RQFi63dcB1bPcIPQCdZQhkoVQ9f5fljiSL7YPeGxXEU=; b=e9nZT0uXtr/7D4KJAuAKz4f54BKQs03Er3BgVHsMKWAv3HdJMQkYcmOZWVwLVmrTHVWvFGUrvsPvPLmZNg4zVFvfU3AmoYbHqG4w+2ZabepWJZ2142kDkBXj3usje3sm6OYDKx44PVlj8SbPv6cwdlvANy4rM0VZPNVVcZCQGWMebFe+JUvIMRb8sAaKL2hcQPktGbJhZ8ND+KEO+X0dVO1CqzR8m5cnOq2reSzRc57UzurAL7g4QarXazgCCo35jP1ndIKdjPCHyL1jh/L6etPnXxGdp4ODHJWAqm1cgF9SOmEVSL+cAOCQ2Ex3/MYsHEay5cKJ4jD9LZaxg2yg9g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RQFi63dcB1bPcIPQCdZQhkoVQ9f5fljiSL7YPeGxXEU=; b=uGSlIb0PZJcuUYCPQfI6o+DQ/KUPY//bqXuSCeeeuYPoLX3ZTpoNwdk32OTZMr8z12rzDToeUgZvqH+PvZqYUoIxiWrrKVGuVNfaJo54YfeDkI7Cw2C/sSiINW8DgSf07/QJ90Xhhk6312ZKYnUrPa4cPqy1aZGh0MszwgS/e9U= Received: from SN6PR11MB2558.namprd11.prod.outlook.com (52.135.91.13) by SN6PR11MB3085.namprd11.prod.outlook.com (52.135.126.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2451.26; Thu, 14 Nov 2019 17:32:24 +0000 Received: from SN6PR11MB2558.namprd11.prod.outlook.com ([fe80::19a4:37bc:d979:dd76]) by SN6PR11MB2558.namprd11.prod.outlook.com ([fe80::19a4:37bc:d979:dd76%5]) with mapi id 15.20.2451.027; Thu, 14 Nov 2019 17:32:24 +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 v7 1/1] fbarray: fix duplicated fbarray file in secondary Thread-Index: AQHVmmuNXQsB2OUbcUmPyXd9/1BcgqeK7fMQ Date: Thu, 14 Nov 2019 17:32:24 +0000 Message-ID: References: <20190724082031.45546-1-yasufum.o@gmail.com> <20191113214346.33749-1-yasufum.o@gmail.com> <20191113214346.33749-2-yasufum.o@gmail.com> In-Reply-To: <20191113214346.33749-2-yasufum.o@gmail.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYTk2YmQ1ZWMtZDJmOS00NjIzLWFhYjItZTVhYTNlNzBmMWI2IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoibThaRHViOVJjSGZhd2xSVFlJeWdqT3FJa21XNG9rbW5heTZyWE0wS1VKNlRjZnhRSVwvaTcrd05IRnFKcHByaG0ifQ== dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.2.0.6 x-ctpclassification: CTP_NT authentication-results: spf=none (sender IP is ) smtp.mailfrom=konstantin.ananyev@intel.com; x-originating-ip: [134.6.117.77] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: bc02d094-9443-46ff-da99-08d769289ccc x-ms-traffictypediagnostic: SN6PR11MB3085: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2089; x-forefront-prvs: 02213C82F8 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39860400002)(396003)(346002)(376002)(136003)(366004)(13464003)(189003)(199004)(446003)(71190400001)(25786009)(71200400001)(2906002)(81156014)(52536014)(5660300002)(81166006)(8676002)(66446008)(64756008)(66556008)(66476007)(66946007)(3846002)(6116002)(99286004)(7696005)(76176011)(26005)(53546011)(102836004)(6506007)(2501003)(66066001)(8936002)(76116006)(486006)(476003)(11346002)(74316002)(7736002)(86362001)(478600001)(186003)(14454004)(229853002)(110136005)(316002)(9686003)(6436002)(55016002)(4326008)(6246003)(54906003)(33656002)(305945005)(256004); DIR:OUT; SFP:1102; SCL:1; SRVR:SN6PR11MB3085; H:SN6PR11MB2558.namprd11.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: VqpaDw8qKdEMKCt/6u1G76Qh/WXz8dUvEdNs1tQx859qG6lHZ+3IQYEsODmcghU1P8phHzWlmNNLuFaQZyMyzn4VOEz53cf69O5LdPVhd3BokV1dskT8l9MRdKaw/J7BhPWhEha06a3Lgmh0yE0giBku9WaE8vIoPRQZbuTf+jMF8hxv2ZHyIFQKZtJ2mO1vRE6/ZYciuREHGD85NAnVY98SEVqAyTAkEulRNJSIPcW/pnVad3kZLVkgM53l2pKgK6UgMCm8hCW4un+0h4zEuDacvaWd8j6wqCf9d3ydTXLbXzR/1TzWnnIkyHV9TEtx8AO1OPkoKtZ5RrEP1IVF+Dncjt5wsI0W0GcZ3j8i7kwj85GjEQL1MK67JLNuL4hHL8K3NN3za2voiT5iIKuhGD9oOR1xdxN7WnTiGF2Xs43StqW474GXdDrb7oQqtNlR Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: bc02d094-9443-46ff-da99-08d769289ccc X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Nov 2019 17:32:24.5714 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 1LvTyFvG2uPNDUjOWfhuCDMxyNNZ5X7na6WX99+hCnOn8BLcgFRYUMO0nT/t9zMdfXlct+OE9nYlr//l0/rEu07G18FhBlZvrhjg7va7gj0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR11MB3085 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v7 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" > -----Original Message----- > From: yasufum.o@gmail.com > Sent: Wednesday, November 13, 2019 9:44 PM > To: Burakov, Anatoly ; david.marchand@redhat.c= om; Ananyev, Konstantin > Cc: dev@dpdk.org; stable@dpdk.org; yasufum.o@gmail.com; Yasufumi Ogawa > Subject: [PATCH v7 1/1] fbarray: fix duplicated fbarray file in secondary >=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/linux/eal/eal_memalloc.c | 16 +++++++++++++--- > 1 file changed, 13 insertions(+), 3 deletions(-) >=20 > diff --git a/lib/librte_eal/linux/eal/eal_memalloc.c b/lib/librte_eal/lin= ux/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] =3D { 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 =3D 32 + 7 + 1 + HOST_NAME_MAX + 1; Not sure, why do we need this calculation at all? Konstantin >=20 > if (msl->external) > return 0; > @@ -1373,9 +1379,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, sizeof(hostname)); > + snprintf(name, fbarray_sec_name_len, "%s_%d_%s", > + primary_msl->memseg_arr.name, (int)getpid(), hostname); >=20 > ret =3D rte_fbarray_init(&local_msl->memseg_arr, name, > primary_msl->memseg_arr.len, > -- > 2.17.1