From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 766942B94 for ; Wed, 7 Nov 2018 17:53:55 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Nov 2018 08:53:54 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,476,1534834800"; d="scan'208";a="84071731" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga007.fm.intel.com with ESMTP; 07 Nov 2018 08:53:54 -0800 Received: from fmsmsx111.amr.corp.intel.com (10.18.116.5) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 7 Nov 2018 08:53:53 -0800 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by fmsmsx111.amr.corp.intel.com (10.18.116.5) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 7 Nov 2018 08:53:53 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.161]) by shsmsx102.ccr.corp.intel.com ([169.254.2.84]) with mapi id 14.03.0415.000; Thu, 8 Nov 2018 00:53:51 +0800 From: "Zhang, Qi Z" To: =?iso-8859-1?Q?Ga=EBtan_Rivet?= , Thomas Monjalon CC: "dev@dpdk.org" , "Yigit, Ferruh" Thread-Topic: [dpdk-dev] [PATCH] bus/vdev: fix probe same device twice Thread-Index: AQHUdWgBdNm8YH3IMkueZLyDXXxNA6VB7W2AgADwpZD//9HDAIAAMZgAgAGnR5A= Date: Wed, 7 Nov 2018 16:53:50 +0000 Message-ID: <039ED4275CED7440929022BC67E70611532E0AC3@SHSMSX103.ccr.corp.intel.com> References: <20181106003150.10560-1-qi.z.zhang@intel.com> <11443385.dze8hbQCXQ@xps> <039ED4275CED7440929022BC67E70611532E0279@SHSMSX103.ccr.corp.intel.com> <2180900.HKzicAuZ6Y@xps> <20181106233352.qhe7kuhgiexpvpih@bidouze.vm.6wind.com> In-Reply-To: <20181106233352.qhe7kuhgiexpvpih@bidouze.vm.6wind.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiY2Q5MDA5NTEtYmM4Yi00ZTFhLWE5NmItMjc3MGY5MmQ1MGUzIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoidkg4QjFUdmVJSG9GVnA1bDdnTk8zSnJWd1VRZFh5bG5JNDRVS2pVdmVGYXdjZFwvNzlvRFZXRDBaZXpSbTF1TTEifQ== x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] bus/vdev: fix probe same device twice 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: Wed, 07 Nov 2018 16:53:56 -0000 > -----Original Message----- > From: Ga=EBtan Rivet [mailto:gaetan.rivet@6wind.com] > Sent: Tuesday, November 6, 2018 4:34 PM > To: Thomas Monjalon > Cc: Zhang, Qi Z ; dev@dpdk.org; Yigit, Ferruh > > Subject: Re: [dpdk-dev] [PATCH] bus/vdev: fix probe same device twice >=20 > On Tue, Nov 06, 2018 at 09:36:22PM +0100, Thomas Monjalon wrote: > > 06/11/2018 16:46, Zhang, Qi Z: > > > From: Thomas Monjalon [mailto:thomas@monjalon.net] > > > > > > > > Hi, > > > > > > > > 06/11/2018 01:31, Qi Zhang: > > > > > When probe the same device at second time > > > > > > > > Sorry I stop on this first sentence. > > > > How and why do you probe a vdev twice? > > > > > > if we do rte_dev_hotplug_add or rte_dev_proble on a probed device. > > > (yes, this is not usually what an application want, but it can > > > happen by miss-operation, and this is covered by our test case, it > > > make sense to me that hotplug API should be robust enough to handle > > > that situation.) > > > > Yes I agree we must handle this situation. > > > > > we will failed at the second time as expected, but will not able to > > > detach the device any more, since during the second scan, original > vdev->device.devargs is corrupted. > > > > The root cause is we remove a devargs which was referenced. > > Could we overwrite the first devargs instead of removing it? > > > > >=20 > It's also possible to add a back-reference to an rte_device in [1], but t= hat can > only work if only one rte_device references a devargs. > It seems to be the case now, but it might be good to enforce explicitly t= hat > when a bus scans its devices, it should do a 1-to-1 map to devargs. >=20 > If mapping rte_device to rte_devargs needs to respect rules, it could hel= p bus > developpers to have a function that will do the job: verify that the deva= rgs is > not currently used, add the back-reference to the rte_device. >=20 > With the proper back-reference, it is possible to clean-up the device whe= n > removing the devargs=20 This may still not work for vdev, since the old reference is used in vdev_f= ind to find a exist device by name during scan. (For PCI device, we have pci_addr, but vdev we use devargs->name to identif= y device, anyway this can be fixed in vdev, but that required a clone on th= e device name also break the coupling somehow.) I just don't understand "why we must tight the tighten the device -> devarg= s coupling, not loosen it" (and also to add the rte_devargs_extract() function > that would allow keeping the original devargs and insert it back if the h= otplug > fails, then the mapping must be restored). >=20 > [1]: https://mails.dpdk.org/archives/dev/2018-November/118274.html >=20 > -- > Ga=EBtan Rivet > 6WIND