From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id A7A8C1C693; Wed, 4 Apr 2018 16:40:51 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Apr 2018 07:40:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,406,1517904000"; d="scan'208";a="188604269" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga004.jf.intel.com with ESMTP; 04 Apr 2018 07:40:48 -0700 Received: from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com [10.237.217.45]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id w34Eem5g005966; Wed, 4 Apr 2018 15:40:48 +0100 Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id w34EemBM018282; Wed, 4 Apr 2018 15:40:48 +0100 Received: (from aburakov@localhost) by sivswdev01.ir.intel.com with LOCAL id w34Eemli018265; Wed, 4 Apr 2018 15:40:48 +0100 From: Anatoly Burakov To: dev@dpdk.org Cc: thomas@monjalon.net, santosh.shukla@caviumnetworks.com, stable@dpdk.org Date: Wed, 4 Apr 2018 15:40:45 +0100 Message-Id: <10b7adda142a37b153852076bacec007fb8aa132.1522852799.git.anatoly.burakov@intel.com> X-Mailer: git-send-email 1.7.0.7 In-Reply-To: <277e34838d0f99ed0463ca2a1b8ce6b1dc9583b1.1522852799.git.anatoly.burakov@intel.com> References: <277e34838d0f99ed0463ca2a1b8ce6b1dc9583b1.1522852799.git.anatoly.burakov@intel.com> In-Reply-To: References: Subject: [dpdk-stable] [PATCH v3 2/4] eal: do not use physical addresses in IOVA as VA mode X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Apr 2018 14:40:52 -0000 We already use VA addresses for IOVA purposes everywhere if we're in RTE_IOVA_VA mode: 1) rte_malloc_virt2phy()/rte_malloc_virt2iova() always return VA addresses 2) Because of 1), memzone's IOVA is set to VA address on reserve 3) Because of 2), mempool's IOVA addresses are set to VA addresses The only place where actual physical addresses are stored is in memsegs at init time, but we're not using them anywhere, and there is no external API to get those addresses (aside from manually iterating through memsegs), nor should anyone care about them in RTE_IOVA_VA mode. So, fix EAL initialization to allocate VA-contiguous segments at the start without regard for physical addresses (as if they weren't available), and use VA to set final IOVA addresses for all pages. Fixes: 62196f4e0941 ("mem: rename address mapping function to IOVA") Cc: thomas@monjalon.net Cc: stable@dpdk.org Signed-off-by: Anatoly Burakov Acked-by: Santosh Shukla --- Notes: v3: - Added missing ack from Santosh lib/librte_eal/linuxapp/eal/eal_memory.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c index 38853b7..ecf375b 100644 --- a/lib/librte_eal/linuxapp/eal/eal_memory.c +++ b/lib/librte_eal/linuxapp/eal/eal_memory.c @@ -473,6 +473,9 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi, hugepg_tbl[i].orig_va = virtaddr; } else { + /* rewrite physical addresses in IOVA as VA mode */ + if (rte_eal_iova_mode() == RTE_IOVA_VA) + hugepg_tbl[i].physaddr = (uintptr_t)virtaddr; hugepg_tbl[i].final_va = virtaddr; } @@ -1091,7 +1094,8 @@ rte_eal_hugepage_init(void) continue; } - if (phys_addrs_available) { + if (phys_addrs_available && + rte_eal_iova_mode() != RTE_IOVA_VA) { /* find physical addresses for each hugepage */ if (find_physaddrs(&tmp_hp[hp_offset], hpi) < 0) { RTE_LOG(DEBUG, EAL, "Failed to find phys addr " -- 2.7.4