From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f171.google.com (mail-pf0-f171.google.com [209.85.192.171]) by dpdk.org (Postfix) with ESMTP id 3952F2E8B for ; Tue, 11 Jul 2017 22:00:22 +0200 (CEST) Received: by mail-pf0-f171.google.com with SMTP id e7so1261626pfk.0 for ; Tue, 11 Jul 2017 13:00:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2lkSXoSmvfHwBH2JHBK48QmrqnSG0HqGtjYMggVRopw=; b=d2auD2BdRb8EMjZazEbyZMBy2BuGh+0XklDHbqKv/lfTex3TA1EYxqmF+BhcEn/7Qo FjJkBGCkLNj/ZdYHXwUje6o+8ojnxjCyE6V36/xtxmIwVSD2PQq1aNIoZbPYPjJx5jzr vGjcLT1pd0/P0RipVvs7xU68tP80/keWoC2chMld6dsFqRERI+hXsRDdbdHiVg7Sip+o INAynH+RtUExLHvFTJHWnvT8un2AVhvft2EeUWtWhLG6LgEE48ASNf/wCQpWEZDosv+O TLr1uXD5sMH2S+b6ETJoRP73i/Pq+eU0al33YeJu/veIzM+gaAO+z13KqiVr+VzJ8cgv SSnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2lkSXoSmvfHwBH2JHBK48QmrqnSG0HqGtjYMggVRopw=; b=dETu2jvonz0GIOnbse6XCxgQrrCG8eS2iD2PJcCp5IfX2V97QuWRAAeNYOkrk20wJb up4Sb2K2vkXfIMz5RFuIxGRMiK4FmYiNyYAK0O4S0jYzpNqlkKZXw2UMhT/vDGSxwAuN skI7sQaLuxXV67mf1JTxp5H5Ku84rz/o0wjj8xxEcDuOUNrP2whMhO4jH3l3OetPAELi /QNDDDVnNeD90EYXiQMzq7E+TrpcGGyBFdjPwPeuvzlW32tYly+HplelKu1AgOMuc2+n vATbnqlNEUECTDp65KxCI8OZ7umLfl3kuIir0p9rh4gxdumOSJj4n9pm0KFyqnxrUH0P tyFQ== X-Gm-Message-State: AIVw110l5p1Wn6P7HxmSQSPLbq2S30xAS2Sr9dS527GRgaoeL1QBQX02 GU22phFGD98by+7e X-Received: by 10.98.58.67 with SMTP id h64mr29540196pfa.19.1499803222115; Tue, 11 Jul 2017 13:00:22 -0700 (PDT) Received: from xeon-e3 (76-14-207-240.or.wavecable.com. [76.14.207.240]) by smtp.gmail.com with ESMTPSA id 68sm256629pfi.69.2017.07.11.13.00.21 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Jul 2017 13:00:22 -0700 (PDT) Date: Tue, 11 Jul 2017 13:00:14 -0700 From: Stephen Hemminger To: Sergio Gonzalez Monroy Cc: "Tan, Jianfeng" , "dev@dpdk.org" Message-ID: <20170711130014.402463a9@xeon-e3> In-Reply-To: <3f48cbd3-1e60-5a92-3929-7ba06e3cc69c@intel.com> References: <20170711011242.4606-1-stephen@networkplumber.org> <3f48cbd3-1e60-5a92-3929-7ba06e3cc69c@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Jul 2017 20:00:23 -0000 On Tue, 11 Jul 2017 12:35:39 +0100 Sergio Gonzalez Monroy wrote: > On 11/07/2017 02:56, Tan, Jianfeng wrote: > >> -----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 > >> > >> 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. > >> > >> Not sure if this is right, but it looks like a potential > >> problem. > >> > >> --- > >> lib/librte_eal/common/eal_common_pci_uio.c | 2 +- > >> 1 file changed, 1 insertion(+), 1 deletion(-) > >> > >> 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) > >> > >> void *mapaddr = 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 != 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 of a must even the VMA is not occupied yet. > > > > Thanks, > > Jianfeng > > How do you know the VMA is not occupied? > > I think the risk here is that the dynamic linker loaded some shared > library in that VMA, and forcing MAP_FIXED is not a safe solution. > What I have observed is that Linux will return a different VMA than the > one hinted when there is already a mapping in the requested/hinted VMA. > > I reckon this is a similar issue as we have with the multi-process model > when we do not get the VMA requested for the huge-pages. > AFAIK we do not have a robust solution for this issue other than restart > the program and hope the dynamic linker does not map anything in the VMA > ranges that we need to map from the primary. This is also assuming that > the application does not allocate memory and maps things before calling > eal_init as it could potentially use VMA ranges that we need in the > secondary process. > > The proposal for new secondary process model would solve these issues: > http://dpdk.org/ml/archives/dev/2017-May/066147.html > > Thanks, > Sergio That proposal defeats some of the isolation of secondary process model. The idea is that secondary could be built separately. It is also overly complex and would make a somewhat fragile part of the DPDK, more difficult.