Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3876000imu; Sat, 24 Nov 2018 12:57:50 -0800 (PST) X-Google-Smtp-Source: AFSGD/WPWniVLrgQAuxLksughxV9uL9MWf/UwWiRrENYnzjFaAT7QNfUzL3AHacpWIszqQo29dHy X-Received: by 2002:a63:3546:: with SMTP id c67mr19291962pga.284.1543093070770; Sat, 24 Nov 2018 12:57:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543093070; cv=none; d=google.com; s=arc-20160816; b=IVK7kGshTq5uuYWzZifq6PXvXLtHSL5OurBmYvtMuUb/OetPIRzuLbWbYAoehh3AJj Z0uUx47JPA4mqk3JgYADpAHtKl6KJibzb4D01CK0kAUg3NHrfmnzFL/H86M+fpqHvoP5 cRkeeqjJd3stLDRhCDiwLROUZ+ZIa4AwplAqB7WAwPbOC4p92AWepzui53xIqt4Pvyu/ OHYvzQDmHwVFBkQBD67tmA25RZtzOveW8tn9yPmAQwoCFmq1v+zToROykzw/FlGR4EDY BpNlcbQBoi9SKjd70zuE7W9mP9QvpUdM4162TSh2rkqlMiRiICYY1u2uJK5TAtYeskUm pK8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=c2/qt/AQMbZD4N2C9zJYqoq/vp/4ypbhhAEF4N8al70=; b=RjoVUwgpeFFk1QfuSugVUT2g9rrLBGSTe9huqQ7srn5JakIE7SFntrB3aia5q9Ffn9 ht7bD4AVQeTRh6McvI9jwNr7s0HrzR1HAt+OoYMeQhSqxFqFLQczQY9Cu/tTCS3WfB2o Q7KyYoOkupRk4sDbPCftAKQgqGN6GumVcCAdyhh2eVC6uOWYel11V/f904VWcfwLA38S 3Tr7jNKxWnROGOm3K5NMmCnynANFWYJgo31MMPq9iLkAicXbKaqkai5oUGeqT4Wu0eiF ivrEJrE2tgYy6rp61nouSeGLyWVTrBoR/r2AA8S1Se0nMyIbQdl6rJ/2AWjyzXiBi4Ms hXTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=R5hzuHLW; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n12si23314132pfg.155.2018.11.24.12.57.35; Sat, 24 Nov 2018 12:57:50 -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; dkim=pass header.i=@kernel.org header.s=default header.b=R5hzuHLW; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726525AbeKYHpm (ORCPT + 99 others); Sun, 25 Nov 2018 02:45:42 -0500 Received: from mail.kernel.org ([198.145.29.99]:46458 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726241AbeKYHpm (ORCPT ); Sun, 25 Nov 2018 02:45:42 -0500 Received: from mail-qt1-f172.google.com (mail-qt1-f172.google.com [209.85.160.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 08B6120874; Sat, 24 Nov 2018 20:56:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543092985; bh=hlBsiUEH+ZWka5a8iz5DaWCEzuHRprj8sINmx8c6ZzU=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=R5hzuHLWEu28G+/iDcUyeLMIPJhd/JrF3lgl1DJ0VqCt/lBaW6szGY7Aa9hQvo6/x VZm+Kk/7b2XfgKpvcBPGXYkYOH3nmFoGUHZ9EkDirmtha5WYAv3ZrXXlDgiHwqluvU 8spO1p47metAK/v5jZXfDHcd+cicMdTb0u5b0Hoo= Received: by mail-qt1-f172.google.com with SMTP id n32so13673765qte.11; Sat, 24 Nov 2018 12:56:24 -0800 (PST) X-Gm-Message-State: AA+aEWb0HiYas5TSBVhX2Vo4FGyB/q/GG2nT7D1zYRqzgFYNA1B6xeC6 KlXHxp+iWWZZcL8jBZpOWejIaz0wcGUDMl1J3Q== X-Received: by 2002:a0c:f212:: with SMTP id h18mr20410240qvk.106.1543092984189; Sat, 24 Nov 2018 12:56:24 -0800 (PST) MIME-Version: 1.0 References: <1542787873-8429-1-git-send-email-miles.chen@mediatek.com> <1542855088.15789.6.camel@mtkswgap22> In-Reply-To: <1542855088.15789.6.camel@mtkswgap22> From: Rob Herring Date: Sat, 24 Nov 2018 14:56:13 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH] of: make MAX_RESERVED_REGIONS configurable To: Miles Chen Cc: Frank Rowand , devicetree@vger.kernel.org, "linux-kernel@vger.kernel.org" , "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" , linux-mediatek@lists.infradead.org, wsd_upstream@mediatek.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > - Add info to reserved_mem array > > What do you think? > > > Rob > >