From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0067.outbound.protection.outlook.com [104.47.40.67]) by dpdk.org (Postfix) with ESMTP id 2C6357CA9 for ; Mon, 4 Sep 2017 19:46:14 +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=t4bwiewjcsBH1VmIrumJb1Zl5I/+Mg2HchWgyhallqg=; b=SFwsitgCe3VK1aBUYstRjj4LMXLf+YpNZSXEtY5fWr8tdopt9+LBSPyRtU2D5W5GJKEDbW16iweu9zC0ARU1k8OQtgim2Do/qSF13zn2cuALoHcLdXOBZWsJjc44LnyDDPYSu/b/qR6gkFNEKb0QwE72b505RC+c0t8xN25+dj4= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Santosh.Shukla@cavium.com; Received: from [10.89.1.1] (14.140.2.178) 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.13.10; Mon, 4 Sep 2017 17:46:09 +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> Cc: dev@dpdk.org, thomas@monjalon.net, jerin.jacob@caviumnetworks.com, hemant.agrawal@nxp.com From: santosh Message-ID: Date: Mon, 4 Sep 2017 23:15:50 +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: <20170904162038.irmqwqqyzflbz7zv@neon> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Originating-IP: [14.140.2.178] X-ClientProxiedBy: PN1PR01CA0117.INDPRD01.PROD.OUTLOOK.COM (10.174.144.33) To DM5PR07MB3098.namprd07.prod.outlook.com (10.172.85.8) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: addb9f14-8098-48fc-b332-08d4f3bcd4f8 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(300000502095)(300135100095)(22001)(2017030254152)(300000503095)(300135400095)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:DM5PR07MB3098; X-Microsoft-Exchange-Diagnostics: 1; DM5PR07MB3098; 3:ZJ1kjSjiS2eNA3a1AonAP/Xa+JvCjGl/aWsdniSowNHWrR5U0vEJTqGtlYFbNm1ZmCOs2r7jcKzT7cZ41HvuY9rY2K6Qg+RVzAHJ1utRhFpM3/rHNMdywCtqkYTuT74zsb5Q9mfKsCMdtY0x24djBlll53bxiriT9mg8KFzHOOFTxy0MFB0WX/QO8N5PJogTXK5nbYBHFR4fAcQRPoIyL27/T3mazPq6wQGtOGGo8Vv2Y3AA/nuYNDNq9J/7r92B; 25:ieVPUds4wojauyKRMqdd1Ir7h7SoDKXjN763pIYk+WX4Wh2sCHHkSqvT1YMhXnPd/63bzPQ0Tgx47NiJgjAELIX2JfBmgo1KSFk0FIsG/+oh+ZVi/OuVdIurT3iqirZu+qf3Zm6JGJzmJ+oz5pFa5wlLhItUuSYVPHDh2tgge6x4pConkd0vfW3B47tf0p570lVB5p5Lgadp3LuzcxtwvqcYhbhmuBJI42zh3hzrRjswjRzDRk4ziWyY9O5XOEeeuMemlDGJ90uvkJC/Jy4U5Iu+7I3iJW2eqmiQ4AnPDXLvydHx6J0pOK5u4SJkMgVcgZuQP38EwUUTGbt1Mkbp7w==; 31:NKnkxtZ6w02DvI+nLdDXbHg8ztTZjFQSS6Fqk9+4DF6IUQJ3tIb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AEyz/C81hhEu4Z9BdJ460IvTfE9/7YBsEUWvAq38BGLy6NlI7hSElbGEzktvad29C 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)(100000703101)(100105400095)(3002001)(93006095)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(20161123562025)(20161123555025)(20161123558100)(20161123564025)(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: 0420213CCD X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(6049001)(377454003)(76104003)(189002)(199003)(24454002)(97736004)(230700001)(90366009)(110136004)(53936002)(83506001)(4001350100001)(5009440100003)(6246003)(25786009)(65806001)(189998001)(8656003)(31696002)(68736007)(36756003)(6486002)(86152003)(65826007)(3846002)(66066001)(575784001)(65956001)(77096006)(47776003)(93886005)(33646002)(6916009)(72206003)(8936002)(64126003)(101416001)(42186005)(2906002)(5660300001)(305945005)(7736002)(50986999)(54356999)(81156014)(76176999)(478600001)(4326008)(50466002)(2950100002)(31686004)(106356001)(8676002)(42882006)(6116002)(23746002)(6666003)(81166006)(229853002)(105586002)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR07MB3098; H:[10.89.1.1]; 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:rYUMY2yUvVIDBTnLdXeeoxpYu4DxGPt5L722p?= =?Windows-1252?Q?rLHIOpdsGO0WhGG0Xd33brn9kqwU4YnGqVJiGO2r3HNRDSYyqnIKChuH?= =?Windows-1252?Q?7rK0SVvhaXN7PhUNzz0gwF9FLaBAO9JUu79MmMRnzwWtGxSjlri/70zV?= =?Windows-1252?Q?SZ0QiE0kil+mK6PaPWAEF1BZvwNgm1A5HOGrWuiPBL86uKQTrjyjiX9p?= =?Windows-1252?Q?PuDpxXh5RjOOcbEzTek0/2ab2Akg7EyPa6d+dqLCajrs73sEG5yM663j?= =?Windows-1252?Q?GRaoJiDKRQvvD55X+7Jjlpmo/KG6K1ul4JjFouEBOvO5USPGeWA8DC03?= =?Windows-1252?Q?dtvmc5pNzI43KBYpwr9ccHtdZW0ePTZAgtwI9qVBe5CcPxEhH9mZ9IPv?= =?Windows-1252?Q?liQ1v/dcRoQfLqRnRUHFePQ7EBbbLdv9JDSw08+1QR/4GnfAHLOMH1J+?= =?Windows-1252?Q?ue/CVBgBVU56Zxv6W1ipx/S2IlYFQ4ghp+aii6OuKsEIUgCQpiYlUe+L?= =?Windows-1252?Q?haMymmdsHWwhpV6Lgdl9aMikkPQJl6h9CJM9Y8OlDhevkkMm21UbWgk6?= =?Windows-1252?Q?BMv/tszREewBW5vWIMZPJtosBvYu9hFx/OFEu6J6H0+o78v+GLqm4J+4?= =?Windows-1252?Q?5DmhRdndsyC8YHapAhOH2O8VBUNXzZ2m5Psvndb/L9HxZ7y2NNJzsEvQ?= =?Windows-1252?Q?dm7oV40amMYnDRDlA1kJoacVwpGyzV8etU5S/9rJixEdptAo6YxZAGrQ?= =?Windows-1252?Q?OqPZaMSTwIKSFF7RNoh+ZN4JWGUZ58y3Y37ptJD+n9OK6+0GWA1OCObj?= =?Windows-1252?Q?+qrDS44vxuh6ZPz5KbTYJjq0QjnaKlGBoKWCytEuGYr7VrsgJU8zPyju?= =?Windows-1252?Q?NyoxlC9FiBN3v9CG5NknN1Em4uR+qeR06goFwgh0uVvw/bKzAYelNiwJ?= =?Windows-1252?Q?5TN3Bte4z9om1aWvUtVmrN7kAuXOgNPVB3t8FXChb17xCE0nbFg8T9fn?= =?Windows-1252?Q?wgEK83J49BhMjpIFClS5qE/IQjxs23JARb/KQhd9dHY4RN6LmAo8DQcV?= =?Windows-1252?Q?sSyPu5Km2OMVvZyn3BPl6pUujuzYGFASRtvPdL6NMmpgYrTy3teEUML2?= =?Windows-1252?Q?pvE3p08oS8HH18PtfV0jYmla8R8QGKkcdq7vYRUN3680yg0tJlAatj/y?= =?Windows-1252?Q?eMQ4AL+hEW+ZftqZ6FFStc9ZJxT7yZe3E8ngLVW9lTezJuUDwCF/L61W?= =?Windows-1252?Q?sJqZlnuW6+lxEHXce/RgP+ZZdoHY+An5Lv/gCBtVwSqFKEwru6LZRjBt?= =?Windows-1252?Q?WwQfbFeNpa9zfRzy+dmOG9IyST1KIxwyVsDwkI/5ToF6SSWn4NkQOsJh?= =?Windows-1252?Q?BHHihq3YcSvtP5kt0NEHSmHDd+HHzH9uf4E/s1fOp6he+u5gidNXjmYo?= =?Windows-1252?Q?2CzufV5v6OIJzZ9z+X4ShJWTB/pbBAmoF34N8JgK9rnSEwm07pcq3Uca?= =?Windows-1252?Q?gjQbtBLDLpDC1Rc4hXmt6zpoAYPSrux58AVB0il4x7xyM1/CkizaIGXU?= =?Windows-1252?Q?nkzpwNDn9h4wM2KpN1e+uf0v39DGdm42WU5XbKsOW+HOSH6qc15/Q0+e?= =?Windows-1252?B?Zz09?= X-Microsoft-Exchange-Diagnostics: 1; DM5PR07MB3098; 6:IOfDfuecKQrVUZoWCPgUuBFaXVQbLpg25N7PJ7ZQVodibEgmvJ1hg0fIwZyR+w1YQEsisHzOZgpATTxZFcYieZF0W31zU7u06ZS5zH44Dj4ZNHPNDM0hdLyC927LFU0DpLEmaTCx9uXBp0VX9vXX/wSgKhAruqfSno3iqCA1Rp63JuQRyWzj6j06jpSzMQGQGrNh5l6zdrMeUTP2YJjSaOFTY94M7x1YsOdgT0zPrG8W4WRfrjVYgkOrug8BmOLeVIjj28n42J7WAiUgmY1eY86bwz4t9cLwvrbauf7T6ne2QeQfmmimIb4GGLS8MS+IlG+rlyNi4Qv4zYm0Eu9u2A==; 5:NwNmhg2JezUrcJ/TaN7t9tk3uIPE4uYDkkUGRASUkN9uUb3P029KM0FipXvD/hPlS1ZUV50PHumzepbnb9+2+Bd99Kpt7MJRP/GKJkvYkp2z4lxcxUdp96ZAX/+qlcCrQbvwV051OAWikXmmAvPE4w==; 24:SBvpXclufoi3dr5q+wkZ/GubjAFuFt9Tae7ADvnQvChBs1PxYSZRgnXvZktB/I6r4l3ja8fOHcegBs2sB2CtXiI/K9zIpYp7KT+U8aV1rgA=; 7:HI7riIOmHH3Fue6bnJ4dYIM4UkPCb/ySekYuHRyJFRKZ2Y8o891k7/kWVh6p7b10MZr8UfU7H62iePdFdfq7ziLmKRCZIofX8ASJdfKob0697nKC/+tXQmZ0EcOSUSai/88iFcITrhzAfmo73eHmBVaHrTe3xk408TDDLSIOr7A/YIPQC0noHjJdxQGo2VwS21eH/JQH2dh7oAp+uniaCTZSPRECLa8qWvWAJYLea30= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Sep 2017 17:46:09.6364 (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: Mon, 04 Sep 2017 17:46:14 -0000 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.