From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0072.outbound.protection.outlook.com [104.47.32.72]) by dpdk.org (Postfix) with ESMTP id 418D72C36 for ; Tue, 26 Sep 2017 00:08:35 +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=B6ZaNbSpjKJJkSIvyBvWndLdoCxHdxsDPIbbCXkQtnI=; b=TK4gDNA2NtOqFOVJlKADxIhTLkC+il6MfDITCTS/AzYxxmnPgAifkKYIvPEaHdda7M3nysIg+yQeahezUbvIG3FsVShQVFjKkYQ7CBFO+Xfsd4C0PZsizcVd30ILRFnbTrgoPDYNQd4Zqui6sl4heQ5zKewsDyvTJW/yeCndg4k= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Santosh.Shukla@cavium.com; Received: from [192.168.89.224] (31.216.236.195) by BN6PR07MB3091.namprd07.prod.outlook.com (10.172.105.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Mon, 25 Sep 2017 22:08:30 +0000 To: Olivier MATZ References: <20170906112834.32378-1-santosh.shukla@caviumnetworks.com> <20170907153042.30890-1-santosh.shukla@caviumnetworks.com> <20170907153042.30890-8-santosh.shukla@caviumnetworks.com> <20170925113257.kopzsgzxhqiecgnr@platinum> Cc: dev@dpdk.org, thomas@monjalon.net, jerin.jacob@caviumnetworks.com, hemant.agrawal@nxp.com From: santosh Message-ID: Date: Mon, 25 Sep 2017 23:08:17 +0100 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: <20170925113257.kopzsgzxhqiecgnr@platinum> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Originating-IP: [31.216.236.195] X-ClientProxiedBy: DB6PR0501CA0006.eurprd05.prod.outlook.com (10.172.232.144) To BN6PR07MB3091.namprd07.prod.outlook.com (10.172.105.9) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 24549e8c-0432-4986-5f05-08d50461f6c3 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254152)(2017052603199)(201703131423075)(201703031133081)(201702281549075); SRVR:BN6PR07MB3091; X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB3091; 3:/xxg+wjstWyQwMcOHNjZbHT69C3nj2y+rt+RVkRS6f3z90hHEOkhpGypAasTYCXfjz28Kz5bMQeSUxz2g3HQL0Gd1QnKhkdf67hA3mDDyN5EmMMukGnLHBjY5Cx8hoTkLoF9IdTcWOZPUuKix5tUmsp5W/L9DhgsBM11yNgXBJh360Ax8hM86NGEutObzHMMEe7JA+Lv0pBDY4DCH9YFMidZqGMj4ERSY6A2Neydhm0nzoEO+W4vPdZSGs89p6hs; 25:aupwoYrZcCsdWchkSl6QsFQpgYMiNbvFFDT7NqTzmAEi2MTup3o6l/jGTnPHG2v/n4u32ziu9O235k8Zi/QQoVFxB7F5/CAzbCiGwjupEiRKGBbeto6maA3SW0zdppu6C2X63RsFIvpa3GvQfLFovs5kX/mHe7bT8LS48uXU8nq6dKZ1D+pJlbbdYBBtBvSBukXTqSzm5u1pWSKaH4fBPKCF1cXY22kx/bhhw6mNT+6tnNrgrdWauvZUVbAplZLnnobKbysQxpoxNOC2lWhq+Mm1GvqCu5acjrt+2xocvzmnE9Q1io4AGR5uW0ggS5LqBcYfMBsRG4U+VFg+DD4A6g==; 31:4Sh5frfrGULYl70iZrkPdXvlrPVNxyGwjtlayxDGX2MrV8kqhcqP0hAfuRaq9p53VkvsVN+KDTxfrEiedN1IH4DPW1+ZTvh9Wq6xVcHVtg1bRAd9NMKc7zh8PmamqHkXlRQOy9TQnH4sjd6pJ3oT0SvGOllVxLelZcaUnjA0cBTrWrcFXNABetIbmJt8Ul1oXsZ1A8a+1x5eks910QtvMke6ssdXzqX99hDWquC/t78= X-MS-TrafficTypeDiagnostic: BN6PR07MB3091: X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB3091; 20:7fcG5sRM+W1G5i32RJ6oxogDG+pAO5gwsskbMqcJYeQLPX8WL+Ld7HjVKrdiVkE5VTXIqYdrzUu8nYLC7AFIFDYJ4ZW3W+Q/LZBtr1Zwy5TRW+deY4/NlvWatpoWc1XA9IQJgNXmijQYIuD4rvzc3ngUKhrV+ePGFUGTrDRW086PncFYEQ+EtWA4M93kEPXzeg51nmULamJa35gR09o/+3HLRFFk/XO20ajQK43yV34WKgA9uvpGstAd+mswqyNA8AULAb4hTJOPTlLIe7bqt5nd/uWLkgPFgYnKXhgTvTT7PAWE8fX/drGL5ots7UIqbMS5DNv3MLFCNEJhbUEz9yVmABPieseacpxKPr/JPFvVD83RFKIKNicba+WSbglUQdjynXl+W5TrAVQv1x0SMFS9gJTUyLJ2p890W++J3yap6z3rJ4gWi71yERpyVVEhqIUKbty9O/jOtAjHcMCFtH3DNd7iCE/Y/8X1Hb7ZW1aqdfvZMtnPOyNby8rkxVwv30BVZ6HvAkNK6c4rsZo42asHDB/fZVRPQ7dDhRPbo50eJTeY5P1nPLUizVlsElm8sfshGbRs+FAiSpSrOZKp6FFGTTuMfPLc8hQu1ml6TKk=; 4:LER6DlBp3ZqxDTJiua8rl/ONgOVmfTIcNWw5vWu5BGOZ8y/ZRmI1x+52yjMKnCpgD1gQzqwKwcF62ykI5K7Risc5CvOAXL60rvEXD6TJy73Te1iSfOK8Yxqd5Ur4OZ5jF+vvmIuEhieRvRlZ15Hl4GMLbzQ+fvr8ysoR7LN+jlLTrSrlcpzAayUCATVWNzjpcR+/fyMCw10DV3lI3z2LtqKPGEPRqJaSo8i4z23QhEM0Hk305ipWZxWO97KhjFMz 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)(10201501046)(3002001)(100000703101)(100105400095)(93006095)(6041248)(20161123555025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123560025)(20161123562025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BN6PR07MB3091; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BN6PR07MB3091; X-Forefront-PRVS: 04410E544A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6049001)(6009001)(346002)(376002)(24454002)(199003)(377454003)(189002)(16576012)(16526017)(86152003)(2906002)(6486002)(53936002)(65826007)(6246003)(65956001)(4326008)(54356999)(65806001)(81166006)(101416001)(5660300001)(25786009)(76176999)(117156002)(50986999)(50466002)(66066001)(8656003)(77096006)(305945005)(81156014)(229853002)(230700001)(478600001)(97736004)(3846002)(189998001)(31686004)(23746002)(6116002)(33646002)(7736002)(47776003)(36756003)(8676002)(83506001)(2950100002)(31696002)(72206003)(6916009)(42882006)(316002)(68736007)(93886005)(8936002)(6666003)(105586002)(64126003)(90366009)(58126008)(106356001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR07MB3091; H:[192.168.89.224]; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX: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; BN6PR07MB3091; 23:acGfup5KiarwqpYvhLBFd8B1gEiHbJhprTAti?= =?Windows-1252?Q?q2rmWvaNBf8YycAhQTNmJZCicxYah8gF8UkLje1sJPNUioa98cooJF+h?= =?Windows-1252?Q?wjKZkjvv8vFBB0dHzL6C/TWuapU00BFLrhhyIKPqfKjBkwi4jKZcfyEK?= =?Windows-1252?Q?HNEl2vdx4RVpMG4S1rgDQtKpWYF7G7G3wN9BcudBvOHkXDxJnVU3Q0vV?= =?Windows-1252?Q?HlVUaSBnLXA1gPaQLDQn/1/YZF40FpKIE7pAGBukklCXDYRtknJIqg26?= =?Windows-1252?Q?eDIRppkwAzSmFhGQindVE2R4gmD0DQFf7g5uqwRmyz43udiWNSE2Sjzy?= =?Windows-1252?Q?4GG+Jrplob7YkPlIjXhYpWVq92JSEKvIW3QiLZrzd8UIuPagYXqTd9L7?= =?Windows-1252?Q?IOrSz+QT+mmZj0v44a/gFR2QWIG8fPFt7D/Td/Ss4v75/yMpJMr0Goi1?= =?Windows-1252?Q?DXJhP3B4tXaMybOFLmvJlGaSz0GeNyMwDsjCpYCFAKCNBNpJoM1wNu1C?= =?Windows-1252?Q?sy3pZM9pMREUKz0mYY6zL2yhcGUrrxQGmLmoEvDywwcGGdBZKtkxcR16?= =?Windows-1252?Q?FVkBZXWpebjdWdA9Eu7AJYpWNrujnrIsvQfpulMDDqXDjFQaizpdvEnM?= =?Windows-1252?Q?CxiJQSte1v8tTQ29ZkPFcO7DCd2Ps1W3WmdHXaes3CXDmXsi6MYC6MEC?= =?Windows-1252?Q?4tyWjOpGIFQvixJ0j7stcVWU1tym0//TCTpgAoLodcZBfHNCXSc9epp/?= =?Windows-1252?Q?yoFGHK8lM3MtXxUTTsSfXpdpJORh3RxG94Lv8JDNccVFIpfAZumlOpRX?= =?Windows-1252?Q?gsiWI+teglI/6Y61uaf0kvzySjTFn9O8SSSFnZsfpbQ2qgOPWa4v02UX?= =?Windows-1252?Q?BOJGPPXfFdw1LfE/c8h3fCym9SlpnabX9mJ+7mpFru5o7akALGJTvJPk?= =?Windows-1252?Q?smzNWRRGkJ2SMcMqWveKdwgQcsGInWHT3ak0uOq7Z1RmnxnfgHKAQNfm?= =?Windows-1252?Q?HLcuLCEsNR5rssrw5XAZa7vw/SkCDIRBlftkVI/AXXvsajdD/0ga2Ihi?= =?Windows-1252?Q?kjQQkPlY+NZ0LfpKh4pBkc3ZTP2Kt7/d/mkX+A2zjmc7PwVSMFu7pqnc?= =?Windows-1252?Q?z+tPt06iw65Qr4UviZbFFrUdQgh5FTtAKO59vfbOIb2q8Q3HKGqgT0jO?= =?Windows-1252?Q?Q+n3iiXgXr/mBMtbdbZsYxAaY1fA10t8pX0u8vK+SQK1nXUZDmSPFtIg?= =?Windows-1252?Q?z7uWYWuv71AOkgKwI+DMEWKSf6nKDYk7Rbx97YRFHr9Hk6LqMPGm6i+N?= =?Windows-1252?Q?3p0kBZkFSYl3N9zcyHt/RuYaQYytxEIQO298J7t6f/89aOpKH82HuQMC?= =?Windows-1252?Q?tuWHj3wgkOngEixlxf9hB8w/tHjnCqL8zI5k0RLxyWyueMlce9ho/E0S?= =?Windows-1252?Q?T8siqYhWJix+RSK84T+nK44x/8K81AVwrB6k6KqsdSiHoE7m/ES4gvps?= =?Windows-1252?Q?TfBMA0Wi1zwLA3+zo2GcAUFneD0FAkeeVaRtUE3UKJsxHPRBhZDLeAwc?= =?Windows-1252?Q?pFljbBXINoGGDk=3D?= X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB3091; 6:bdFIMk+2AmBNQR+30707w+Dvs87JAggRRLamPg9I+vGmJ06rqvhLNv2M6vtLSXdrnIHZ+J3lknfQwEmMEnRQFxzUwoGDySvZCUMAX8/9Il71F17dG8GDkmQEDEWZNEp1VlpLlHRYtvF0YezQdeij459IbD8TAOWG9WtcuEE9ZpnBRw94FzdWaxpp1XXC/H+abfXBLuS3uEK6uWwIuAl+gQXRo443PS+/wvvjK/eHTPsFhxGnBbW3RTGBk0aVYAx6MWDwdfkTBkLstgvzYOK0jfGAON5uM5QmCHCgLBxPK2VNbUHp5E9VidOdeYqv/IVilznxQSNIXK8/nFYrLtSBAA==; 5:tZdhvxGflRuheifWsUN05og5c1YyTR8rFQ2zQIbEEOrU8o3o8E09cQhgy0KHlQc5cC9u3yTLXhG+8N3J+yyGVRMkSvEhH9LacQ1n2By6Sk1Gm8UPe3XtJHAexAPFWNUZ4UpRVh6yv94ctu2TBtX/aw==; 24:s1oPLeTTMbNTtJJwNL2VChP5qnbIW0aP2QFqiKfHlMzltRDaKnZH86ZX+zqiiGKlqoutZT+0lK2VTr3/gMgsP4NeCAGL0I0I/J2D3eStbzw=; 7:I8c5BZJmg7Fc3Fipk9EOh9/qJXw4thP3aH9UEGyei2iOI5Yr/nVvu7InhKtS/+kzgOKGs/AOwajZj62u0WIuKvmnSPeC4TCrOu0RdVJHMBysKgh7CGPv6gZowcczeO1xCp0y6uR34sto8k0J+Sngj8iASxhJU2YCEhlWpXTT9DksWPVTw1FJJJ4/jnYcFRZPf6O256NWRPSlPNjg+N1WJM1VrxngkKSzCrBi1YarXTU= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Sep 2017 22:08:30.5037 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR07MB3091 Subject: Re: [dpdk-dev] [PATCH v6 7/8] 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: Mon, 25 Sep 2017 22:08:35 -0000 On Monday 25 September 2017 12:32 PM, Olivier MATZ wrote: > On Thu, Sep 07, 2017 at 09:00:41PM +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_CAPA_BLK_ALIGNED_OBJECTS flag. >> If this flag is set: >> - Align object start address(vaddr) to a multiple of total_elt_sz. >> - 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 MEMPOOL_F_CAPA_BLK_ALIGNED_OBJECTS flag is set. >> >> Signed-off-by: Santosh Shukla >> Signed-off-by: Jerin Jacob >> >> [...] >> >> --- a/lib/librte_mempool/rte_mempool.c >> +++ b/lib/librte_mempool/rte_mempool.c >> @@ -239,10 +239,15 @@ 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 unsigned int flags) >> + unsigned int flags) >> { >> size_t obj_per_page, pg_num, pg_sz; >> >> + if (flags & (MEMPOOL_F_CAPA_BLK_ALIGNED_OBJECTS | >> + MEMPOOL_F_CAPA_PHYS_CONTIG)) >> + /* alignment need one additional object */ >> + elt_num += 1; >> + > In previous version, we agreed to test both _BLK_ALIGNED_OBJECTS > and _PHYS_CONTIG in _xmem_size()/_usage(). Here, the test will > also be true if only MEMPOOL_F_CAPA_PHYS_CONTIG is set. > > If we want to test both, the test should be: > > mask = MEMPOOL_F_CAPA_BLK_ALIGNED_OBJECTS | MEMPOOL_F_CAPA_PHYS_CONTIG; > if ((flags & mask) == mask) queued for v7. agree strict check. Thanks. >> @@ -265,13 +270,18 @@ rte_mempool_xmem_size(uint32_t elt_num, size_t total_elt_sz, uint32_t pg_shift, >> ssize_t >> rte_mempool_xmem_usage(__rte_unused void *vaddr, uint32_t elt_num, >> size_t total_elt_sz, const phys_addr_t paddr[], uint32_t pg_num, >> - uint32_t pg_shift, __rte_unused unsigned int flags) >> + uint32_t pg_shift, unsigned int flags) >> { >> uint32_t elt_cnt = 0; >> phys_addr_t start, end; >> uint32_t paddr_idx; >> size_t pg_sz = (size_t)1 << pg_shift; >> >> + if (flags & (MEMPOOL_F_CAPA_BLK_ALIGNED_OBJECTS | >> + MEMPOOL_F_CAPA_PHYS_CONTIG)) >> + /* alignment need one additional object */ >> + elt_num += 1; >> + > Same here >