From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 40CD5A04A2; Mon, 4 Nov 2019 11:15:00 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7A3F537A2; Mon, 4 Nov 2019 11:14:59 +0100 (CET) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id 9B8BA374C for ; Mon, 4 Nov 2019 11:14:56 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Nov 2019 02:14:55 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,266,1569308400"; d="scan'208";a="402931124" Received: from aburakov-mobl1.ger.corp.intel.com (HELO [10.237.220.92]) ([10.237.220.92]) by fmsmga006.fm.intel.com with ESMTP; 04 Nov 2019 02:14:53 -0800 To: "Wangyu (Turing Solution Development Dep)" , "dev@dpdk.org" Cc: "ferruh.yigit@intel.com" , Linuxarm , "humin (Q)" , "Liyuan (Larry)" , dengxiaofeng References: <1572680282-89785-1-git-send-email-dengxiaofeng@huawei.com> <78A93308629D474AA53B84C5879E84D24B0FF9AB@DGGEMM533-MBX.china.huawei.com> From: "Burakov, Anatoly" Message-ID: Date: Mon, 4 Nov 2019 10:14:52 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <78A93308629D474AA53B84C5879E84D24B0FF9AB@DGGEMM533-MBX.china.huawei.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH] lib/eal: resolve address conflicts 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 04-Nov-19 6:32 AM, Wangyu (Turing Solution Development Dep) wrote: > > Resolve address conflicts on 64K pagesize without base_virtaddr, which cause new address conflicts in eal_get_virtual_area(). > > Signed-off-by: Beard-627 > Acked-by: Eric wang > Acked-by: Wei Hu > Acked-by: Min Hu > --- > lib/librte_eal/linux/eal/eal.c | 22 ++++++++++++++++++++++ > 1 file changed, 22 insertions(+) > > diff --git a/lib/librte_eal/linux/eal/eal.c b/lib/librte_eal/linux/eal/eal.c index 946222c..c15d406 100644 > --- a/lib/librte_eal/linux/eal/eal.c > +++ b/lib/librte_eal/linux/eal/eal.c > @@ -360,6 +360,28 @@ enum rte_iova_mode > return -1; > } > > + if ((getpagesize() == RTE_PGSIZE_64K) && > + (internal_config.base_virtaddr == 0)) { > + > + munmap(rte_mem_cfg_addr, sizeof(*rte_config.mem_config)); > + rte_mem_cfg_addr = (void *)RTE_PTR_ALIGN_CEIL( > + (uintptr_t)rte_mem_cfg_addr, (size_t)RTE_PGSIZE_16M); > + rte_mem_cfg_addr = (void *)RTE_ALIGN_FLOOR( > + (uintptr_t)rte_mem_cfg_addr - > + sizeof(*rte_config.mem_config), sysconf(_SC_PAGE_SIZE)); Please use RTE_PTR_ADD and RTE_PTR_DIFF to perform pointer arithmetic. > + > + rte_mem_cfg_addr = mmap(rte_mem_cfg_addr, > + sizeof(*rte_config.mem_config), > + PROT_READ | PROT_WRITE, MAP_SHARED, mem_cfg_fd, 0); > + > + if (rte_mem_cfg_addr == MAP_FAILED) { > + close(mem_cfg_fd); > + mem_cfg_fd = -1; > + RTE_LOG(ERR, EAL, "Cannot mmap memory for rte_config\n"); > + return -1; > + } > + } > + > memcpy(rte_mem_cfg_addr, &early_mem_config, sizeof(early_mem_config)); > rte_config.mem_config = rte_mem_cfg_addr; > > -- > 1.8.3.1 > The patch requires a bit more explanation - what exactly is the problem, and why the solution is as above? Also, did you test it on the latest master, since the eal_get_virtal_area() patches [1] got merged? [1] http://patches.dpdk.org/project/dpdk/list/?series=7043&state=* -- Thanks, Anatoly