From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0042.outbound.protection.outlook.com [104.47.34.42]) by dpdk.org (Postfix) with ESMTP id C8DDE1B1A4 for ; Fri, 5 Jan 2018 11:52:20 +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=oGqQx3hSwxxavxwBvP/UBwru/bPTDoqVNTbiDju7HUM=; b=TxyirMz+gZ55SV+tPEjH0hrK1mnjrDAiT8TP4OQVrojPGtn9GIvNsHEmW/qoTyrBbkzwU0OehzLzyTM2KlCgwqFKFn1dtMRxL98ZQ2C16ejOmdfj6e8kMOfgeytQzFSmEgPHCRFS/4m61AgMe9ux4rJloYz8c+08SjLIC4uXvcY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Santosh.Shukla@cavium.com; Received: from [192.168.0.105] (103.76.57.34) by MWHPR07MB3104.namprd07.prod.outlook.com (10.172.95.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.386.5; Fri, 5 Jan 2018 10:52:17 +0000 To: Olivier MATZ , Hemant Agrawal Cc: dev@dpdk.org References: <1512563473-19969-1-git-send-email-hemant.agrawal@nxp.com> <20171219102456.ghipiyb2ig43d4nk@glumotte.dev.6wind.com> <830d3e36-921b-ef7a-51a4-6d135b15e973@nxp.com> <20171219110204.uqxw4xy66o65pnjz@glumotte.dev.6wind.com> From: santosh Message-ID: <788d727f-f734-d98f-dcff-235b8625cf7f@caviumnetworks.com> Date: Fri, 5 Jan 2018 16:22:04 +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: <20171219110204.uqxw4xy66o65pnjz@glumotte.dev.6wind.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US X-Originating-IP: [103.76.57.34] X-ClientProxiedBy: HK2PR04CA0073.apcprd04.prod.outlook.com (10.170.154.145) To MWHPR07MB3104.namprd07.prod.outlook.com (10.172.95.10) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 46e912eb-25a2-41d6-f35d-08d5542a641d X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060); SRVR:MWHPR07MB3104; X-Microsoft-Exchange-Diagnostics: 1; MWHPR07MB3104; 3:nYmzPo5s7whCuYSggjwMQA5pa+dAdmC8wmv4rtlarJtX2tLC46v33WOVl9HAI2xEe/Y+S9aPKVq9o1jq43vCah061Q3URuqjhVm5HjNPoXEnve2Q9Et2j7vyGdtuinaKTrNqbE4/5rjMhAkg/QK+OQHbX3pEoaj2M2+w2XNVwg4TR8BYazwm4TsXu4LbImlsoVxZtsHLnOw9MZQhNadHkNOpPeVIUQ5rTIC/ZUZd613LuKfO30yjcSTPKj1yc8m7; 25:dSyznV10g85Z6D5Rny/IPfu1kNmKI62h81n69OgGmT0wRBXkxw82gKhRSEnPRG3BMJU9wkQbiv5kjBMWCVV8jzJwRuA9UHzu72bg3uFC/6yopWSam1U/gGuKSsei2xJo3kw38YZhfNPbUDm6StlCO3+EVapL0yoWu0qIyIAK/suwVCd0Y2o+LfNCqkl50J51UlohkJDF4/6JueC67J9Kh2SCOuybPKEK9i7mu7DnUkDDmJvXlB5PldNAlfklAvcjZ2pofC69j8ZZWq7Yv2GCpdkImGNn8uD3TPtpr2bKsOGIjrJpVjkSwVowm06gyjobhUrRMlqsaJBFojstSHU3fA==; 31:7oTROkp6DesISzKmK+TswI3havVuwXS08AjjcxS8NdRT9b/AsIFzX2NdeGGCq2oQGJLW+BuliXBJJP4dmseNpQsvYfKAsn6PxzY3NbaUY629RClLxg/h22N84I687Wg9aEhTN3H/WedtwYiLDimfbMu7SFw/iRdth5KbItI7BCaLGnZ0nw2OLFvmGumowBSOE92IUa7m0aDbW8IhEQM7ecPrKHA6tvCGZCGEJAt9YiE= X-MS-TrafficTypeDiagnostic: MWHPR07MB3104: X-Microsoft-Exchange-Diagnostics: 1; MWHPR07MB3104; 20:WDvNUjQmqcYQPFq/I+UlB8x0yf8k9plypsV2IGKPPp/VqIHFxN/Ia+eTEKttGb7qPIrcH1aia+vX9f04l6M9jkeL7esLCqWry6tf3uwzQEIZrJBu9YwA1zkSHVFTkcbh2AtCAkPi/JUjEzyxlGC5k09TMlMOYyWAtPELM5UAci/1V+Vtz+YiMPvfBLmn1y8YSjnuPYqUQ/8SOXZUuexzPlIHqOfawZsermnhqQcJhYba2oscSgbucg3s/fDKQrwFrFsMMKvRhO3/WhaAcmhczZJT1+mOHnSA+cC6uPBzX420nbyCRDK5q20xbEXqTU7BTGHIeRqQ86RAcDeWwURKNmny7oIwlV1SkOglMSkb8g0NqAvwTxhlYNCCaaF+BE1IhwXJ/jjFIDrvDjQXyuhypBtckQ7ofVg9YWRn9mIj0RUbnl4+pfTFU2ukmZNuI2/3W+mRyqQ0+3K8vRUd80Y37rt8ZsnPsv8kgz60ZmOHNC365Ml6PpqenyWOTP06OFmSiEurThU+/HvySw+eUAAC9Pg5Ja7tCScRi4pjh8SGih+zG0wwjY2xona77dG5yHnWXbwGhq4v0QgFaGZocKXJTseJQ8RW4UXGh1uWYcz9PXc= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(131327999870524)(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(8121501046)(5005006)(3231023)(944501075)(3002001)(10201501046)(93006095)(6041268)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123558120)(6072148)(201708071742011); SRVR:MWHPR07MB3104; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:MWHPR07MB3104; X-Microsoft-Exchange-Diagnostics: 1; MWHPR07MB3104; 4:0BoIlavl33ZE5eiyEPJtZd70lgJwg2QdJe39wkXC+XlI7Qh7NGrGFBsZyzhSdmjzi2ibdbWLuQ/3C+ue4XmkpgPvRAiWcpmGMg2CBuxdoxfSRnwI//YBn0bgmz0l9U4JpN13VtzqmmrwJsfRh0zASpLC5bi+eUqJubu76YQ0RI8zhpvkP6KTUVGBd9OMO4h0Uqg5/pbmGAjngcme/AeluhjjcIHPWq8S2MKGXykLJlCxx7DGsO1oT2Ua5SJzplNZe8nxkhvBDOn/H4Wi+HXHqFyhdeAy5CZSuDUVgzTanJCDesmk4YjdiOqrWWdz8bqnqf6L1UFzUWdmk22oClJaA7J4cXfBXI8FplII3g5BjXk= X-Forefront-PRVS: 05437568AA X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6049001)(396003)(366004)(376002)(346002)(39380400002)(39860400002)(24454002)(189003)(199004)(76104003)(8936002)(6486002)(77096006)(58126008)(50466002)(16576012)(65956001)(65806001)(6116002)(117156002)(31686004)(68736007)(66066001)(90366009)(3846002)(110136005)(229853002)(64126003)(76176011)(47776003)(386003)(31696002)(8676002)(53546011)(81166006)(81156014)(478600001)(23676004)(966005)(2486003)(2906002)(93886005)(52116002)(72206003)(2950100002)(105586002)(6306002)(305945005)(230700001)(53936002)(52146003)(53376002)(42882006)(6246003)(25786009)(36756003)(7736002)(59450400001)(65826007)(86152003)(8656006)(6666003)(4326008)(97736004)(83506002)(16526018)(5660300001)(316002)(106356001); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR07MB3104; 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: =?utf-8?B?MTtNV0hQUjA3TUIzMTA0OzIzOjNpR1VtTEY2cmxERU5ZVHhVYUdHblFCdFhC?=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U=; 7:QhyQj+9tzX20YHOYsYkbN1xgpR4q/qGhXmO3qtI4Ku+wwPsVGmApaAIJo64dlKXJ6DMdpb3/OnpWbKmThdn53tJtq3NlbiUPKmWSMttcBWNbNBXspA5tMi5m8sbF4juXp3xRYziW6e/GoNPY0XLyxU2xSkZKVrbLk4qY18IA/saOoEvdhyBg/t8135k4H6jI7No7sNANESg79BE43t/ijcZBYKo/rVfRaAC9ps2mAyPj3WpPx9NwG5lVV140TKbh SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2018 10:52:17.4399 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 46e912eb-25a2-41d6-f35d-08d5542a641d X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR07MB3104 Subject: Re: [dpdk-dev] [PATCH 1/2] mempool: indicate the usages of multi memzones 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: Fri, 05 Jan 2018 10:52:21 -0000 On Tuesday 19 December 2017 04:32 PM, Olivier MATZ wrote: > On Tue, Dec 19, 2017 at 04:16:33PM +0530, Hemant Agrawal wrote: >> Hi Olivier, >> >> On 12/19/2017 3:54 PM, Olivier MATZ wrote: >>> Hi Hemant, >>> >>> On Wed, Dec 06, 2017 at 06:01:12PM +0530, Hemant Agrawal wrote: >>>> This is required for the optimizations w.r.t hw mempools. >>>> They will use different kind of optimizations if the buffers >>>> are from single contiguous memzone. >>>> >>>> Signed-off-by: Hemant Agrawal >>>> --- >>>> lib/librte_mempool/rte_mempool.c | 7 +++++-- >>>> lib/librte_mempool/rte_mempool.h | 5 +++++ >>>> 2 files changed, 10 insertions(+), 2 deletions(-) >>>> >>>> diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c >>>> index d50dba4..9d3737c 100644 >>>> --- a/lib/librte_mempool/rte_mempool.c >>>> +++ b/lib/librte_mempool/rte_mempool.c >>>> @@ -387,13 +387,16 @@ rte_mempool_populate_iova(struct rte_mempool *mp, char *vaddr, >>>> total_elt_sz = mp->header_size + mp->elt_size + mp->trailer_size; >>>> >>>> /* Detect pool area has sufficient space for elements */ >>>> - if (mp->flags & MEMPOOL_F_CAPA_PHYS_CONTIG) { >>>> - if (len < total_elt_sz * mp->size) { >>>> + if (len < total_elt_sz * mp->size) { >>>> + if (mp->flags & MEMPOOL_F_CAPA_PHYS_CONTIG) { >>>> RTE_LOG(ERR, MEMPOOL, >>>> "pool area %" PRIx64 " not enough\n", >>>> (uint64_t)len); >>>> return -ENOSPC; >>>> } >>>> + } else { >>>> + /* Memory will be allocated from multiple memzones */ >>>> + mp->flags |= MEMPOOL_F_MULTI_MEMZONE; >>>> } >>>> >>>> memhdr = rte_zmalloc("MEMPOOL_MEMHDR", sizeof(*memhdr), 0); >>>> diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h >>>> index 721227f..394a4fe 100644 >>>> --- a/lib/librte_mempool/rte_mempool.h >>>> +++ b/lib/librte_mempool/rte_mempool.h >>>> @@ -292,6 +292,11 @@ struct rte_mempool { >>>> */ >>>> #define MEMPOOL_F_CAPA_BLK_ALIGNED_OBJECTS 0x0080 >>>> >>>> +/* Indicates that the mempool buffers are allocated from multiple memzones >>>> + * the buffer may or may not be physically contiguous. >>>> + */ >>>> +#define MEMPOOL_F_MULTI_MEMZONE 0x0100 >>>> + >>>> /** >>>> * @internal When debug is enabled, store some statistics. >>>> * >>>> -- >>>> 2.7.4 >>>> >>> I'm not confortable with adding more and more flags, as I explained >>> here: http://dpdk.org/ml/archives/dev/2017-December/083909.html >> This particular flag is not about how to populate mempool. This is just >> indicating how the mempool was populated - a status flag. This information >> is just helpful for the PMDs. >> >> At least I am not able to see that this particular flag is being very driver >> specific. > That's true, I commented too fast :) > And what about using mp->nb_mem_chunks instead? Would it do the job > in your use-case? > > >>> It makes the generic code very complex, and probably buggy (many >>> flags are incompatible with other flags). >>> >>> I'm thinking about moving the populate_* functions in the drivers >>> (this is described a bit more in the link above). What do you think >>> about this approach? >>> >> The idea is good and it will give fine control to the individual mempools to >> populate the memory the way they want. However, on the downside, it will >> also lead to lot of duplicate code or similar code. It may also lead to a >> maintenance issue for the mempool PMD owner. > Yes, that will be the drawback. If we do this, we should try to keep some > common helpers in the mempool lib. Sorry for jumping late on this and not responding to other thread. Olivier, We in-fact I tried said approach for ONA mempool driver but never proposed ;) for the reason which was pointed by Hemant.. meaning more code duplication across mempool PMD thus more maintenance burden. However, I'm in favor of giving more control to driver.