From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0044.outbound.protection.outlook.com [104.47.41.44]) by dpdk.org (Postfix) with ESMTP id 48E87AA9B; Mon, 2 Apr 2018 15:02:39 +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=blbrLVQsk2fF1gW/qLGJJEeal5Cg7fhYBnnnsqCxyvg=; b=XZ0q3LfrnIJ8QU1hke6JdfngFAkGMJy775LemlGn7rAQUN21dRzkglRUDhQ/z4xMaw0XAREVfx5aSfvNHfGchW2aW7DhDmLr8WlTA+98yVKRRHkZ24guEoBX2dg4yIyEQjESaSbXf+jAf6Ay14iT2F8mT0MLbFRvDNbSPAqtb6M= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Santosh.Shukla@cavium.com; Received: from [192.168.0.106] (103.76.56.167) by BY1PR0701MB1894.namprd07.prod.outlook.com (2a01:111:e400:51ab::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.631.10; Mon, 2 Apr 2018 13:02:34 +0000 To: "Burakov, Anatoly" , 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> <21509d3e-fc7f-bf00-ee7c-fa20b41ac228@caviumnetworks.com> From: santosh Message-ID: Date: Mon, 2 Apr 2018 18:32:10 +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: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: en-US X-Originating-IP: [103.76.56.167] X-ClientProxiedBy: SG2PR02CA0002.apcprd02.prod.outlook.com (2603:1096:3:17::14) To BY1PR0701MB1894.namprd07.prod.outlook.com (2a01:111:e400:51ab::23) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b342e6b0-12ed-4590-556b-08d5989a01b9 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:BY1PR0701MB1894; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1894; 3:/WautrIpi+X48SKWZjlLnJ4IqizgXCfjlxpE1pqBMVN10H9j6jSWlPVP5mxkxBJN72GntQpoFbEV2lmDvPeORfLH/f465SuhSf/OyzSm5/2kGZ8F/HRyfWm561ecW6Q2wvE9/MHDi1prUQ3KOeCYmuY+DdAm0eupgwpF0U4inqGb4c/HqS+yTM3F2u2ldav5vLNZlcqwUqgGj0QCyBChT5GsUOMx85gqvbKsUFbI7xzf2MmJEfuKG+qmAbdnzdxy; 25:baxFq3qjfoEDmWrs8kj4ujLBe4eH7BhpDieQ1fgxmnfvVOu4J70duv70UAggS2gd3hpgnycNAwsnDhj8wvXmpScY2ShE9L49Y6BAZL0WamsTvkVEuQHOtFu9ng6Xm5EhUVTYq475eLDEmvH3pn7jIPkGhvISSi6I7xcqk73VAF8c9ZKNRrlHI8OPNJva1rVwlejU358aQbtvSpkUXCr60HHVH9o96M73OzVR5sgArAr3K6WmPBns601p6+iGXZCqCcPdy3su8Rp6zZ2U3mfwG+FtA1Uz4zjU5cJmWrg55tpsekINv/XLRsBqA7/4ger5ZYuaMaBS6AAdhfU+d8gNow==; 31:+0t1ztD5LyDcgC2wbk/Eqc7A18FXMOHWPHxbCruUiYAsnlE3rmhjybk4UyZNArkOSDbMHYvtqiM9Di/7b5Wo/tLdil2U+kng4U8njhaySj/Tjyge1X+B3ZN1CZp/7FT0K48Lh9G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4EL3TZewqs4fu9tbvPQjCh1OqLsygrrCSU 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)(8121501046)(5005006)(3231221)(944501327)(52105095)(10201501046)(3002001)(93006095)(6041310)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123558120)(20161123560045)(6072148)(201708071742011); SRVR:BY1PR0701MB1894; BCL:0; PCL:0; RULEID:; SRVR:BY1PR0701MB1894; X-Forefront-PRVS: 0630013541 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6049001)(39850400004)(396003)(366004)(39380400002)(376002)(346002)(189003)(199004)(2906002)(2870700001)(6116002)(3846002)(478600001)(186003)(31696002)(26005)(77096007)(42882007)(386003)(16526019)(53546011)(68736007)(486005)(956004)(65826007)(476003)(93886005)(5660300001)(305945005)(59450400001)(2616005)(11346002)(446003)(16576012)(316002)(7736002)(486005)(65956001)(31686004)(97736004)(6246003)(36756003)(106356001)(6486002)(47776003)(229853002)(76176011)(81156014)(6666003)(4326008)(65806001)(72206003)(53936002)(66066001)(117156002)(64126003)(81166006)(58126008)(105586002)(8676002)(52116002)(25786009)(52146003)(50466002)(8936002)(23676004)(2486003)(86152003); DIR:OUT; SFP:1101; SCL:1; SRVR:BY1PR0701MB1894; H:[192.168.0.106]; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCWTFQUjA3MDFNQjE4OTQ7MjM6VkRTV2VNZkRsYTlxdzlib2tYb0hvWTZO?= =?utf-8?B?RVVwZk5ORVQrVnhoaGdxVXFnNDBYNmRZKy90bHZZcnhHNEl5S1pWcUJnQU8w?= =?utf-8?B?WWF3NUdZUlM3L3JOSzU5OUpENlB1QnViRkdK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; 24:dy0XY3wPwtReyxxVgniPK6DwlUaGjOq67jAPM3lbEw1V0jsK9Q8ZlvFF30jXnbKhabJnyGkp3GhsoxK1ZEcOr6/OH29QDnMTFRqZ7bpMi/w= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1894; 7:IeK/lA583uVC/Ah319+JCxOMFQ+Skh3ANaOmHEFU0STOyj+v4qPFZEgS1XXNh45xwd26K6iwAall4WPuT0A6RDbHE074jpE0aRevu6K+HU3Xflnx+aOwra2wu2tNEh0iI4ZlQjnADjazA5/fVgS6SmaHcLeUAsuwHa/NJBvXlFxAfwxAffoJ4fYufaO8TqKQP9/s0s+O2YcxlCe/u6dkMWEITpXZaO4EaMmU/SbcAslXBQVYC9EbsND+asPaboIg X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2018 13:02:34.6132 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b342e6b0-12ed-4590-556b-08d5989a01b9 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0701MB1894 Subject: Re: [dpdk-stable] [PATCH 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: Mon, 02 Apr 2018 13:02:39 -0000 On Monday 02 April 2018 03:32 PM, Burakov, Anatoly wrote: > On 02-Apr-18 6:35 AM, santosh wrote: >> >> 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. >> [...] >> > > Hi, > > That was the initial implementation, however it doesn't work because we do two mappings, original and final, and physical addresses are found during original mappings (meaning, their VA's will be all over the place). We are interested in final VA as IOVA (after all of the sorting and figuring out which segments are contiguous), hence the current implementation. > Ok. Whole series, Acked-by: Santosh Shukla