From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id B029C1B16A; Wed, 3 Oct 2018 15:03:51 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Oct 2018 06:03:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,336,1534834800"; d="scan'208";a="79530306" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga006.jf.intel.com with ESMTP; 03 Oct 2018 06:03:37 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 3 Oct 2018 06:03:36 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.245]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.27]) with mapi id 14.03.0319.002; Wed, 3 Oct 2018 21:03:34 +0800 From: "Zhang, Qi Z" To: Thomas Monjalon CC: "dev@dpdk.org" , "Burakov, Anatoly" , "Yigit, Ferruh" , "geoffrey.lv@gmail.com" , "ajit.khaparde@broadcom.com" , "stable@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] bus/pci: fix unexpected resource mapping override Thread-Index: AQHUQ2GagQQ7QW6vRU2h4SDUxq2P+qUCMvuAgASUheCAAWGJgIAFe4Yw Date: Wed, 3 Oct 2018 13:03:34 +0000 Message-ID: <039ED4275CED7440929022BC67E70611532A99B5@SHSMSX103.ccr.corp.intel.com> References: <20180903084005.29706-1-qi.z.zhang@intel.com> <14389377.uLlNGEYteW@xps> <039ED4275CED7440929022BC67E70611532A7E71@SHSMSX103.ccr.corp.intel.com> <384590219.OtUJQTVY6u@xps> In-Reply-To: <384590219.OtUJQTVY6u@xps> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNWE3ZTdhYjYtOGY5ZC00NjhhLTgzYzMtNGJhOTQ5MTE5YmRmIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiVHpmN0ZWMzVHS1BwOGt1Y0pucUtcL0lmZVwvRGozcjR0Sk5RZWxSOGZQK0hHbDdNM1FQNExEelVaRDFlRFY5eXRRIn0= 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="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH] bus/pci: fix unexpected resource mapping override X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Oct 2018 13:03:52 -0000 > -----Original Message----- > From: Thomas Monjalon [mailto:thomas@monjalon.net] > Sent: Sunday, September 30, 2018 4:53 PM > To: Zhang, Qi Z > Cc: dev@dpdk.org; Burakov, Anatoly ; Yigit, > Ferruh ; geoffrey.lv@gmail.com; > ajit.khaparde@broadcom.com; stable@dpdk.org > Subject: Re: [dpdk-dev] [PATCH] bus/pci: fix unexpected resource mapping > override >=20 > 29/09/2018 08:43, Zhang, Qi Z: > > From: Thomas Monjalon [mailto:thomas@monjalon.net] > > > > > > Hi, > > > > > > 03/09/2018 10:40, Qi Zhang: > > > > When scanning an already plugged device, the virtual address of > > > > mapped PCI resource in rte_pci_device will be overridden with 0, > > > > that may cause driver does not work correctly. > > > > > > Why is it overridden with 0? > > > Can we try to fix the root cause? > > > > From my view this is place to fix the issue: "scan an already probed de= vice > will corrupt the PCI resource map" > > Another option is "to prevent scan an already probed device", this can = be > implemented by adding some check before bus->scan in rte_dev_hotplug_add > but I'm not prefer for this solution, because it's better to keep bus->sc= an's > independency. >=20 > I don't understand why we are currently changing an already scanned devic= e in > pci_scan_one. OK, this need to be figured out, due to hotplug, bus scan is unpredictable,= so between two scans, something could happen device maybe be unbound then bound with a different driver, or vf number is= changed, so device information need to be updated. but I'm not sure if resource mapping address ( read from /sys/bus/pci/devic= es//resource) is possible be changed or not.=20 Though I don't have evidence that it is possible, but the patch respect the= original assumption that it is possible, so I keep memmove here. But I will not be surprise if It should be removed and the assumption is no= t correct. =20 > We could check the PCI address is known at the beginning and stop here, e= ven > before allocating a new rte_pci_device. Yes we could check this at beginning, which means we need to figure out the= rte_device by a pci address , then call rte_dev_is_probed(dev), I think th= at require another iterate on rte_pci_bus->device_list. So, the benefit of a lazy check is we could merge this iterate with the ite= rate for device information update, and I don't have strong option for both= options > Why trying to override with this memmove? comment in my first segment. >=20