From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by dpdk.org (Postfix) with ESMTP id 6602D1DB1 for ; Thu, 6 Apr 2017 12:06:16 +0200 (CEST) Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v369whdg097845 for ; Thu, 6 Apr 2017 06:06:15 -0400 Received: from e28smtp06.in.ibm.com (e28smtp06.in.ibm.com [125.16.236.6]) by mx0a-001b2d01.pphosted.com with ESMTP id 29nfmgnc7r-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 06 Apr 2017 06:06:15 -0400 Received: from localhost by e28smtp06.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 6 Apr 2017 15:36:12 +0530 Received: from d28relay01.in.ibm.com (9.184.220.58) by e28smtp06.in.ibm.com (192.168.1.136) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 6 Apr 2017 15:36:11 +0530 Received: from d28av07.in.ibm.com (d28av07.in.ibm.com [9.184.220.146]) by d28relay01.in.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v36A6Bue10158196 for ; Thu, 6 Apr 2017 15:36:11 +0530 Received: from d28av07.in.ibm.com (localhost [127.0.0.1]) by d28av07.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v36A6AqL022054 for ; Thu, 6 Apr 2017 15:36:10 +0530 Received: from chozha.in.ibm.com ([9.109.223.90]) by d28av07.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v36A6AFm022048; Thu, 6 Apr 2017 15:36:10 +0530 From: Chao Zhu To: dev@dpdk.org Cc: Gowrishankar , sergio.gonzalez.monroy@intel.com, david.marchand@6wind.com Date: Thu, 6 Apr 2017 15:36:09 +0530 X-Mailer: git-send-email 1.9.1 In-Reply-To: <1491473170-25160-1-git-send-email-chaozhu@linux.vnet.ibm.com> References: <1491473170-25160-1-git-send-email-chaozhu@linux.vnet.ibm.com> X-TM-AS-MML: disable x-cbid: 17040610-0020-0000-0000-000000E17422 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17040610-0021-0000-0000-000002A097F0 Message-Id: <1491473170-25160-2-git-send-email-chaozhu@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-04-06_08:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1702020001 definitions=main-1704060084 Subject: [dpdk-dev] [PATCH 1/2] eal/ppc: fix mmap for memory initialization 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: Thu, 06 Apr 2017 10:06:16 -0000 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; -- 1.8.3.1