From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-eopbgr30074.outbound.protection.outlook.com [40.107.3.74]) by dpdk.org (Postfix) with ESMTP id 2D2D91B178 for ; Tue, 25 Sep 2018 15:39:40 +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=VqNGqIGhrKMVk+YBXXA6P5WJSqk8Rq7W76s66MIylas=; b=hF+6eqqgFxKxO1A0UWVJosvXBh5idGllDaEgnaQ9dN9oTwF4Jdb+rwVeGGCOooAOHtALwtVlS3P8otP8DoHSiHzFdHnzxOfwlBar2CC+9Ow0lHHIEX/NaBnybs8ikvDL4WwqGG6S/zIXJkBBxQFJP0+1OTbISIRavVZTGUL9ess= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=shreyansh.jain@nxp.com; Received: from [10.232.14.39] (14.142.187.166) by AM6PR04MB4678.eurprd04.prod.outlook.com (2603:10a6:20b:1b::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1164.22; Tue, 25 Sep 2018 13:39:37 +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> From: Shreyansh Jain Message-ID: <894130a9-017c-348d-31f8-c4c23f517f25@nxp.com> Date: Tue, 25 Sep 2018 19:09:10 +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: 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: TYAPR01CA0124.jpnprd01.prod.outlook.com (2603:1096:404:2d::16) To AM6PR04MB4678.eurprd04.prod.outlook.com (2603:10a6:20b:1b::25) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f0ba2eff-5697-473f-ef8d-08d622ec5752 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534165)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:AM6PR04MB4678; X-Microsoft-Exchange-Diagnostics: 1; AM6PR04MB4678; 3:3zcaXnx/ftpHTCsg6N2Z2ORRf7PE/WNg2Ez8JdpuKDSou7O1eGNc72nPtwARqBgVrvEgZaDcHjVzVfQLtOWJml9mRHg14cDE4LnxwgKeXmGZNoNWN7bdYrky+mp+HpJrIH+7ICmyHqo2vG3tiPLFbWKyI5YqLrDarhJuemqSeOkgPHihWTXq0az4Ja++GUIGwOGOgpNOw+XX2cp20yDhXOSUAi1/K+zptdTx0Vx+YhaqqaG+cWlao0TDeCFqzr/0; 25:GPgTLOlNvB/XyW0+YbaVgY/T85GJxwy8qqbt0TVarO6ui00ogisq4UppZfMzk3I+D031nKog6tIc2dyI9bLPCtgAZivPeyshRXHJbRH34k3JLNE8Nh0WKNOELYpOl+/sRSe6mNy4PEoZq7GU8fc65/ujZGqH6G/L1M79Qs6tqynsn1qN7eRq/ED1OGfj9+t8SKvIsVVB6bFXGympzqE6b0wmLxzvuoZXRcdbEUoVI2jrzikczG6BSSFrFeW1ibWeX6sKSA9ExqihnMdAPvDOI3ZH8pEtOnqdnfvlsn4xdfP07kXSBYOQ4EucijeG7PAJ/sRfllowflF/jiO9kOWvew==; 31:Sr+Em98DIhVwBoMKzbhGR7j1NuONRCAlTK2d1SRw3JN2fR8Qgy+tlxb8h5pG7HdxbsSwyDQLtz5oHcsfiRkCLub+eBKqP2iCA+V+pPva3IECp3bwem78e+2Im7+zYghXCfftcu45s/f4OoF20nDjOr/J9tNhN1w3VU+1fgzMTj7xgXtRtUmqYwfsAZV/HykIXDOcBHTTyOmcq9z+FTPjVCzdxmqGdZvXZrH7HUNf8zU= X-MS-TrafficTypeDiagnostic: AM6PR04MB4678: X-Microsoft-Exchange-Diagnostics: 1; AM6PR04MB4678; 20:qeBPYIztH1edpn6eSa5LtxCeJhXaJb0n5L2Qy3/eq+WB513K7x8WzkoL99zu1/6KSUsns3FiO30iZPMWU3DN7Ets8Q5ppFqTNjtuUOFBcI+IQaFfNHY/hW/T2asMVer5zh0e7Ymt8rSYwUg4y50zc/TQGjLwjWKhPOZZj1QbGc9EPrLVBYXo4JL4VVIter7A/spfcBGu6jXhn2WQHKiE1+ci3VTu5lJOwXVTpgXl8FSwAh6wDC9fhFrOs4H9zxSU/AVtPed6150/ODQdlQ91dciA9mYOnXBA4f1nLJQrn3vp28g+YzIMwAK/DXvFsts1sLxvHDSpcsSY2cl0i+elEIGagKoeckNpkMTMYIz7jjHPgdyFusHryA7mtI+49ayaoXTKh9pMfN+bW2kuRM3E05f1sBnqmwNNOoxerSiYVephcz5vhpMIVFBWEWRy4+X26cI/ieYwsem5Juam3M02UKoR7uEf//Rcn249/v1ehjRadIXrXSDYzSwbs2ze6pHm; 4:FZd4cn70GYCgaX9NM2DYgI2AHd5McNjEIWBVk/7ovSf4l1Ug2goWx/vLNP/+v0bU7JVwvaEH1GUXmkQ2CkUFDTrV0utVqdIPIjsBOxZxOfaLUx64t38IvCiuYTi5pnXKCLAWsT1jrtGUCTfghz2QnEH8tYAe1124W1KS1V5weo3bh6T+abxXIjaefXx11IkxTCYWj32SoyRVansveRdQKRFp7amKSxA7usWTNoaTYPnJHMiZxEFP1V3Ij9vZmmY4UfcJGXj1fH9yyg7v28BIoCo9tLHahVNSk09tZnuYl5S8Q6839jTHgHK8Tl09dNRTPlZ+KqzMAKUFsfRZIP2QM07Cj+a1tGNVwfJKcmu/cTk= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(163750095850); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(10201501046)(3231355)(944501410)(52105095)(93006095)(93001095)(6055026)(149066)(150027)(6041310)(20161123564045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(201708071742011)(7699051); SRVR:AM6PR04MB4678; BCL:0; PCL:0; RULEID:; SRVR:AM6PR04MB4678; X-Forefront-PRVS: 08062C429B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6049001)(396003)(136003)(366004)(39860400002)(376002)(346002)(199004)(189003)(186003)(106356001)(50466002)(64126003)(36756003)(6116002)(97736004)(478600001)(31696002)(5009440100003)(2870700001)(3846002)(316002)(5660300001)(65826007)(2906002)(81166006)(25786009)(6246003)(8936002)(58126008)(65956001)(8676002)(52146003)(2486003)(47776003)(23676004)(52116002)(67846002)(81156014)(11346002)(65806001)(446003)(86362001)(44832011)(956004)(6486002)(53936002)(476003)(2616005)(7736002)(229853002)(486006)(105586002)(6666003)(6916009)(68736007)(16526019)(77096007)(4326008)(26005)(31686004)(66066001)(305945005)(386003)(76176011)(16576012)(53546011)(34290500001)(110426005); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR04MB4678; H:[10.232.14.39]; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtBTTZQUjA0TUI0Njc4OzIzOjhUSlJTZmpDQlF4T3NHMEhTclZCaUlvczJu?= =?utf-8?B?U2o4QndBNFZHVGxWdnF4WDVSSkxtU0MwaWFGd0lZZnQ0ZEVrSlhIdTRMTjRY?= =?utf-8?B?ZVJuWFpiYXJBcnppdU1JaTBhMkQ4SmljOG9OL3pSeExGWHpmQnFCQ09lNFh1?= =?utf-8?B?M05ZL1Zu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7mEFWZZAOCAbkA9ZXuuA9BPd2waWNE9Lte5LUvCMMN+P7c/jX2f/Lzl76tcuSqpGMFQHJrYQ++szHD2Fxb+C/GxGT3EMmHEe5Mqzv9E04AUdVn+w0zAy9PUdil0=; 7:bxSeQrNu7O7OT3hBSiVR99L320uH8dRx4WwoIllkvH/tU+7vOpsB/LuT2vKiikYZDcMisfkbsFvUYv4fy87rtKPYe0OTYdgCGFsEFUwdh2QdUxnEST9RCaUgMAG1cehLeHsNASeQMuDpvd0+SOPKEP2NnAiNuDdEFMy70M4KGBafksb4xMUqB0NAzXVcYTgbsT5Ia3C/dZ1eMlsVKBWMdiVz5GirOcGhV6MK/nJrV0es24S9QgI1WCSnHseC5Ad/ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Sep 2018 13:39:37.3409 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f0ba2eff-5697-473f-ef8d-08d622ec5752 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR04MB4678 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: Tue, 25 Sep 2018 13:39:40 -0000 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. >> >> Signed-off-by: Shreyansh Jain >> --- > > Hi Shreyansh, > > So, basically, you're reimplementing old DPDK's memory view (storing > VA's in a PA-centric way). Makes sense :) Yes, and frankly, I couldn't come up with any other way. > > I should caution you that right now, external memory allocator > implementation does *not* trigger any callbacks for newly added memory. > So, anything coming from external memory will not be reflected in your > table, unless it happens to be already there before > dpaax_iova_table_populate() gets called. This patchset makes a good > argument for why perhaps it should trigger callbacks. Thoughts? Oh. Then I must be finishing reading through your patches for external memory sooner. I didn't realize this. > > Also, a couple of nitpicks below. > >>   config/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. > >> +{ >> +    int found = 0; >> +    unsigned int i; >> +    size_t e_offset; >> +    struct dpaax_iovat_element *entry; >> +    phys_addr_t align_paddr; >> + >> +    align_paddr = paddr & DPAAX_MEM_SPLIT_MASK; >> + >> +    /* Check if paddr is available in table */ > > > >> +static inline void * >> +dpaax_iova_table_get_va(phys_addr_t paddr) { >> +    unsigned int i = 0, index; >> +    void *vaddr = 0; >> +    phys_addr_t paddr_align = paddr & DPAAX_MEM_SPLIT_MASK; >> +    size_t offset = paddr & DPAAX_MEM_SPLIT_MASK_OFF; >> +    struct dpaax_iovat_element *entry; >> + >> +    entry = dpaax_iova_table_p->entries; >> + >> +    do { >> +        if (unlikely(i > dpaax_iova_table_p->count)) >> +            break; >> + >> +        if (paddr_align < entry[i].start) { >> +            /* Incorrect paddr; Not in memory range */ >> +            return 0; > > NULL? Yes, NULL. I will fix that as well. >