From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751499AbbIKCPM (ORCPT ); Thu, 10 Sep 2015 22:15:12 -0400 Received: from mail-bn1bbn0104.outbound.protection.outlook.com ([157.56.111.104]:32032 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750923AbbIKCPJ (ORCPT ); Thu, 10 Sep 2015 22:15:09 -0400 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=scottwood@freescale.com; Message-ID: <1441937700.2909.44.camel@freescale.com> Subject: Re: [PATCH V7 1/3] genalloc:support memory-allocation with bytes-alignment to genalloc From: Scott Wood To: Zhao Qiang-B45475 CC: "linux-kernel@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "lauraa@codeaurora.org" , Xie Xiaobo-R63061 , "benh@kernel.crashing.org" , Li Yang-Leo-R58472 , "paulus@samba.org" Date: Thu, 10 Sep 2015 21:15:00 -0500 In-Reply-To: References: <1441011520-15424-1-git-send-email-qiang.zhao@freescale.com> <1441153816.4966.109.camel@freescale.com> <1441160299.4966.122.camel@freescale.com> <1441816660.29081.7.camel@freescale.com> <1441922820.2909.10.camel@freescale.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.16.0-fta1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Originating-IP: [2601:448:8100:f9f:12bf:48ff:fe84:c9a0] X-ClientProxiedBy: CY1PR21CA0028.namprd21.prod.outlook.com (25.161.247.38) To BN3PR03MB1480.namprd03.prod.outlook.com (25.163.35.143) X-Microsoft-Exchange-Diagnostics: 1;BN3PR03MB1480;2:25FyDf2nxoXJ4VNyRdZCthLUcPCeXNjfh9m66+thMcCg+rMwg6xg7z1ttrYBFFo8gTlMbXttwPxu17+NXqOAxpbKdHlNz/CpOjEc5kGsE97yyGYl3yS02w+ArYsPSE0e1WV3QfXpVVUHohPWSfr7DV093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7qeIqpVdZHN1Dq3xL9iEqCR5VigVt2WohccozNhq7FAs43nDrwc5X1FJgo5MteQv+QYXs8j+TnVGzZ8irQ8ISimjXPo38dR+qeHDVv1WH/UMCaZHTXSBxIfVP38F4m+NhCtV62/rHu4YdBKKDZU7lszmroBasd0IVLS6V86XkJCP715TnzUxeVQ0qH8U0PBgdwfMCEdyjimLnsUp4lkCyLEgYsOI9Mpy7hmWHFeZLryrlXmPNLZCzurkqKo1lu6UDEEhDQ0H+Qe9UKvX1Pk3hd8c2kReIWAQZ+bT3e6+F6sQbkJihW1iZC5o68 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(5005006)(8121501046)(3002001);SRVR:BN3PR03MB1480;BCL:0;PCL:0;RULEID:;SRVR:BN3PR03MB1480; X-Forefront-PRVS: 06968FD8C4 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6009001)(199003)(377454003)(13464003)(189002)(377424004)(24454002)(42186005)(68736005)(87976001)(5007970100001)(64706001)(50466002)(103116003)(81156007)(19580405001)(5004730100002)(19580395003)(189998001)(101416001)(77096005)(46102003)(5820100001)(97736004)(4001540100001)(50986999)(110136002)(5001830100001)(5001860100001)(76176999)(40100003)(122386002)(106356001)(5001960100002)(62966003)(4001450100002)(86362001)(93886004)(50226001)(47776003)(2950100001)(33646002)(105586002)(92566002)(23676002)(36756003)(77156002)(99106002)(3826002)(5001840100002);DIR:OUT;SFP:1102;SCL:1;SRVR:BN3PR03MB1480;H:[IPv6:2601:448:8100:f9f:12bf:48ff:fe84:c9a0];FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCTjNQUjAzTUIxNDgwOzIzOk42ZmxwOW9YYzljcFNhRlFVcW9GR2x4VVRT?= =?utf-8?B?SGc0eEsyeFM3OHNESnpkaGxjWnJYY1dNYnRrSEJ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ZQCwJkorEBAlFswB5bYE5m9GXKS4zARuXUpau+pFTE+dDu6eigPzp787NSYchDpgNtMFp2OMQs4lhjquHxgNH3GZBgLkK+5ZrOHnkQ87RLC+eNO4nSVfq7VQ==;24:YwFBch3SC4QiKaTYDIKo0MB6ClUdBN5ilI2/rvvpvW7b62I5jqgn4kyoXbpRAvEA/7tZGDJEk4I1oEgku7qdKrU+ttxZUFwVbtiA6xULx2w=;20:kp+0j3QlYE9cOMYT6T/wdJXuvU95lBw0HpotUaBvlw7dGDXYZEfWScP7hT4qsinwrD6714Sw9heqIt0/p/13Rg== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Sep 2015 02:15:06.0460 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR03MB1480 X-Microsoft-Exchange-Diagnostics: 1;BN3PR03MB1463;2:F8cabhBJ5pgLetBpgsr+elg0mhrhnriKjeYPSuSzwpCOAapoNjlE4O3ikrmsTyA5SWmlKuUOojYNr1i6X8Gqu1iQthGnMQn/+srS3TSZE3deOVt5E3VncpebNt9BfSWBLQSxa6Jxgr0jEW8PNFPExG4hu8hagAvPyPEfWyAOVhY=;23:jC2KnJ+JmAizukgqb+H0u+ZobYVcd0nxPZRy7ZwhLAPXnsOhNrOPz8LIOy94PtUxlu8mX0v/wTa96VmXH8QnGFWkWiB1B/jJaIGGIyqjNXbNxPWdm0f/I5SOeFfTI67rjRKAd1Au1IDcIgkJekEN0AzXb7D2IUsac+3hAKF7Fy9xiqtRWbLWT3zmmNj1nXgx X-OriginatorOrg: freescale.com Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2015-09-10 at 21:09 -0500, Zhao Qiang-B45475 wrote: > On Fri, 2015-09-11 at 06:07AM -0500, Wood Scott-B07421 wrote: > > -----Original Message----- > > From: Wood Scott-B07421 > > Sent: Friday, September 11, 2015 6:07 AM > > To: Zhao Qiang-B45475 > > Cc: linux-kernel@vger.kernel.org; linuxppc-dev@lists.ozlabs.org; > > lauraa@codeaurora.org; Xie Xiaobo-R63061; benh@kernel.crashing.org; Li > > Yang-Leo-R58472; paulus@samba.org > > Subject: Re: [PATCH V7 1/3] genalloc:support memory-allocation with > > bytes-alignment to genalloc > > > > On Wed, 2015-09-09 at 21:26 -0500, Zhao Qiang-B45475 wrote: > > > On Wed, 2015-09-10 at 12:38AM -0500, Wood Scott-B07421 wrote: > > > > -----Original Message----- > > > > From: Wood Scott-B07421 > > > > Sent: Thursday, September 10, 2015 12:38 AM > > > > To: Zhao Qiang-B45475 > > > > Cc: linux-kernel@vger.kernel.org; linuxppc-dev@lists.ozlabs.org; > > > > lauraa@codeaurora.org; Xie Xiaobo-R63061; benh@kernel.crashing.org; > > > > Li Yang-Leo-R58472; paulus@samba.org > > > > Subject: Re: [PATCH V7 1/3] genalloc:support memory-allocation with > > > > bytes-alignment to genalloc > > > > > > > > On Sat, 2015-09-05 at 22:13 -0500, Zhao Qiang-B45475 wrote: > > > > > On Wed, 2015-09-02 at 10:18AM +0800, Wood Scott-B07421 wrote: > > > > > > -----Original Message----- > > > > > > From: Wood Scott-B07421 > > > > > > Sent: Wednesday, September 02, 2015 10:18 AM > > > > > > To: Zhao Qiang-B45475 > > > > > > Cc: linux-kernel@vger.kernel.org; linuxppc-dev@lists.ozlabs.org; > > > > > > lauraa@codeaurora.org; Xie Xiaobo-R63061; > > > > > > benh@kernel.crashing.org; Li Yang-Leo-R58472; paulus@samba.org > > > > > > Subject: Re: [PATCH V7 1/3] genalloc:support memory-allocation > > > > > > with bytes-alignment to genalloc > > > > > > > > > > > > On Tue, 2015-09-01 at 21:10 -0500, Zhao Qiang-B45475 wrote: > > > > > > > On Wed, 2015-09-02 at 08:38AM +0800, Wood Scott-B07421 wrote: > > > > > > > > -----Original Message----- > > > > > > > > From: Wood Scott-B07421 > > > > > > > > Sent: Wednesday, September 02, 2015 8:30 AM > > > > > > > > To: Zhao Qiang-B45475 > > > > > > > > Cc: linux-kernel@vger.kernel.org; > > > > > > > > linuxppc-dev@lists.ozlabs.org; lauraa@codeaurora.org; Xie > > > > > > > > Xiaobo-R63061; benh@kernel.crashing.org; Li Yang-Leo-R58472; > > > > > > > > paulus@samba.org > > > > > > > > Subject: Re: [PATCH V7 1/3] genalloc:support > > > > > > > > memory-allocation with bytes-alignment to genalloc > > > > > > > > > > > > > > > > On Mon, 2015-08-31 at 16:58 +0800, Zhao Qiang wrote: > > > > > > > > > Bytes alignment is required to manage some special RAM, so > > > > > > > > > add gen_pool_first_fit_align to genalloc, meanwhile add > > > > > > > > > gen_pool_alloc_data to pass data to > > > > > > > > > gen_pool_first_fit_align(modify gen_pool_alloc as a > > > > > > > > > wrapper) > > > > > > > > > > > > > > > > > > Signed-off-by: Zhao Qiang > > > > > > > > > --- > > > > > > > > > Changes for v6: > > > > > > > > > - patches set v6 include a new patch because of using > > > > > > > > > - genalloc to manage QE MURAM, patch 0001 is the new > > > > > > > > > - patch, adding bytes alignment for allocation for > > use. > > > > > > > > > Changes for v7: > > > > > > > > > - cpm muram also need to use genalloc to manage, it > > has > > > > > > > > > a function to reserve a specific region of muram, > > > > > > > > > add offset to genpool_data for start addr to be > > > > allocated. > > > > > > > > > > > > > > > > This seems to be describing more than just the changes in > > > > > > > > this > > > > patch. > > > > > > > > What does also handling cpm have to do with this patch? Are > > > > > > > > you adding support for reserving a specific region in this > > > > > > > > patch? I don't see it, and in any case it should go in a > > different patch. > > > > > > > > > > > > > > Yes, I added. The code below can support the function. > > > > > > > offset_bit = (alignment->offset + (1UL << order) - 1) >> > > > > order; > > > > > > > return bitmap_find_next_zero_area(map, size, start + > > > > > > > offset_bit, > > > > > > nr, > > > > > > > align_mask); > > > > > > > > > > > > > > CPM has an function cpm_muram_alloc_fixed, needing to allocate > > > > > > > muram from a Specific offset. So I add the code and add offset > > > > > > > to > > > > struct data. > > > > > > > > > > > > I thought the offset was related to the previous discussion of > > > > > > checking for allocation failure. Are you using it to implement > > > > > > alloc_fixed()? If so, please don't. Besides the awkward > > > > > > implementation (what does it logically have to do with > > > > > > gen_pool_first_fit_align?), it does not appear to be correct - > > > > > > - what happens with multiple chunks? What happens if part of > > > > > > the region the caller is trying to reserve is already taken? > > > > > > Implement a proper function to reserve a fixed genalloc region. > > > > > > > > > > > The offset is which allocation block address need to be larger > > > > > than, Not equal to, it really like the parameter start of the > > > > > algo(the bitnumber To start searching at). > > > > > > > > cpm_muram_alloc_fixed() is not "search starting at this offset". It > > > > is "reserve this exact range or fail". > > > > > > Yes, you are right! How about to add a new algo into genalloc to > > > search At offset, then handle it in muram layer, if the address return > > > from genalloc Is not equal to offset, return negative number? > > > > If you're adding a new algorithm, why not make it actually do what you > > want rather than adding something different and fixing it up in the > > caller? > > Because I'm not sure whether it is proper to add a "offset searching at" > algo. Again, "offset searching at" is not what we want anyway. What we want is "allocate this range or fail". Why would it be improper to have such an algorithm? -Scott