From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [67.231.154.164]) by dpdk.org (Postfix) with ESMTP id 69C851B018; Thu, 1 Feb 2018 10:18:48 +0100 (CET) X-Virus-Scanned: Proofpoint Essentials engine Received: from webmail.solarflare.com (uk.solarflare.com [193.34.186.16]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1-us3.ppe-hosted.com (Proofpoint Essentials ESMTP Server) with ESMTPS id DDE749C0076; Thu, 1 Feb 2018 09:18:46 +0000 (UTC) Received: from [192.168.38.17] (84.52.114.114) by ukex01.SolarFlarecom.com (10.17.10.4) with Microsoft SMTP Server (TLS) id 15.0.1044.25; Thu, 1 Feb 2018 09:18:41 +0000 To: santosh , Andrew Rybchenko , Olivier Matz CC: , , References: <1511539591-20966-1-git-send-email-arybchenko@solarflare.com> <1516713372-10572-1-git-send-email-arybchenko@solarflare.com> <1516713372-10572-2-git-send-email-arybchenko@solarflare.com> <20180131164504.cnfgfwo2x3ftxnaj@platinum> <90005aad-1508-44bc-92a4-7c5d5f7b0246@caviumnetworks.com> From: Andrew Rybchenko Message-ID: Date: Thu, 1 Feb 2018 12:18:36 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <90005aad-1508-44bc-92a4-7c5d5f7b0246@caviumnetworks.com> Content-Language: en-GB X-Originating-IP: [84.52.114.114] X-ClientProxiedBy: ocex03.SolarFlarecom.com (10.20.40.36) To ukex01.SolarFlarecom.com (10.17.10.4) X-TM-AS-Product-Ver: SMEX-11.0.0.1191-8.100.1062-23634.003 X-TM-AS-Result: No--13.056700-0.000000-31 X-TM-AS-User-Approved-Sender: Yes X-TM-AS-User-Blocked-Sender: No X-MDID: 1517476727-AlXMShIeMe1l Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-stable] [dpdk-dev] [RFC v2 01/17] mempool: fix phys contig check if populate default skipped X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 09:18:48 -0000 On 02/01/2018 12:09 PM, santosh wrote: > On Thursday 01 February 2018 12:24 PM, Andrew Rybchenko wrote: >> On 02/01/2018 08:05 AM, santosh wrote: >>> On Wednesday 31 January 2018 10:15 PM, Olivier Matz wrote: >>>> On Tue, Jan 23, 2018 at 01:15:56PM +0000, Andrew Rybchenko wrote: >>>>> There is not specified dependency between rte_mempool_populate_default() >>>>> and rte_mempool_populate_iova(). So, the second should not rely on the >>>>> fact that the first adds capability flags to the mempool flags. >>>>> >>>>> Fixes: 65cf769f5e6a ("mempool: detect physical contiguous objects") >>>>> Cc: stable@dpdk.org >>>>> >>>>> Signed-off-by: Andrew Rybchenko >>>> Looks good to me. I agree it's strange that the mp->flags are >>>> updated with capabilities only in rte_mempool_populate_default(). >>>> I see that this behavior is removed later in the patchset since the >>>> get_capa() is removed! >>>> >>>> However maybe this single patch could go in 18.02. >>>> +Santosh +Jerin since it's mostly about Octeon. >>> rte_mempool_xmem_size should return correct size if MEMPOOL_F_CAPA_BLK_ALIGNED_OBJECTS flag >>> is set in 'mp->flags'. Thats why _ops_get_capabilities() called in _populate_default() but not >>> at _populate_iova(). >>> I think, this 'alone' patch may break octeontx mempool. >> The patch does not touch rte_mempool_populate_default(). >> _ops_get_capabilities() is still called there before >> rte_mempool_xmem_size(). The theoretical problem which >> the patch tries to fix is the case when >> rte_mempool_populate_default() is not called at all. I.e. application >> calls _ops_get_capabilities() to get flags, then, together with >> mp->flags, calls rte_mempool_xmem_size() directly, allocates >> calculated amount of memory and calls _populate_iova(). >> > In that case, Application does like below: > > /* Get mempool capabilities */ > mp_flags = 0; > ret = rte_mempool_ops_get_capabilities(mp, &mp_flags); > if ((ret < 0) && (ret != -ENOTSUP)) > return ret; > > /* update mempool capabilities */ > mp->flags |= mp_flags; Above line is not mandatory. "mp->flags | mp_flags" could be simply passed to  rte_mempool_xmem_size() below. > /* calc xmem sz */ > size = rte_mempool_xmem_size(n, total_elt_sz, pg_shift, > mp->flags); > > /* rsrv memory */ > mz = rte_memzone_reserve_aligned(mz_name, size,...); > > /* now populate iova */ > ret = rte_mempool_populate_iova(mp,,..); > > won't it work? > > However I understand that clubbing `_get_ops_capa() + flag-updation` into _populate_iova() > perhaps better from user PoV. > >> Since later patches of the series reconsider memory size >> calculation etc, it is up to you if it makes sense to apply it >> in 18.02 as a fix.