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 CB50058CE for ; Tue, 23 Jan 2018 16:12:19 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Jan 2018 07:12:16 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,401,1511856000"; d="scan'208";a="12836260" Received: from irsmsx101.ger.corp.intel.com ([163.33.3.153]) by orsmga006.jf.intel.com with ESMTP; 23 Jan 2018 07:12:12 -0800 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.236]) by IRSMSX101.ger.corp.intel.com ([169.254.1.46]) with mapi id 14.03.0319.002; Tue, 23 Jan 2018 15:12:11 +0000 From: "Ananyev, Konstantin" To: Thomas Monjalon CC: Matan Azrad , =?iso-8859-1?Q?Ga=EBtan_Rivet?= , "Wu, Jingjing" , "dev@dpdk.org" , Neil Horman , "Richardson, Bruce" Thread-Topic: [PATCH v3 7/7] app/testpmd: adjust ethdev port ownership Thread-Index: AQHTkHpyuUKMeuPQw06Oud7boKI8uKN7InaggAAFDoCAAAQmUIAACAgAgAAXyICABIDDwIAAGvuAgAB1A3CAANJcgIAAP6aQgAAbAACAAAtPsA== Date: Tue, 23 Jan 2018 15:12:11 +0000 Message-ID: <2601191342CEEE43887BDE71AB977258862826E0@irsmsx105.ger.corp.intel.com> References: <1515318351-4756-1-git-send-email-matan@mellanox.com> <2601191342CEEE43887BDE71AB97725886282587@irsmsx105.ger.corp.intel.com> <2244903.IzFUvMzFb5@xps> In-Reply-To: <2244903.IzFUvMzFb5@xps> 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:12:20 -0000 > -----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 >=20 > 23/01/2018 14:34, Ananyev, Konstantin: > > If that' s the use case, then I think you need to set device ownership = at creation time - > > inside dev_allocate(). > > Again that would avoid such racing conditions inside testpmd. >=20 > The devices must be allocated at a low level layer. No one arguing about that. But we can provide owner id information to the low level. > 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. Possible, but seems a bit overcomplicated. Why not just: 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 c= reation 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: 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; } So callers who don't need any special ownership - don't need to do anything= . Special callers (like failsafe) can set default_owenr_id just before callin= g hotplug handling routine. =20 Konstantin