From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <jianfeng.tan@intel.com>
Received: from mga03.intel.com (mga03.intel.com [134.134.136.65])
 by dpdk.org (Postfix) with ESMTP id 419DF5398
 for <dev@dpdk.org>; Tue, 11 Jul 2017 03:56:19 +0200 (CEST)
Received: from orsmga005.jf.intel.com ([10.7.209.41])
 by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 10 Jul 2017 18:56:18 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.40,343,1496127600"; d="scan'208";a="123504432"
Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206])
 by orsmga005.jf.intel.com with ESMTP; 10 Jul 2017 18:56:17 -0700
Received: from fmsmsx153.amr.corp.intel.com (10.18.125.6) by
 FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS)
 id 14.3.319.2; Mon, 10 Jul 2017 18:56:17 -0700
Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by
 FMSMSX153.amr.corp.intel.com (10.18.125.6) with Microsoft SMTP Server (TLS)
 id 14.3.319.2; Mon, 10 Jul 2017 18:56:17 -0700
Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.116]) by
 SHSMSX101.ccr.corp.intel.com ([169.254.1.197]) with mapi id 14.03.0319.002;
 Tue, 11 Jul 2017 09:56:15 +0800
From: "Tan, Jianfeng" <jianfeng.tan@intel.com>
To: Stephen Hemminger <stephen@networkplumber.org>, "dev@dpdk.org"
 <dev@dpdk.org>
Thread-Topic: [dpdk-dev] [RFC] pci: force address of mappings in secondary
 process
Thread-Index: AQHS+eLgyG6dcA8FKUmPJC0hVH7QXaJN3UYw
Date: Tue, 11 Jul 2017 01:56:15 +0000
Message-ID: <ED26CBA2FAD1BF48A8719AEF02201E365122F647@SHSMSX103.ccr.corp.intel.com>
References: <20170711011242.4606-1-stephen@networkplumber.org>
In-Reply-To: <20170711011242.4606-1-stephen@networkplumber.org>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
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-dev] [RFC] pci: force address of mappings in secondary
 process
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Tue, 11 Jul 2017 01:56:19 -0000


> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Stephen
> Hemminger
> Sent: Tuesday, July 11, 2017 9:13 AM
> To: dev@dpdk.org
> Cc: Stephen Hemminger
> Subject: [dpdk-dev] [RFC] pci: force address of mappings in secondary
> process
>=20
> The PCI memory resources in the secondary process should be in
> the exact same location as the primary process. Otherwise
> there is a risk of a stray pointer.
>=20
> Not sure if this is right, but it looks like a potential
> problem.
>=20
> ---
>  lib/librte_eal/common/eal_common_pci_uio.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>=20
> diff --git a/lib/librte_eal/common/eal_common_pci_uio.c
> b/lib/librte_eal/common/eal_common_pci_uio.c
> index 367a6816dcb8..2156b1a436c4 100644
> --- a/lib/librte_eal/common/eal_common_pci_uio.c
> +++ b/lib/librte_eal/common/eal_common_pci_uio.c
> @@ -77,7 +77,7 @@ pci_uio_map_secondary(struct rte_pci_device *dev)
>=20
>  			void *mapaddr =3D pci_map_resource(uio_res-
> >maps[i].addr,
>  					fd, (off_t)uio_res->maps[i].offset,
> -					(size_t)uio_res->maps[i].size, 0);
> +					(size_t)uio_res->maps[i].size,
> MAP_FIXED);
>  			/* fd is not needed in slave process, close it */
>  			close(fd);
>  			if (mapaddr !=3D uio_res->maps[i].addr) {
> --
> 2.11.0

+1 for this RFC. I also once encounter such problem, and I use the same way=
 to solve it. The addr parameter of mmap() syscall is only a hint instead o=
f a must even the VMA is not occupied yet.

Thanks,
Jianfeng