From patchwork Mon Apr 15 16:13:21 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Pieralisi X-Patchwork-Id: 2446231 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork1.kernel.org (Postfix) with ESMTP id D17B33FD8C for ; Mon, 15 Apr 2013 16:13:54 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1URm2P-0007nt-PJ; Mon, 15 Apr 2013 16:13:49 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1URm2N-0007F9-2J; Mon, 15 Apr 2013 16:13:47 +0000 Received: from service87.mimecast.com ([91.220.42.44]) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1URm2K-0007Ec-53 for linux-arm-kernel@lists.infradead.org; Mon, 15 Apr 2013 16:13:44 +0000 Received: from cam-owa2.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Mon, 15 Apr 2013 17:13:42 +0100 Received: from e102568-lin.cambridge.arm.com ([10.1.255.212]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 15 Apr 2013 17:13:39 +0100 From: Lorenzo Pieralisi To: linux-arm-kernel@lists.infradead.org, devicetree-discuss@lists.ozlabs.org Subject: [RFC PATCH 1/2] ARM: DT: kernel: move temporary cpu map stack array to static data Date: Mon, 15 Apr 2013 17:13:21 +0100 Message-Id: <1366042402-8987-2-git-send-email-lorenzo.pieralisi@arm.com> X-Mailer: git-send-email 1.7.12 In-Reply-To: <1366042402-8987-1-git-send-email-lorenzo.pieralisi@arm.com> References: <1366042402-8987-1-git-send-email-lorenzo.pieralisi@arm.com> X-OriginalArrivalTime: 15 Apr 2013 16:13:39.0843 (UTC) FILETIME=[31129D30:01CE39F4] X-MC-Unique: 113041517134200201 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130415_121344_362117_1C276546 X-CRM114-Status: GOOD ( 13.24 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [91.220.42.44 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Nicolas Pitre , Jon Medhurst , Dave Martin , Andrew Lunn , Tony Lindgren , Benjamin Herrenschmidt , Linus Walleij , Sekhar Nori , Grant Likely , Viresh Kumar , Kukjin Kim , Mark Rutland , Lennert Buytenhek , Lorenzo Pieralisi , Russell King , Magnus Damm , Catalin Marinas , David Brown , Dinh Nguyen , Arnd Bergmann , Stephen Warren , Rob Herring , Simon Horman , Barry Song , Vincent Guittot , Amit Kucheria , Olof Johansson , Maxime Ripard , Shawn Guo X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org As the number of CPUs increase, the temporary array allocated on the stack in arm_dt_init_cpu_maps() can become too big and trigger stack issues. This patch moves the allocated memory to static __initdata so that stack data is not used anymore to allocate the temporary array. Memory is marked as __initdata since it need not be persistent after boot. Signed-off-by: Lorenzo Pieralisi --- arch/arm/kernel/devtree.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm/kernel/devtree.c b/arch/arm/kernel/devtree.c index 70f1bde..f149217 100644 --- a/arch/arm/kernel/devtree.c +++ b/arch/arm/kernel/devtree.c @@ -78,11 +78,12 @@ void __init arm_dt_init_cpu_maps(void) * contain a list of MPIDR[23:0] values where MPIDR[31:24] must * read as 0. */ + static u32 tmp_map[NR_CPUS] __initdata = { + [0 ... NR_CPUS-1] = UINT_MAX }; struct device_node *cpu, *cpus; u32 i, j, cpuidx = 1; u32 mpidr = is_smp() ? read_cpuid_mpidr() & MPIDR_HWID_BITMASK : 0; - u32 tmp_map[NR_CPUS] = { [0 ... NR_CPUS-1] = UINT_MAX }; bool bootcpu_valid = false; cpus = of_find_node_by_path("/cpus");