From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <thomas@monjalon.net>
Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com
 [66.111.4.27]) by dpdk.org (Postfix) with ESMTP id D0E131559;
 Sun, 30 Sep 2018 10:52:50 +0200 (CEST)
Received: from compute1.internal (compute1.nyi.internal [10.202.2.41])
 by mailout.nyi.internal (Postfix) with ESMTP id DF86C21908;
 Sun, 30 Sep 2018 04:52:48 -0400 (EDT)
Received: from mailfrontend2 ([10.202.2.163])
 by compute1.internal (MEProxy); Sun, 30 Sep 2018 04:52:48 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h=
 cc:content-transfer-encoding:content-type:date:from:in-reply-to
 :message-id:mime-version:references:subject:to:x-me-sender
 :x-me-sender:x-sasl-enc; s=mesmtp; bh=yOCIILDVPa9+QdATsQrdpDJ5OG
 pjNjvKavXG9k2wsqM=; b=JybCwmgLUcZ3iO9cusZDnDSmsVsK56niVF3xPzwxUH
 UC+gN5chbdGV4aNHWQUF9KNtZpQYLHM0sWJb37nvyOFgwR56GBigsHgywwNYrMKp
 E5yYkoUNWtpYfZDMN3HCQMC1LFBpRryx8fcNkNtlkNu1Kqvzvjl8H4qfIUmMcQRP
 k=
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:content-transfer-encoding:content-type
 :date:from:in-reply-to:message-id:mime-version:references
 :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=yOCIIL
 DVPa9+QdATsQrdpDJ5OGpjNjvKavXG9k2wsqM=; b=KwVZXJBjA1T0UMARmLx7/6
 bwh4OZ9IU2XEMUwrrVscT2wi0wYJLKUkYNriJGc/+l+2qEGgglaFn7sJlJclO4tm
 xXpsgYqyFUcPZw34xva0L8OZia5F5J1fOUwaWP7NWD8GM86BnVu/o3xo7S48T8TH
 LIJ8/lqhzP6l2Y6sb3X0k+4Ra1VN/Xn++Af0jQcdyKVyegLSC0+1DozSpjji52yq
 P1kqHvmDJqyHyyzJRdeTcP9r8sXRgfJ2JKPnQnPJYKbrjqnfjKRzx5pOS6NtbYTI
 BJ5h11gDZ9KabvAl0gw0YjaUI7nu79IX7bM4G3saKyeyhwshekEvv1b4ijs+A3vA
 ==
X-ME-Proxy: <xmx:4I6wWykwHPoQd20FgyFvBYqyeYVww-zqjKpEiepiY904P2CGk1PJcQ>
 <xmx:4I6wW7uUfeLjEOd-uLZkvr73NoZf6hKlPguRTOmFkR9aYzCWH8uf_A>
 <xmx:4I6wW1Ps-WcjygFeAeTYAViJMGh3MOKoYEmgHwHECAzLTXR24PVByw>
 <xmx:4I6wW0MyixWrac57N-vb-1aO-_ZuEGC_ahfPZxmWn_UGdH4guhBsNw>
 <xmx:4I6wW94gGceYk9PE3e9an37swUQ9RAZbFo1eLZ56_LwhnR5DcZ78dg>
 <xmx:4I6wW8gCRyRYFRJLvQWun_-TjCcx3Sxc_ynfrEi3mMqPM3Wk5ppt3g>
X-ME-Sender: <xms:4I6wWwyKTpbUXhKIpZecqtsDXqM_i_cVasteqs_kjgKOqYYt7TNC8Q>
Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184])
 by mail.messagingengine.com (Postfix) with ESMTPA id 3C9E2102D2;
 Sun, 30 Sep 2018 04:52:47 -0400 (EDT)
From: Thomas Monjalon <thomas@monjalon.net>
To: "Zhang, Qi Z" <qi.z.zhang@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>, "Burakov,
 Anatoly" <anatoly.burakov@intel.com>, "Yigit, Ferruh" <ferruh.yigit@intel.com>,
 "geoffrey.lv@gmail.com" <geoffrey.lv@gmail.com>,
 "ajit.khaparde@broadcom.com" <ajit.khaparde@broadcom.com>,
 "stable@dpdk.org" <stable@dpdk.org>
Date: Sun, 30 Sep 2018 10:52:45 +0200
Message-ID: <384590219.OtUJQTVY6u@xps>
In-Reply-To: <039ED4275CED7440929022BC67E70611532A7E71@SHSMSX103.ccr.corp.intel.com>
References: <20180903084005.29706-1-qi.z.zhang@intel.com>
 <14389377.uLlNGEYteW@xps>
 <039ED4275CED7440929022BC67E70611532A7E71@SHSMSX103.ccr.corp.intel.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="us-ascii"
Subject: Re: [dpdk-dev] [PATCH] bus/pci: fix unexpected resource mapping
	override
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Sun, 30 Sep 2018 08:52:51 -0000

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 device 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->scan's independency.

I don't understand why we are currently changing an already scanned device
in pci_scan_one.
We could check the PCI address is known at the beginning and stop here,
even before allocating a new rte_pci_device.
Why trying to override with this memmove?