Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5138272imu; Sun, 25 Nov 2018 17:34:52 -0800 (PST) X-Google-Smtp-Source: AFSGD/XRmc8D3LfjdJBgHvGBCs2jOYrUBiLG/oXEFveMegHIqI+9B5u2QvXxRjmIZugrnjYsENDz X-Received: by 2002:a63:ac1a:: with SMTP id v26mr23155350pge.293.1543196092647; Sun, 25 Nov 2018 17:34:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543196092; cv=none; d=google.com; s=arc-20160816; b=0vcY9qdpZV7PBBShL2iop6bMbX8K9EXEVG9pzvFQjc+jXqJPeu9SpxCAyh2Hz/4dRK m1M3p4JCEOTop0LRlAb/kGGccMjB5aorF5rakdYAondYkk4uYE2o0KFXMqCVlaKKBZER HR+ponC2AWoczrFMeeJjkBdYwldwf2tvlNUYD1+gH0Zed1esKfFhwkuJQ21b9q7fj5L1 AQ4SkZRT4ZsR/KEICLBVwxyTCN9G8VXC2vHVVmslTVxncN7iRXI3FU+avSKSanUsRHK/ 8rD9IRBq+RliDvEMTWDogh3ReKMPEji1nb0FxjU91Qq41B9tfAJSN5sudko/pOT8UDvr pFIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :references:in-reply-to:date:cc:to:from:subject:message-id; bh=zCU5PyHee9R4TtYabMc6pnCSpSRsJ8EgMDeQeRzfPR8=; b=nfTbRTDemvkIhK8Kry7JT02dqCJYNDyMXMIftVMjtcvgTAA9VmAIslgzKzPZ/K4Hso liDtj2M4gvv8+wJ4HEBhJqwnTMFNYTAYA8cP+qWMpDT9movMJQr0V2rRXEYVBvwt70jQ GTrIiDbDzyXF0nb4Gf9RpwtHcJgyknu2sKEgOsF3Ar7LRbrb9BhpdHdWpOfrzdGbkp4B J/M1eLLS727lqQCbly4b5A1gt0IIctgHqQEPPa2Xs7yu/TPmbKiWJRYNfaDp+b6opBfP Do74BpCZ4v2xYCWP3wkIdhAzeHdOo8/pk62xjWBfIm1X6cICQGKFDoQnPwQAUYFpuXvI ovJw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l24si43357858pgb.489.2018.11.25.17.34.37; Sun, 25 Nov 2018 17:34:52 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726154AbeKZM0d (ORCPT + 99 others); Mon, 26 Nov 2018 07:26:33 -0500 Received: from mailgw02.mediatek.com ([210.61.82.184]:21779 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726060AbeKZM0d (ORCPT ); Mon, 26 Nov 2018 07:26:33 -0500 X-UUID: 2c6daa12a1994c90b4f11052d27b84ff-20181126 X-UUID: 2c6daa12a1994c90b4f11052d27b84ff-20181126 Received: from mtkcas08.mediatek.inc [(172.21.101.126)] by mailgw02.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 1517893924; Mon, 26 Nov 2018 09:33:25 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs03n2.mediatek.inc (172.21.101.182) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Mon, 26 Nov 2018 09:33:24 +0800 Received: from [172.21.77.33] (172.21.77.33) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Mon, 26 Nov 2018 09:33:24 +0800 Message-ID: <1543196004.21289.1.camel@mtkswgap22> Subject: Re: [RFC PATCH] of: make MAX_RESERVED_REGIONS configurable From: Miles Chen To: Rob Herring CC: Frank Rowand , , "linux-kernel@vger.kernel.org" , "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" , , Date: Mon, 26 Nov 2018 09:33:24 +0800 In-Reply-To: References: <1542787873-8429-1-git-send-email-miles.chen@mediatek.com> <1542855088.15789.6.camel@mtkswgap22> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.2.3-0ubuntu6 Content-Transfer-Encoding: 7bit MIME-Version: 1.0 X-TM-SNTS-SMTP: 41420FF2AE2873810A499AC0100BA0E77266485F093476C8D88BE13CC359F63C2000:8 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 2018-11-24 at 14:56 -0600, Rob Herring wrote: > On Wed, Nov 21, 2018 at 8:51 PM Miles Chen wrote: > > > > On Wed, 2018-11-21 at 10:39 -0600, Rob Herring wrote: > > > On Wed, Nov 21, 2018 at 2:11 AM wrote: > > > > > > > > From: Miles Chen > > > > > > > > When we use more than 32 entries in /resered-memory, > > > > there will be an error message: "not enough space all defined regions.". > > > > We can increase MAX_RESERVED_REGIONS to fix this. > > > > > > > > commit 22f8cc6e3373 ("drivers: of: increase MAX_RESERVED_REGIONS to 32") > > > > increased MAX_RESERVED_REGIONS to 32 but I'm not sure if increasing > > > > MAX_RESERVED_REGIONS to 64 is suitable for everyone. > > > > > > > > In this RFC patch, CONFIG_MAX_OF_RESERVED_REGIONS is added and used as > > > > MAX_RESERVED_REGIONS. Add a sanity test to make sure that > > > > MAX_RESERVED_REGIONS is less than INIT_MEMBLOCK_REGIONS. > > > > Users can configure CONFIG_MAX_OF_RESERVED_REGIONS according to their > > > > need. > > > > > > I don't want a kconfig option for this. I think it should be dynamic instead. > > > > > > The current flow is like this: > > > > > > for each reserved node: > > > - call memblock_reserve > > > - Add info to reserved_mem array > > > > > > I think we should change it to: > > > > > > for each reserved node: > > > - call memblock_reserve > > > - count number of nodes > > > > > > Alloc array using memblock_alloc > > > > > > for each reserved node: > > > - Add info to reserved_mem array > > > > > > > thanks for your comment. > > > > I reviewed the flow and it might be easier to count the > > nodes and setup array first: > > > > for each reserved node: > > - count number of nodes > > > > Alloc array using memblock_alloc > > > > > > for each reserved node: > > - call memblock_reserve > > The order here is wrong. It is important that you reserve the memory > blocks before doing any allocations. thanks for pointing that out. You are right. I'll follow your suggestion. > > > - Add info to reserved_mem array > > > > What do you think? > > > > > Rob > > > >