From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sergio Gonzalez Monroy Subject: Re: [PATCH 1/2] eal/ppc: fix mmap for memory initialization Date: Thu, 13 Apr 2017 09:14:18 +0100 Message-ID: References: <1491473170-25160-1-git-send-email-chaozhu@linux.vnet.ibm.com> <1491473170-25160-2-git-send-email-chaozhu@linux.vnet.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Cc: Gowrishankar , david.marchand@6wind.com To: Chao Zhu , dev@dpdk.org Return-path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 3BCBC2C6E for ; Thu, 13 Apr 2017 10:14:21 +0200 (CEST) In-Reply-To: <1491473170-25160-2-git-send-email-chaozhu@linux.vnet.ibm.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 06/04/2017 11:06, Chao Zhu wrote: > On IBM POWER platform, when mapping /dev/zero file to hugepage memory > space, mmap will not respect the requested address hint. This will cause > the memory initilization for the second process fails. This patch adds > the required mmap flags to make it work. Beside this, users need to set > the nr_overcommit_hugepages to expand the VA range. When > doing the initilization, users need to set both nr_hugepages and > nr_overcommit_hugepages to the same value, like 64, 128, etc. > > Signed-off-by: Chao Zhu > --- > lib/librte_eal/linuxapp/eal/eal_memory.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c > index a956bb2..e06186b 100644 > --- a/lib/librte_eal/linuxapp/eal/eal_memory.c > +++ b/lib/librte_eal/linuxapp/eal/eal_memory.c > @@ -313,7 +313,11 @@ int rte_xen_dom0_supported(void) > } > do { > addr = mmap(addr, > +#ifndef RTE_ARCH_PPC_64 > (*size) + hugepage_sz, PROT_READ, MAP_PRIVATE, fd, 0); > +#else > + (*size) + hugepage_sz, PROT_READ, MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB, fd, 0); > +#endif > if (addr == MAP_FAILED) > *size -= hugepage_sz; > } while (addr == MAP_FAILED && *size > 0); > @@ -1330,7 +1334,11 @@ static int huge_wrap_sigsetjmp(void) > * use mmap to get identical addresses as the primary process. > */ > base_addr = mmap(mcfg->memseg[s].addr, mcfg->memseg[s].len, > +#ifndef RTE_ARCH_PPC_64 > PROT_READ, MAP_PRIVATE, fd_zero, 0); > +#else > + PROT_READ, MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB, fd_zero, 0); > +#endif > if (base_addr == MAP_FAILED || > base_addr != mcfg->memseg[s].addr) { > max_seg = s; Acked-by: Sergio Gonzalez Monroy