From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0083.outbound.protection.outlook.com [104.47.32.83]) by dpdk.org (Postfix) with ESMTP id C4E882BB5; Thu, 1 Feb 2018 11:33:49 +0100 (CET) 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=6ViBRGcLcz3UHlUZzOgIddDs7rzWFG61NnjMe93csWQ=; b=PdTviSPydEZFv32d6lAjXmijZ7KwtWkhvKIBbBihzW4H6QfNv0Z7jovOy7NnD6HyidEFRCyKpu+r9B8ody99toob9keVi3dNhR3p6qi9HFPm+S287CR6AUyfP6clw1i0kVM2grRp1Dk5LksblLtQQJwwGKS+iSAJNiCDzkKqMXs= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Santosh.Shukla@cavium.com; Received: from [192.168.0.105] (103.76.56.167) by SN1PR0701MB1903.namprd07.prod.outlook.com (10.162.100.29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.444.14; Thu, 1 Feb 2018 10:33:44 +0000 To: Olivier Matz , Andrew Rybchenko Cc: dev@dpdk.org, stable@dpdk.org, jerin.jacob@caviumnetworks.com 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> <53796b3f-b2c2-dcfc-a10b-71ce1a68d3d2@caviumnetworks.com> <618e4eb2-e66c-592c-2065-f86328916d5d@solarflare.com> <20180201101423.k5yqxd5a2dk55qqw@platinum> From: santosh Message-ID: <44211f68-9a31-8025-afd4-43f482bd4e87@caviumnetworks.com> Date: Thu, 1 Feb 2018 16:03:32 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <20180201101423.k5yqxd5a2dk55qqw@platinum> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: en-US X-Originating-IP: [103.76.56.167] X-ClientProxiedBy: SG2PR06CA0101.apcprd06.prod.outlook.com (10.170.138.27) To SN1PR0701MB1903.namprd07.prod.outlook.com (10.162.100.29) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fc5c6858-1bc1-4a34-063c-08d5695f4679 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:SN1PR0701MB1903; X-Microsoft-Exchange-Diagnostics: 1; SN1PR0701MB1903; 3:3nfHk0vBzzL/F63Dwe04cIBPH0yZ2o/siaMJShn4W1RxPLI8yVTaJU8W9D33yP1WE0uFzfloiAt4J6l9ptQXI08QwJNc3lD3L/n34DptVz73ddqsU5nC99dYUwDriS/Y09jHXXSjM5qz628hAHqNk2/uxWNIcaUrnFzcnI/8WqxX6KBOpSQBKYXKd2Ulu5JsK8flt5kZGhj8UaN2Ne4QsNgXE/417mBvM+zmah33kdAI9uv+g38JRcWvyAseZQRn; 25:NCA8BFTkmSgkEosHEwJgcVGBaK+GyTA04KU0Azcl2YKtp4IJX7e6BqG7fTQjSmqvrZUi58B/1s22ULzGE7EtmejjCCnWGysLpBcCGf2vHLOvMcwMYvrTshWE5gEGT+VNUQZ/Lh3du0ttQmanzV/CGLch2eW7c80aSxYPvLFC2tzYJ9UOFfPCPM8BguZqxVRrj0pVZFz+S2WJ+xT3lQQNSZoFdkduSuMCjXfK17ckwnRcLB/6Cu/OqF5fM5qsUX+G3YbCc3DxaV6e200kTe+GOyiRBP6SsonwHcOutAFZlSYucIOsO8NJRI2HDU3eV5VMZsoppE+q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R7r4PkfJdrtzZHqTD4o1ssIi8tCQ5pULHSfdlxuQdG1xN+LuksbTdIYQ+GH9f7jqzyLop9VDIIUxw1g31tT3pfTCg6GFbUDBbWrSmRa7UjHmBBvp72lVVGJ3r4UfoOAwzppCV8EFnAfuyexyL3BSOKYwwZc6waLZeVH7g== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(8121501046)(5005006)(10201501046)(3231101)(2400082)(944501161)(3002001)(93006095)(6041288)(20161123558120)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(6072148)(201708071742011); SRVR:SN1PR0701MB1903; BCL:0; PCL:0; RULEID:; SRVR:SN1PR0701MB1903; X-Forefront-PRVS: 0570F1F193 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6049001)(346002)(366004)(39380400002)(396003)(39860400002)(376002)(199004)(189003)(305945005)(8676002)(478600001)(86152003)(59450400001)(53546011)(83506002)(23676004)(52146003)(2486003)(8936002)(2906002)(386003)(90366009)(16576012)(107886003)(6666003)(25786009)(58126008)(117156002)(229853002)(106356001)(4326008)(5660300001)(2950100002)(42882006)(110136005)(7736002)(68736007)(31686004)(2870700001)(6486002)(81156014)(76176011)(47776003)(66066001)(316002)(36756003)(65956001)(81166006)(52116002)(6246003)(64126003)(65826007)(105586002)(72206003)(53936002)(50466002)(77096007)(26005)(16526019)(31696002)(93886005)(97736004)(3846002)(65806001)(6116002); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR0701MB1903; H:[192.168.0.105]; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:3; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtTTjFQUjA3MDFNQjE5MDM7MjM6bDJ6cjlPRUdqcjVLRDRYU29Hc2tENTFQ?= =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rJKQO+qro7yiPIvwDg5IPMnOFWUbpUFn+BT50vKmXmD2DfkO0hD3F1Z5/NWm4TDtk8ir8zBkQN/F7vfNJD0fz5UU5PEbOTCm94EXcw+KnqGO7UOg6OtTdGHeaxXpkJu1Hg2PZwHAMV+H6Aayp SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Feb 2018 10:33:44.8407 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fc5c6858-1bc1-4a34-063c-08d5695f4679 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR0701MB1903 Subject: Re: [dpdk-dev] [RFC v2 01/17] mempool: fix phys contig check if populate default skipped 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, 01 Feb 2018 10:33:50 -0000 On Thursday 01 February 2018 03:44 PM, Olivier Matz wrote: > On Thu, Feb 01, 2018 at 01:00:12PM +0300, Andrew Rybchenko wrote: >> On 02/01/2018 12:30 PM, santosh wrote: >>> On Thursday 01 February 2018 02:48 PM, Andrew Rybchenko wrote: >>>> 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. >>>> >>> That depends and again upto application requirement, if app further down >>> wants to refer mp->flags for _align/_contig then better update to mp->flags. >>> >>> But that wasn't the point of discussion, I'm trying to understand that >>> w/o this patch, whats could be the application level problem? >> The problem that it is fragile. If application does not use >> rte_mempool_populate_default() it has to care about addition >> of mempool capability flags into mempool flags. If it is not done, >> rte_mempool_populate_iova/virt/iova_tab() functions will work >> incorrectly since F_CAPA_PHYS_CONTIG and >> F_CAPA_BLK_ALIGNED_OBJECTS are missing. >> >> The idea of the patch is to make it a bit more robust. I have no >> idea how it can break something. If capability flags are already >> there - no problem. If no, just make sure that we locally have them. > The example given by Santosh will work, but it is *not* the role of the > application to update the mempool flags. And nothing says that it is mandatory > to call rte_mempool_ops_get_capabilities() before the populate functions. > > For instance, in testpmd it calls rte_mempool_populate_anon() when using > anonymous memory. The capabilities will never be updated in mp->flags. Valid case and I agree with your example and explanation. With nits change: mp->flags |= mp_capa_flags; Acked-by: Santosh Shukla