From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 3C95F2BE5 for ; Tue, 23 Jan 2018 16:18:13 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Jan 2018 07:18:12 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,401,1511856000"; d="scan'208";a="21944474" Received: from irsmsx108.ger.corp.intel.com ([163.33.3.3]) by FMSMGA003.fm.intel.com with ESMTP; 23 Jan 2018 07:18:10 -0800 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.236]) by IRSMSX108.ger.corp.intel.com ([169.254.11.167]) with mapi id 14.03.0319.002; Tue, 23 Jan 2018 15:18:10 +0000 From: "Ananyev, Konstantin" To: "Ananyev, Konstantin" , Thomas Monjalon CC: Matan Azrad , =?iso-8859-1?Q?Ga=EBtan_Rivet?= , "Wu, Jingjing" , "dev@dpdk.org" , Neil Horman , "Richardson, Bruce" Thread-Topic: [dpdk-dev] [PATCH v3 7/7] app/testpmd: adjust ethdev port ownership Thread-Index: AQHTlFybkKXIyPfmDE+7nPJrJamlyaOBkWTA Date: Tue, 23 Jan 2018 15:18:09 +0000 Message-ID: <2601191342CEEE43887BDE71AB9772588628270E@irsmsx105.ger.corp.intel.com> References: <1515318351-4756-1-git-send-email-matan@mellanox.com> <2601191342CEEE43887BDE71AB97725886282587@irsmsx105.ger.corp.intel.com> <2244903.IzFUvMzFb5@xps> <2601191342CEEE43887BDE71AB977258862826E0@irsmsx105.ger.corp.intel.com> In-Reply-To: <2601191342CEEE43887BDE71AB977258862826E0@irsmsx105.ger.corp.intel.com> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiOGUzOGVlYzktZmJkOC00NTU4LWJhY2YtYjNmYjNiMzE0MzAwIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6ImJUakRTK3dodUV6Ymo0NU91ZHdyVW9zXC8xTmtwcWFEK1NmcW9WbStqdkgwPSJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [163.33.239.181] Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v3 7/7] app/testpmd: adjust ethdev port ownership 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: , X-List-Received-Date: Tue, 23 Jan 2018 15:18:14 -0000 > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Ananyev, Konstantin > Sent: Tuesday, January 23, 2018 3:12 PM > To: Thomas Monjalon > Cc: Matan Azrad ; Ga=EBtan Rivet ; Wu, Jingjing ; > dev@dpdk.org; Neil Horman ; Richardson, Bruce > Subject: Re: [dpdk-dev] [PATCH v3 7/7] app/testpmd: adjust ethdev port ow= nership >=20 >=20 >=20 > > -----Original Message----- > > From: Thomas Monjalon [mailto:thomas@monjalon.net] > > Sent: Tuesday, January 23, 2018 2:19 PM > > To: Ananyev, Konstantin > > Cc: Matan Azrad ; Ga=EBtan Rivet ; Wu, Jingjing ; > > dev@dpdk.org; Neil Horman ; Richardson, Bruce > > Subject: Re: [PATCH v3 7/7] app/testpmd: adjust ethdev port ownership > > > > 23/01/2018 14:34, Ananyev, Konstantin: > > > If that' s the use case, then I think you need to set device ownershi= p at creation time - > > > inside dev_allocate(). > > > Again that would avoid such racing conditions inside testpmd. > > > > The devices must be allocated at a low level layer. >=20 > No one arguing about that. > But we can provide owner id information to the low level. >=20 > > When a new device appears (hotplug), an ethdev port should be allocated > > automatically if it passes the whitelist/blacklist policy test. > > Then we must decide who will manage this device. > > I suggest notifying the DPDK libs first. > > So a DPDK lib or PMD like failsafe can have the priority to take the > > ownership in its notification callback. >=20 > Possible, but seems a bit overcomplicated. > Why not just: >=20 > Have a global variable process_default_owner_id, that would be init once = at startup. > Have an LTS variable default_owner_id. > It will be used by rte_eth_dev_allocate() caller can set dev->owner_id at= creation time, > so port allocation and setting ownership - will be an atomic operation. > At the exit rte_eth_dev_allocate() will always reset default_owner_id=3D0= : >=20 > rte_eth_dev_allocate(...) > { > lock(owner_lock); > > owner =3D RTE_PER_LCORE(default_owner_id); > if (owner =3D=3D 0) > owner =3D process_default_owner_id; > set_owner(port, ..., owner); > unlock(owner_lock); > RTE_PER_LCORE(default_owner_id) =3D 0; Or probably better to leave default_owner_id reset to the caller. Another thing - we can use same LTS variable in all control ops to allow/disallow changing of port configuration based on ownership. Konstantin > } >=20 > So callers who don't need any special ownership - don't need to do anythi= ng. > Special callers (like failsafe) can set default_owenr_id just before call= ing hotplug > handling routine. >=20 > Konstantin >=20 >=20 >=20