From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10085.outbound.protection.outlook.com [40.107.1.85]) by dpdk.org (Postfix) with ESMTP id 602DB1B439 for ; Thu, 11 Oct 2018 12:40:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xHF1NQhtLGxNpd7NbIS23N46fqHA6uynpKRgh9wfa0M=; b=mIX8JIMRunMcJJMhZvHqvTd1Eg43HGJusvltOQeJ4cG389IJDja09tVE4o+OcAjMWDnXqtKsx17zdPFaTkLBKa3gE1btHDbSfIZmBCzbSKiJNyIIFm8Ev9HJ+OUGPLJV783h5C/TE2ktVtTUE5agdO2C2TyaWUx+bTw4aZQvWQg= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=shreyansh.jain@nxp.com; Received: from [10.232.14.39] (14.142.187.166) by DB7PR04MB4683.eurprd04.prod.outlook.com (2603:10a6:5:37::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1207.28; Thu, 11 Oct 2018 10:40:01 +0000 To: "Burakov, Anatoly" Cc: ferruh.yigit@intel.com, dev@dpdk.org References: <20180925125423.7505-1-shreyansh.jain@nxp.com> <20180925125423.7505-4-shreyansh.jain@nxp.com> <894130a9-017c-348d-31f8-c4c23f517f25@nxp.com> <2d2e9008-fb5b-3ecd-2d2c-e86250f5d363@nxp.com> <5e153c76-6eaa-e6a5-28ed-7cec191d4581@intel.com> <2c377b57-c418-5c03-a23d-5da91ef898d0@nxp.com> <16940ff0-278c-2376-1a86-6beaf0770a09@nxp.com> <4f10749d-b6e8-e257-0606-2fbb3c1e3d76@intel.com> From: Shreyansh Jain Message-ID: <2fdcf7ac-6bed-00b6-1601-b816cffc613a@nxp.com> Date: Thu, 11 Oct 2018 16:09:34 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <4f10749d-b6e8-e257-0606-2fbb3c1e3d76@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [14.142.187.166] X-ClientProxiedBy: BM1PR01CA0101.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00::17) To DB7PR04MB4683.eurprd04.prod.outlook.com (2603:10a6:5:37::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d3d590ba-bb0d-4b17-8c69-08d62f65e661 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:DB7PR04MB4683; X-Microsoft-Exchange-Diagnostics: 1; DB7PR04MB4683; 3:V1FK0P6cajV8EAbUHmOLlYRxwdkRKrv+DFkbNxoT0pDgkvE87rw4TzXnQV994NOUvixCaAyVqpGD4rQ7p+otV8f4v5VqnDPs8Q0vwXylIsxLh4QhD3aq/lJoUcbSIaX+2v+5/kvfU+lAC4We0IFEnrUxOPjcXzwfmIw4wk3AhBKgrIK+uHigp5yAXImIgmALnGXcOKvrWnM8M/dUItnEg1KaC5N/7yM+ZKeuZVOfaxEUI7lLVJYsQop2n8iiYvCn; 25:PeYzOq1HfKed/59x++nb92sqjPEJ2aYeod5jFtFe1WN8eQCp+0IR/RchMH6jqq3eWQPyN+8UqDPSd5t0f/elPUYJDhziXs2Z2rOaj267tSIkyjUN9Du/2lw1sS/364h23muTkBvVBU0Wfo7oyo0crqYNzM/kGO/GFi0zhW3L+IERfN07xdaw4HhSggkQOFwLk2PZAWdXEBnsF9vKOUx3lbcNe+dqNfbPgd7Th4VP7E/ImX/BakhCasB/lfAvrcHpyiFxZyU02DOoR+K2BNKSPsk0O5S038jqg0664P13djgqcZqzSnVs5pYdFrTn2cbffAIwXSOR4c5oMhjpWW6ZJTvYMDQag5mI7t5FpRY8X/4=; 31:3z2dcYq9dZnsGd5DMr22/wVnBEsMAB094jQvRIPoIejBpP8JR9TGTFt9YTHA8rAMP5SqhY4kG/f0h8JPryzNE6w8zihq1SwjhGOuKvV3MkCyt6znYmurTivAiLKZ7IDnckT9zmOKonQ0QK3ddEdK92qQvFy/zb1O8wwsS8UsJp4snLJJp6EpbDYGJhviNibIa8act2ZgSL7vekmk76vpYBHtaJC6usk+hyadXUsQgAE= X-MS-TrafficTypeDiagnostic: DB7PR04MB4683: X-Microsoft-Exchange-Diagnostics: 1; DB7PR04MB4683; 20:8ejPHxsKXOVLEw1I8m9SamBQ8bvmHAjFFMk0SPAPEodlhk3KaVwSoIKbeLSStTDV/Ggm206Xper4jvhOf0d0nUjCG7jmCRy++2bTOup07JFpggVIkhXXkfh4Se/nRyxURRxsf0WjieOmohdhcAgMVOJF4O5WfP8IYI/6D3UjVs2OG7LFep9ILD9aGpeDk+K/aySQ86GgG2KuJBWXXqSkyy3hRA1o2WtjGV07RWux3EacKPnB08tXVcweu4bvxdQe5ugx7EpWr6IiJaf40yq4r6uvUaKzF2PE73lV7dJ2109eRYBEdqdTdJvcjvozCa9cA2gy19hlKoQLo1KKpHdpwpff8u7Coiltf+rtVpb714rpkJkeORHNX+7EFctOXSPapJaEnp1vGKaRqyjGN+69ZQSognXFE6ltprSrS1XeO4FrtxOxftPGY0t5RzAjHA6Sx2wrO7LxAVXy8du/EWhAQTwkcW2RkLvf593CVDvTs9EkUP6GILn9IMW07vdzCJ8u; 4:HDnkvJYDhluyq/r8PucTen21AgUXkQWucplj5IpzIRf/+KKDDlQG7GjzHWtzns4yuVsOV/lI19kiizFSOR0EqXm+qKvdQlRpHaWmtnxRnTGEZSTfVihMR7uhxlLukbIoo6p+5PO5zdlt7b3r4ly1T2yqSHHu2hv7vBREpgYhzuUv4uZNYOSJMXeLkcDG7nNAWTG6KhHnqM3+rLVutL2+NxIT6pff0t2tHJchDNiLhqi2fOl1XbdQxeN5z+5QuM+mWYsBjCUY24TPI20cOWwrlZvMc7h2g9U/xvjJZIoTqlMAZWOiaq/JaMbh/bl1rMrOvyUsNGYo2hBeoc7DNg7xS7L3H1TfzPe9bIxpIoTBpak= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(163750095850)(278428928389397); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231355)(944501410)(52105095)(3002001)(10201501046)(93006095)(93001095)(6055026)(149066)(150057)(6041310)(20161123560045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(201708071742011)(7699051); SRVR:DB7PR04MB4683; BCL:0; PCL:0; RULEID:; SRVR:DB7PR04MB4683; X-Forefront-PRVS: 08220FA8D6 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6049001)(39860400002)(346002)(366004)(136003)(376002)(396003)(189003)(199004)(386003)(86362001)(52116002)(52146003)(31696002)(2486003)(305945005)(76176011)(23676004)(53936002)(53546011)(316002)(7736002)(5660300001)(36756003)(97736004)(229853002)(67846002)(44832011)(105586002)(6486002)(16526019)(186003)(81166006)(106356001)(93886005)(14444005)(77096007)(8676002)(81156014)(31686004)(478600001)(66066001)(65956001)(26005)(68736007)(6916009)(2906002)(65806001)(4326008)(25786009)(16576012)(55236004)(50466002)(64126003)(956004)(2616005)(58126008)(486006)(476003)(2870700001)(11346002)(446003)(47776003)(6246003)(65826007)(8936002)(6666004)(6116002)(3846002)(1006002)(110426005); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR04MB4683; H:[10.232.14.39]; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: nxp.com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B1AE1yvSdHAS/U4T/xjoJ+Dbci3Nqde8HgIgTdfN9nISgyFOLTwIAQxq54yt5UQUauKoMQZ2/86frFIEpla7t0TfoKaQXUZ3O0uEY1sMb6Fo3CftlIDI9ivEbIteQzy0UOErvFu14Jyoa7tgvFdBDqNym8WdkMHE3sZ4QKc+2gXYR37ZDo6QYgZmpLHbv9Zv5vnyAXwk2KeKHZb7FIUmWPfSeRZcH4+I/RoP8kMRM6PviquA7xssw1Z33TMa0Ymrtdn1VvuUWeivvRL41asdSuMTpBlQSB3/yWXfzw==; 5:+ck+GlG7BVr8Rla7f8fPB4eXsnw5BcyQa2drjNiVq2rVrelt828Yi4Lq0/k0v+bnb4gaP4HNkXn0959QcgFlrDtrOmxBlz2f/pstFhallm+8pyawfpLEHR8wk+tKLft8ZKmOVNExvSZC1qWhuMSXrl0+pe5vcSs9/gTsWs0EprE=; 7:6lJMN90QcsmcrcHO683ktzpAKMd1zg1c0HRNmCfTNJ9ntSao5uoM8dYYf6w7fC5kAgMEjoWWgfPzDd78nZy4ZPM5bUqCzsKZjbIgpOhHAxILpFOBOTUH/I0JdQo/8uVTU4+0Pl6sZRRVYPlgGZ1mtFK8TSZukbSMBlD6q3b2LIXLwpxPgtFsrXvpMMzOVQiC4JTFW6t2TgLiwZb0PvifKWmgzn+eNxfgHlCZSKXVE9axFaJgACTKGKHw5xifdmZf SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2018 10:40:01.4222 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d3d590ba-bb0d-4b17-8c69-08d62f65e661 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR04MB4683 Subject: Re: [dpdk-dev] [PATCH 3/5] common/dpaax: add library for PA VA translation table 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, 11 Oct 2018 10:40:03 -0000 On Thursday 11 October 2018 03:43 PM, Burakov, Anatoly wrote: > On 11-Oct-18 11:07 AM, Shreyansh Jain wrote: >> On Thursday 11 October 2018 03:32 PM, Shreyansh Jain wrote: >>> On Thursday 11 October 2018 02:33 PM, Burakov, Anatoly wrote: >>>> On 09-Oct-18 11:45 AM, Shreyansh Jain wrote: >>>>> On Tuesday 25 September 2018 07:09 PM, Shreyansh Jain wrote: >>>>>> Hello Anatoly, >>>>>> >>>>>> On Tuesday 25 September 2018 06:58 PM, Burakov, Anatoly wrote: >>>>>>> On 25-Sep-18 1:54 PM, Shreyansh Jain wrote: >>>>>>>> A common library, valid for dpaaX drivers, which is used to >>>>>>>> maintain >>>>>>>> a local copy of PA->VA translations. >>>>>>>> >>>>>>>> In case of physical addressing mode (one of the option for >>>>>>>> FSLMC, and >>>>>>>> only option for DPAA bus), the addresses of descriptors Rx'd are >>>>>>>> physical. These need to be converted into equivalent VA for >>>>>>>> rte_mbuf >>>>>>>> and other similar calls. >>>>>>>> >>>>>>>> Using the rte_mem_virt2iova or rte_mem_virt2phy is expensive. This >>>>>>>> library is an attempt to reduce the overall cost associated with >>>>>>>> this translation. >>>>>>>> >>>>>>>> A small table is maintained, containing continuous entries >>>>>>>> representing a continguous physical range. Each of these entries >>>>>>>> stores the equivalent VA, which is fed during mempool creation, or >>>>>>>> memory allocation/deallocation callbacks. >>>>>>>> >>>>> >>>>> [...] >>>>> >>>>>> >>>>>>> >>>>>>> Also, a couple of nitpicks below. >>>>>>> >>>>>>>>   cosnfig/common_base                            |   5 + >>>>>>>>   config/common_linuxapp                        |   5 + >>>>>>>>   drivers/common/Makefile                       |   4 + >>>>>>>>   drivers/common/dpaax/Makefile                 |  31 ++ >>>>>>>>   drivers/common/dpaax/dpaax_iova_table.c       | 509 >>>>>>>> ++++++++++++++++++ >>>>>>>>   drivers/common/dpaax/dpaax_iova_table.h       | 104 ++++ >>>>>>>>   drivers/common/dpaax/dpaax_logs.h             |  39 ++ >>>>>>>>   drivers/common/dpaax/meson.build              |  12 + >>>>>>> >>>>>>> >>>>>>> >>>>>>>> +    DPAAX_DEBUG("Add: Found slot at (%"PRIu64")[(%zu)] for >>>>>>>> vaddr:(%p)," >>>>>>>> +            " phy(%"PRIu64"), len(%zu)", entry[i].start, e_offset, >>>>>>>> +            vaddr, paddr, length); >>>>>>>> +    return 0; >>>>>>>> +} >>>>>>>> + >>>>>>>> +int >>>>>>>> +dpaax_iova_table_del(phys_addr_t paddr, size_t len __rte_unused) >>>>>>> >>>>>>> len is not unused. >>>>>> >>>>>> I will fix this. >>>>>> Actually, this function itself is useless - more for symmetry reason. >>>>>> Callers would be either simply updating the table, or ignoring it >>>>>> completely. But, yes, this is indeed wrong that I set that unused. >>>>>> >>>>> >>>>> Actually, I was wrong in my first reply. In case of >>>>> dpaax_iova_table_del(), len is indeed redundant. This is because >>>>> the mapping is for a complete page (min of 2MB size), even if the >>>>> request is for lesser length. So, removal of a single entry (of >>>>> fixed size) would be done. >>>>> >>>>> In fact, while on this, I think deleting a PA->VA entry itself is >>>>> incorrect (not just useless). A single entry (~2MB equivalent) can >>>>> represent multiple users (working on a rte_malloc'd area, for >>>>> example). So, effectively, its always an update - not an add or del. >>>> >>>> I'm not sure what you mean here. If you got a mem event about memory >>>> area being freed, it's guaranteed to *not* have any users - neither >>>> malloc, nor any other memory. And len is always page-aligned. >>> >>> ok. Maybe I am getting this wrong, but consider this: >>> >>> 1) hugepage size=2MB >>> 2) a = malloc(1M) >>>    this will pin an entry in table for a block starting at VA=(a) and >>> PA=(a'). Each entry is of 2MB length - that means, even if someone >>> were to access a+1048577 for an equivalent PA, they would get it >>> (though, that is a incorrect access). >>> 3) b = malloc(1M) >>>    this *might* lead to a case where same 2MB page is used and >>> VA=(b==(a+1MB)). Being hugepage backed, PA=(b=PA(a)+1M). >>> = After b, the PA-VA table has a single entry of 2MB, representing >>> two mallocs. It can be used for translation for any thread requesting >>> PAs of a or b. >>> 4) Free(a) >>>   - this would attempt to remove one 2MB entry from PA-VA table. But, >>> 'b' is already valid. Access to get_pa(VA(b)) should return me the >>> PA(b). >>>   - 'len' is not even used as the entry in PA-VA table is of a fixed >>> size. >> >> Just to add to this: >> - if talking about the mem_event callback, it definitely won't be a >> case where same page is still being served under another rte_malloc >> - But, calls can come to delete from users of PA-VA table based on >> their own rte_free(). >> >> And, your comment makes me think - I should probably del entry from >> the table only when mem_event callback is received. > > Mem events are not triggered on rte_free(), they're triggered on page > deallocation. A call to rte_free/rte_memzone_free/rte_mempool_free etc. > *might* trigger a page deallocation, but *only* if the memory area being > freed encompasses an entire page. If you rte_malloc() 64 bytes and then > rte_free() those 64 bytes, you won't get a mem event *unless* these were > the only 64 bytes allocated on a particular page, and the entire page is > no longer used by anything else. My understanding is same. But, it seems my explanation wasn't well written: For a rte_free(), I am not expecting that mem_event is raised - but, the caller of rte_free() (the eth or crypto drivers, or applications) may call the PA-VA table del function to remove the entries. This voluntary delete of table entry from the drivers or applications using PA-VA calling del of PA-VA table - is not correct. The path from mem_event callback clearing the PA-VA table entry is correct (which I removed in v2) - that time the page (len) would definitely not be used by anyone and can be removed from PA-VA table. And, yes, I agree that mem-event may not be on an rte_free(). > >> >>> >>> In the above, (3) is an assumption I am making based on my >>> understanding how mem allocator is working. Is that wrong? >>> >>> Basically, this is a restriction of this table - it has a min chunk >>> of 2MB - even for 1G hugepages - and hence, it is not possible to >>> honor deletes. I know this is convoluted logic - but, this keeps it >>> simple and use-able without much performance impact. >>> >>> [...] >>> >> >> > >