From patchwork Tue Jan 28 01:35:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jingoo Han X-Patchwork-Id: 3544811 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D4EDAC02DC for ; Tue, 28 Jan 2014 01:36:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 035A12011E for ; Tue, 28 Jan 2014 01:36:40 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 628A7200F0 for ; Tue, 28 Jan 2014 01:36:38 +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 1W7xbM-0007v3-29; Tue, 28 Jan 2014 01:36:32 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1W7xbJ-0007u5-Mi; Tue, 28 Jan 2014 01:36:29 +0000 Received: from mailout1.samsung.com ([203.254.224.24]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W7xbF-0007tj-Af for linux-arm-kernel@lists.infradead.org; Tue, 28 Jan 2014 01:36:27 +0000 Received: from epcpsbgr3.samsung.com (u143.gpu120.samsung.co.kr [203.254.230.143]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N0300MO18FOTY10@mailout1.samsung.com> for linux-arm-kernel@lists.infradead.org; Tue, 28 Jan 2014 10:35:48 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [203.254.230.50]) by epcpsbgr3.samsung.com (EPCPMTA) with SMTP id 07.FB.10092.47907E25; Tue, 28 Jan 2014 10:35:48 +0900 (KST) X-AuditID: cbfee68f-b7f156d00000276c-0d-52e70974185e Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 84.C6.29263.37907E25; Tue, 28 Jan 2014 10:35:48 +0900 (KST) Received: from DOJG1HAN03 ([12.23.120.99]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N03001AU8FNYJ00@mmp2.samsung.com>; Tue, 28 Jan 2014 10:35:47 +0900 (KST) From: Jingoo Han To: 'Catalin Marinas' Subject: [PATCH 1/2] arm64: use num_possible_cpus() instead of NR_CPUS Date: Tue, 28 Jan 2014 10:35:47 +0900 Message-id: <001d01cf1bc9$452569d0$cf703d70$%han@samsung.com> MIME-version: 1.0 X-Mailer: Microsoft Office Outlook 12.0 Thread-index: Ac8byUTp4bx8UjVSRxGEUXrYHSQfwA== Content-language: ko X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrHIsWRmVeSWpSXmKPExsVy+t8zI90SzudBBit3cVm8X9bDaHF54SVW i02Pr7FavPx4gsWBxWPNvDWMHpuX1Hv0bVnFGMAcxWWTkpqTWZZapG+XwJXxas1t9oJLghV9 P3vYGhjf8XYxcnBICJhIvH4R3cXICWSKSVy4t56ti5GLQ0hgGaPEvZ/fWSASJhJreteyg9hC AtMZJe7fLoco+sUosebaDTaQBJuAmsSXL4fBikQE9CXen17MArKAWaBY4mW/CUhYWMBN4tjO frCZLAKqEidffAOzeQVsJda+m8MIYQtK/Jh8DyzOLKAlsX7ncSYIW15i85q3zBA3q0s8+qsL sUlPYuffpWwQJSIS+168YwQ5TUJgFbvE+6fbmSF2CUh8m3yIBaJXVmLTAWaItyQlDq64wTKB UWwWks2zkGyehWTzLCQrFjCyr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pDg4QOiO8133+A0aC5pMBfuizD1fSPzts7UvkJlj3dxq23JfYb1t5P VVE6vkT/Unr+05wFQdbSrI9v/7i43vTuyeu223YmGekWm+ne/Vn+XleiImLlPCWW4oxEQy3m ouJEANLM7uofAwAA DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140127_203625_598962_85E31F45 X-CRM114-Status: GOOD ( 11.19 ) X-Spam-Score: -7.4 (-------) Cc: 'Jingoo Han' , 'Will Deacon' , linux-arm-kernel@lists.infradead.org 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use num_possible_cpus() instead of direct use of NR_CPUS. Also, it fixes the following checkpatch warning. WARNING: usage of NR_CPUS is often wrong - consider using cpu_possible(), num_possible_cpus(), for_each_possible_cpu(), etc Signed-off-by: Jingoo Han --- arch/arm64/kernel/smp.c | 10 +++++----- arch/arm64/mm/context.c | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c index 1b7617a..09ff7d4 100644 --- a/arch/arm64/kernel/smp.c +++ b/arch/arm64/kernel/smp.c @@ -320,7 +320,7 @@ void __init smp_init_cpus(void) * cpu_logical_map was initialized to INVALID_HWID to * avoid matching valid MPIDR values. */ - for (i = 1; (i < cpu) && (i < NR_CPUS); i++) { + for (i = 1; (i < cpu) && (i < num_possible_cpus()); i++) { if (cpu_logical_map(i) == hwid) { pr_err("%s: duplicate cpu reg properties in the DT\n", dn->full_name); @@ -352,7 +352,7 @@ void __init smp_init_cpus(void) continue; } - if (cpu >= NR_CPUS) + if (cpu >= num_possible_cpus()) goto next; if (cpu_read_ops(dn, cpu) != 0) @@ -368,9 +368,9 @@ next: } /* sanity check */ - if (cpu > NR_CPUS) + if (cpu > num_possible_cpus()) pr_warning("no. of cores (%d) greater than configured maximum of %d - clipping\n", - cpu, NR_CPUS); + cpu, num_possible_cpus()); if (!bootcpu_valid) { pr_err("DT missing boot CPU MPIDR, not enabling secondaries\n"); @@ -381,7 +381,7 @@ next: * All the cpus that made it to the cpu_logical_map have been * validated so set them as possible cpus. */ - for (i = 0; i < NR_CPUS; i++) + for (i = 0; i < num_possible_cpus(); i++) if (cpu_logical_map(i) != INVALID_HWID) set_cpu_possible(i, true); } diff --git a/arch/arm64/mm/context.c b/arch/arm64/mm/context.c index baa758d..3ef960a 100644 --- a/arch/arm64/mm/context.c +++ b/arch/arm64/mm/context.c @@ -151,7 +151,7 @@ void __new_context(struct mm_struct *mm) smp_wmb(); smp_call_function(reset_context, NULL, 1); #endif - cpu_last_asid += NR_CPUS - 1; + cpu_last_asid += num_possible_cpus() - 1; } set_mm_context(mm, asid);