From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0058.outbound.protection.outlook.com [104.47.36.58]) by dpdk.org (Postfix) with ESMTP id 5DA5B5F38; Mon, 2 Apr 2018 07:35:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=dWWM6/0BAAv6EQxDWu+p2lQmtDW0cjrJhkEsl5iyoJE=; b=mFfHtu52qBhIUXhTiEKwsxgcz7r75Z2ekTGNh1psB0PTH7SLUXCX9PtrtZFCl1UjAVYjSb/I7kTydWWv1bsms1jxQ9xToHek8ZpGGEmhm5w1rtDL0EJuknSP7GmSbWym5Fqv/GzMhUd3zNlKyV/4SOp56liC4Jgo3U0aBv7zvlg= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Santosh.Shukla@cavium.com; Received: from [192.168.0.106] (103.76.56.167) by BLUPR0701MB1889.namprd07.prod.outlook.com (2a01:111:e400:5165::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.631.10; Mon, 2 Apr 2018 05:35:56 +0000 To: Anatoly Burakov , dev@dpdk.org Cc: thomas@monjalon.net, stable@dpdk.org References: <37c2e329be49799fae8328e4dd93e5c95da3d326.1522585461.git.anatoly.burakov@intel.com> <4868d2ccaffa1ae0d793fe10623d3e303a514ccf.1522585461.git.anatoly.burakov@intel.com> From: santosh Message-ID: <21509d3e-fc7f-bf00-ee7c-fa20b41ac228@caviumnetworks.com> Date: Mon, 2 Apr 2018 11:05:42 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <4868d2ccaffa1ae0d793fe10623d3e303a514ccf.1522585461.git.anatoly.burakov@intel.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US X-Originating-IP: [103.76.56.167] X-ClientProxiedBy: BM1PR0101CA0029.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:1a::15) To BLUPR0701MB1889.namprd07.prod.outlook.com (2a01:111:e400:5165::22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9a7da980-a25f-4ee2-609d-08d5985b9c91 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:BLUPR0701MB1889; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1889; 3:TgkjdVMMpzcjQ5QnU7D41/l/57bdj5dB2snOYbQeZnGu2DYZ/NeC5p30cEGnfxs9UW1BrsEq6EPq904t3AIkpyKsk4QrHubaS2jEl/0+h3ivG0ZHjFo6UE1Q3Oto4wjC/ZydVQivPYinT/94oIUgL8/n4GGgldXp99d/TUWw4kLU+MGLZN4wzwQCh6UxrqCLASbCNxolnUNTOZE3vuTaaQZbYaLKrCpRoKTdDC7ly8dIwMhK6nmyjBCFncWBfylv; 25:c8wwmUbjc2ByH1mWCmffCB1WF6Vo5DYq7lS4fNt50EQ/K83JFSmDTwnxmRvFGVzSQeBbva2PyOmn/dr7WmxYkoii2Cl2MoJOm9nd3vLKp8Yfwu2fQVQBc6t5iaXZqdjDVeBMuNyR9y6Qj6+JyVeWv4cytB1HCUlXxBErH/lwG85wiVpXf5qUMZuD2cxDhagWQ7syxRPVaZ3FHpX6bAw4I1blsvAPowFIm6krPc60/tCi5pjlSKKIAel/OJDPg1iRuMj4yj1Vl7mb6/qD9IpH6nzlUC1cIqCgtfPw3yNSaZcymsLnshOC2B67QE7NvIrrh+NdI3mxmH2CRMAxgVxDxw==; 31:aJ/mlnmRTAlFyAOqwz14Jf9/vqxLb8N+b0VDxG9rrnl4Ny4G+0hhig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xkdg8qYgNsUbzNvFk6bx49KZWxYQf2tPIkmodWB3pT/6kfZ7CrxaBYBrHYvTNIWj0p+Hl19ZN4UMlVlvtCQXyw/A19sqDJqXjJlpCwTTVCcyoB+stzuvt0Mhkt X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(3231221)(944501327)(52105095)(93006095)(3002001)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(6072148)(201708071742011); SRVR:BLUPR0701MB1889; BCL:0; PCL:0; RULEID:; SRVR:BLUPR0701MB1889; X-Forefront-PRVS: 0630013541 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6049001)(39380400002)(376002)(346002)(396003)(39850400004)(366004)(199004)(189003)(52116002)(36756003)(8676002)(97736004)(23676004)(305945005)(7736002)(8936002)(42882007)(31696002)(6486002)(86152003)(386003)(229853002)(81166006)(81156014)(5660300001)(59450400001)(6246003)(52146003)(2486003)(76176011)(31686004)(16526019)(53936002)(25786009)(117156002)(66066001)(106356001)(65826007)(26005)(77096007)(186003)(105586002)(47776003)(65806001)(6666003)(65956001)(476003)(4326008)(72206003)(478600001)(11346002)(50466002)(16576012)(58126008)(316002)(2616005)(956004)(486005)(230700001)(446003)(486005)(2906002)(68736007)(3846002)(6116002)(64126003); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0701MB1889; H:[192.168.0.106]; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCTFVQUjA3MDFNQjE4ODk7MjM6LzJiL0E0YXIrd3F2cll1MU5QZ1M0cmV3?= =?utf-8?B?c3VXR0tEWjFFN2ZHQzVJam4rOG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ErtQ5YAV/Lu3O1Rg=; 24:wTbcDyRtb+d9au0gtSlGdNXYioTwkSH8Bw+sHqrAIKH3nqud3REVC/W4Oyj7eN/OULonOSDtLqDoUfvj9OTDFCnRFBfvWK9zwFYw82Hwfn0= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1889; 7:O6O9gnK4LwxGDAgVfBPGYn2/B089rAOW4ppJO4TnYtYfUtzH4ouXTO7eRvrqu7CgMgvnueBXWdd6Lx/6mcpSVk8QHpAbkUjSX46exiUCr57W/jHXUgVvp5AjzQltoNBMv2dtfj7wond3cw/itdj/0XOT9fEA+mEMpIerGvI1TxR5gaHEijGigB0j40DEB8XbargXV+kWi67oBlqGkcFjPeS0zoWcG8wbXdfrCaf4iYsB54hKWxz3PVfo+wvQ1Ior X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2018 05:35:56.3869 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9a7da980-a25f-4ee2-609d-08d5985b9c91 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0701MB1889 Subject: Re: [dpdk-dev] [PATCH 2/4] eal: do not use physical addresses in IOVA as VA mode 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: Mon, 02 Apr 2018 05:36:00 -0000 On Sunday 01 April 2018 05:56 PM, Anatoly Burakov wrote: > 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 > --- > 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) { Also can be done like below: if (phys_addrs_available) /* find physical addresses for each hugepage */ if (find_iovaaddrs(&tmp_hp[hp_offset], hpi) < 0) { such that; find_iovaaddrs() --> rte_mem_virt2iova(). That way avoid iova check in above if loop. does that make sense? Thanks. [...]