From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0052.outbound.protection.outlook.com [104.47.34.52]) by dpdk.org (Postfix) with ESMTP id 90029374E for ; Thu, 7 Sep 2017 09:37:38 +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=egMt9+7zcbIkNHU9wSxt7udbfiS4CA7V7Ass38886l8=; b=im9hn7vbje+hT0YrKUbxwzpQsBhODSibqhi2h8pXQTrQ1BU2qcFglHDHxS4e0CS8NWWS9nJ8+hjVA3Aral8ATyFZMGG4+rDQzSnUOpDGtpOTJrc+SB6RmOrJ70ch8sjBFQCP+DCpDBCXzVO43Q4kzR8nIWiFv84VZ/rKn3PEVGc= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Santosh.Shukla@cavium.com; Received: from [192.168.0.105] (103.76.56.167) by DM5PR07MB3098.namprd07.prod.outlook.com (10.172.85.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.35.12; Thu, 7 Sep 2017 07:37:34 +0000 To: Olivier MATZ References: <20170720134759.4680-1-santosh.shukla@caviumnetworks.com> <20170815060743.21076-1-santosh.shukla@caviumnetworks.com> <20170815060743.21076-7-santosh.shukla@caviumnetworks.com> <20170904162038.irmqwqqyzflbz7zv@neon> <20170907072724.fixbpyxby4eprzt5@neon> Cc: dev@dpdk.org, thomas@monjalon.net, jerin.jacob@caviumnetworks.com, hemant.agrawal@nxp.com From: santosh Message-ID: <6586999c-9e80-14b6-f9de-b6bc5683debb@caviumnetworks.com> Date: Thu, 7 Sep 2017 13:07:19 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <20170907072724.fixbpyxby4eprzt5@neon> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Originating-IP: [103.76.56.167] X-ClientProxiedBy: SG2PR04CA0142.apcprd04.prod.outlook.com (10.170.139.26) To DM5PR07MB3098.namprd07.prod.outlook.com (10.172.85.8) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bfc99559-ca45-47cc-6cc3-08d4f5c34f10 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:DM5PR07MB3098; X-Microsoft-Exchange-Diagnostics: 1; DM5PR07MB3098; 3:mo6hLU/h5GP5jZwMDvYJUUh6CBcnbsIo5AxJHT5c9IkhflHdNrBYwDCZw47//VeLTjNwsSKYBf6EtjPza+YJ57gMqBsW8KdI5iEyzOikHab5PHinKLzLf3ZeD91xx3WrpqqIeockfRwQot/KimyqnsMV7ItRIMYST64hQ1IULmWwXFeeUYfKNPZHtLGL7iCvSvXKtUkaZ0SszPpG0ECd5gdOYWvW6Iz02fZ+odwTIn3KWgQWs9jTj/jJA0oXEd73; 25:gIdRebkOjbk9tbpxj8Mu5VdsNo0lczFCcmENjUlKQMxF1TSvu39rdR54aU7sjHG3MqTLsQQZJYDZGXSWIvkxJCLiNzU59nodxxsgkBoE1ZKtePnuh1c8+zWUioLzRvLke6+EQlG3F1EW8UpfRgATUhgFBg/gxt07bAdOs9lYpI4mAVvH8FTdJXVZ0s4dtBYJptLHwbaMnEU7U+Wrt7XadIht8ScbFnuKNlwHxD+uvGBnYCUX8q2NOvli3hkXA6XQkpPb9AJIFVC9nQz9B7gXlkLkYikab4uFfPztyZk8srSlI61SpAGmDzd1gmi2OOd9YPP9obfo2OounpuhYc1uBA==; 31:1ZgV5xvVen+5H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Wf+cusKg+XDzcPDUKuXGwyDPQ+adxiPpA0B7PnYTu22DFSfDePXFoPHIz/WVqpgfyw1QbmTpaYo6NMU/WEo9C X-Exchange-Antispam-Report-Test: UriScan:; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(3002001)(93006095)(10201501046)(100000703101)(100105400095)(6041248)(20161123555025)(20161123564025)(20161123558100)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DM5PR07MB3098; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DM5PR07MB3098; X-Forefront-PRVS: 04238CD941 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6049001)(6009001)(76104003)(189002)(377454003)(199003)(24454002)(2950100002)(8656003)(42882006)(6666003)(8936002)(53936002)(6916009)(6486002)(77096006)(90366009)(50986999)(229853002)(64126003)(36756003)(189998001)(106356001)(42186005)(54356999)(86152003)(93886005)(50466002)(23746002)(7736002)(305945005)(8676002)(33646002)(81166006)(101416001)(76176999)(105586002)(81156014)(83506001)(2906002)(68736007)(6116002)(3846002)(4001350100001)(478600001)(5660300001)(72206003)(117156002)(65826007)(4326008)(31696002)(25786009)(97736004)(65806001)(31686004)(6246003)(65956001)(110136004)(230700001)(47776003)(66066001)(575784001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR07MB3098; H:[192.168.0.105]; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1; DM5PR07MB3098; 23:3mD+O2aL2x183HlHDYUU3Zq1yjTbVorjjd9oV?= =?Windows-1252?Q?dsh7F1NLGZH11F9N/p+U2FO67kCSaeOSRx88DPq3m7mWXTEWgq35KX/j?= =?Windows-1252?Q?ONK7M3w/DFxUU0xh1JYvNUjY0pLICNhKC4jvAVn7kiwfOkjIFtLCmh6u?= =?Windows-1252?Q?cB1xDEgtq2uupDy8pWa88kMWn7mV+ckRAVFNZ5rMovxFix1x746QFqnh?= =?Windows-1252?Q?uhiBEqKue1woNNdEUOfD0pIAzkLAGZ7Red8HzR9jr1zh55T1dTLLpP1T?= =?Windows-1252?Q?8zmXjrlKcCaAlY4kNBZ6RzmT/V1/COuX4KhmXLIcyygdfJjP05v01xQ0?= =?Windows-1252?Q?2TDNBGKEsrWieB3I20tPRWFqXRZPI7FEGa7tgBQ9O362/Fp/UHZJQBx+?= =?Windows-1252?Q?1op6E0oMQ4dxbak1faq17nuNQHW5H+W4AzZJl4PW/Ub6GBrWMiBHmePE?= =?Windows-1252?Q?Tghq3wM7dIHvZXraxTSa0lnAoniAwQNi4gMeNbdBH/X7Fl9WKmqv/2w4?= =?Windows-1252?Q?Utwll0EM38WrV7XvuKs+SLkAifZu0FdzixU9sD/m4TdJfO8vSgenbdRm?= =?Windows-1252?Q?nYa1u23gVJAPBhfzo/inbVgBFTMRm0bo3FUpKgYPGrC4ZFMinN4maJQN?= =?Windows-1252?Q?uC6mdPzR2fHDRjitNZz9dNGn7neoasSAk9DaAZtyoVHSXDMdTIQF/HDI?= =?Windows-1252?Q?vIzelhAbm31RG2V1eT2o53+yB+rqjBqkrDQjmE7uk3kXWA2+APQX1IVj?= =?Windows-1252?Q?plBJmgDQYQXHgfYOV5UW4DzAJg3E70Ya8pMg1nIwc+uJZUmagt1Hn6EA?= =?Windows-1252?Q?tY98fW3OpRiiwimA1rIuDe++ajijXEwItWBhGYwe2gTvkc701bYo/Byz?= =?Windows-1252?Q?lxy+K1u7YHuuEhSh7J1+bWRyNAmle16yCz8xFzhGbqHRJ3GKi+/9XWo3?= =?Windows-1252?Q?u25mF51/9H4kGjRMJahPAX1cGNtreo9pCbgLS6O7de5QZwiBTFxcgXUc?= =?Windows-1252?Q?C9VRd41+kKlOdIylKPvpqiukfJyLA3liaSMBcNJtXhCG6GDAYYIwmLcb?= =?Windows-1252?Q?qh2n03OKD2KQfAJ5Ue+0yFiP/awHZ4DIL6iupr0zoM4DV/7rJli5PDvf?= =?Windows-1252?Q?eeMOcuoVfYi8GElbKksj2LWm+tH6m/tP4MVCCtWw7inkgBDfsgcZR+6O?= =?Windows-1252?Q?g2xVNVk7x7YyB4nigP/KsNOoPzbiUX7PCQole64evRkDyzqVpm8PLouY?= =?Windows-1252?Q?ESm4xCMl2Yfa1h/Y0WDjklsg1srPudOR5g8kbSL7NAk58onFWpZr+eGH?= =?Windows-1252?Q?2D93tRmZjAAiGxVMkwjH48X0mUQj4hCb/VPLdjJmXjQyMlXYLHOXQ+uR?= =?Windows-1252?Q?COe2cKefexmdvydqKbouzKVLJNIfUtUGnUd+yVkySRd9msI4D8p4u21/?= =?Windows-1252?Q?VX4LcFCs4k6P4tlClz+6FSYXMjQtRKyCqz1wEyxiF8o4RPzD2K5nbY4u?= =?Windows-1252?Q?g48r5WkqimnoodwcGBTUpn6lMAyrAxdk11aExDT9YunpkoN5d+FzAKzi?= =?Windows-1252?Q?QdzSrhwQqLHe8rwlra7voJbp99TBPKRkYDc?= X-Microsoft-Exchange-Diagnostics: 1; DM5PR07MB3098; 6:aP6iR/zIQI2CmHPdfSGv4RHeWicoyWFoqDX0TMk/bB8k84epSdKNNG+qv4gs3jI/GBN3bblWUTC4WoPKPKZsFqH/jj28oUHfb6NqDONYcxNalun4vnaDOCZndP8DEsKeuY8kI2AXU/oQDrmrorLbCV5xNr1Bs95tv0x0lJMIG2CDw932cdW5ps5epVA7e8JzHMjntg/xv9SPWhmJVTXt3zpiHyrSjfZYSMaVCj4IovnuxtsL+E0dCkImZQFKbZ7fo6cDFcSR6jQszAWtKI4scb+qvbnUmBYv2lAPlizfdEuAVxwMdM8ovfFINtI7HUYiiD/vL1+8Yw1DECMd0en/5g==; 5:GYbGaugr2K+sw9b5zpIWJFjP33N5xKGgG9ysX7ZQUpf/Yo7hAYOIz3uIE8Ba5vIVLG7pkowTYompw2B3anGreleLwRrKy87jMydNnmvj6YmSjmi0NpqgGOnwd8qiy8roPBx9LicY2MxavGiKm52+Qw==; 24:bRugqD4nbqBCyRDrMlqVHACwOIJ6e9y3WwROrQnfP0bmz8/SG1JowMa+Pi/4I8HKfA3aquy5NvppdWOWQ5pXTktVUbgb1m0kKr/PFRnx8BM=; 7:sQ0CGyGKQ5TcWIwpetXq8zxprko/AAzQuluFyWtFDRylrNo07SmBhalWZirMaEsVeoXwoTKFXILRk7DsF4qMj+hc1Iz5EealQsLhLW3VafcNUlKlvMyaYZQ4Az5/UMHzq+HENb2CLDPe3FZeUP9trG061xRrGjiyY8suDcg4HqlJWSxiZPFTlvKgoduK3dFUnNgb47KHC9EV/dyOqKbzVZUJnPVEMcp2TEUOtLvjeyE= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Sep 2017 07:37:34.0142 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR07MB3098 Subject: Re: [dpdk-dev] [PATCH v4 6/7] mempool: introduce block size align flag 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, 07 Sep 2017 07:37:39 -0000 On Thursday 07 September 2017 12:57 PM, Olivier MATZ wrote: > On Mon, Sep 04, 2017 at 11:15:50PM +0530, santosh wrote: >> On Monday 04 September 2017 09:50 PM, Olivier MATZ wrote: >>> On Tue, Aug 15, 2017 at 11:37:42AM +0530, Santosh Shukla wrote: >>>> Some mempool hw like octeontx/fpa block, demands block size >>>> (/total_elem_sz) aligned object start address. >>>> >>>> Introducing an MEMPOOL_F_POOL_BLK_SZ_ALIGNED flag. >>>> If this flag is set: >>>> - Align object start address to a multiple of total_elt_sz. >>> Please specify if it's virtual or physical address. >> virtual address. Yes will mention in v5. Thanks. >> >>> What do you think about MEMPOOL_F_BLK_ALIGNED_OBJECTS instead? >>> >>> I don't really like BLK because the word "block" is not used anywhere >>> else in the mempool code. But I cannot find any good replacement for >>> it. If you have another idea, please suggest. >>> >> Ok with renaming to MEMPOOL_F_BLK_ALIGNED_OBJECTS >> >>>> - Allocate one additional object. Additional object is needed to make >>>> sure that requested 'n' object gets correctly populated. Example: >>>> >>>> - Let's say that we get 'x' size of memory chunk from memzone. >>>> - And application has requested 'n' object from mempool. >>>> - Ideally, we start using objects at start address 0 to...(x-block_sz) >>>> for n obj. >>>> - Not necessarily first object address i.e. 0 is aligned to block_sz. >>>> - So we derive 'offset' value for block_sz alignment purpose i.e..'off'. >>>> - That 'off' makes sure that start address of object is blk_sz >>>> aligned. >>>> - Calculating 'off' may end up sacrificing first block_sz area of >>>> memzone area x. So total number of the object which can fit in the >>>> pool area is n-1, Which is incorrect behavior. >>>> >>>> Therefore we request one additional object (/block_sz area) from memzone >>>> when F_BLK_SZ_ALIGNED flag is set. >>>> >>>> Signed-off-by: Santosh Shukla >>>> Signed-off-by: Jerin Jacob >>>> --- >>>> lib/librte_mempool/rte_mempool.c | 16 +++++++++++++--- >>>> lib/librte_mempool/rte_mempool.h | 1 + >>>> 2 files changed, 14 insertions(+), 3 deletions(-) >>>> >>>> diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c >>>> index 19e5e6ddf..7610f0d1f 100644 >>>> --- a/lib/librte_mempool/rte_mempool.c >>>> +++ b/lib/librte_mempool/rte_mempool.c >>>> @@ -239,10 +239,14 @@ rte_mempool_calc_obj_size(uint32_t elt_size, uint32_t flags, >>>> */ >>>> size_t >>>> rte_mempool_xmem_size(uint32_t elt_num, size_t total_elt_sz, uint32_t pg_shift, >>>> - __rte_unused const struct rte_mempool *mp) >>>> + const struct rte_mempool *mp) >>>> { >>>> size_t obj_per_page, pg_num, pg_sz; >>>> >>>> + if (mp && mp->flags & MEMPOOL_F_POOL_BLK_SZ_ALIGNED) >>>> + /* alignment need one additional object */ >>>> + elt_num += 1; >>>> + >>>> if (total_elt_sz == 0) >>>> return 0; >>> I'm wondering if it's correct if the mempool area is not contiguous. >>> >>> For instance: >>> page size = 4096 >>> object size = 1900 >>> elt_num = 10 >>> >>> With your calculation, you will request (11+2-1)/2 = 6 pages. >>> But actually you may need 10 pages (max), since the number of object per >>> page matching the alignement constraint is 1, not 2. >>> >> In our case, we set PMD flag MEMPOOL_F_CAPA_PHYS_CONTIG to detect contiguity, >> would fail at pool creation time, as HW don't support. > Yes but here it's generic code. If MEMPOOL_F_POOL_BLK_SZ_ALIGNED implies > MEMPOOL_F_CAPA_PHYS_CONTIG, it should be enforced somewhere. > Right, Approach: We agree to keep _F_CAPA_PHYS_CONTIG as flag not set by application, i'm thinking to keep that way for _ALIGNED flag too, both setted by mempool handler, such that mempool handler sets both the flag before pool creation time. And above condition will check for both the flags? are you fine with that approach? Or pl. suggest an alternative? As because right now octeontx mempool block _need_ aligned blocks and cares for contiguity. Having said that ext-mempool in particular and mempool in general doesn't facilitate anything like that.. Thanks.