From patchwork Sat Jan 29 22:24:34 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Blanchard X-Patchwork-Id: 80978 X-Patchwork-Delegate: benh@kernel.crashing.org Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from bilbo.ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 7CCBFB7249 for ; Sun, 30 Jan 2011 09:25:08 +1100 (EST) Received: by ozlabs.org (Postfix) id 76D70B7118; Sun, 30 Jan 2011 09:25:02 +1100 (EST) Delivered-To: linuxppc-dev@ozlabs.org Received: from kryten (unknown [120.155.164.217]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPSA id 3F86BB710E; Sun, 30 Jan 2011 09:24:58 +1100 (EST) Date: Sun, 30 Jan 2011 09:24:34 +1100 From: Anton Blanchard To: Nishanth Aravamudan , Benjamin Herrenschmidt , jlarrew@linux.vnet.ibm.com Subject: [PATCH 1/5] powerpc/numa: Only use active VPHN count fields Message-ID: <20110130092434.42a887ef@kryten> In-Reply-To: <20110130092217.70ebb424@kryten> References: <20110118123152.50f75a72@kryten> <20110118224718.GA19039@us.ibm.com> <1295409980.2148.125.camel@pasglop> <20110119043757.GA29865@us.ibm.com> <20110130092217.70ebb424@kryten> X-Mailer: Claws Mail 3.7.6 (GTK+ 2.22.0; i486-pc-linux-gnu) Mime-Version: 1.0 Cc: linuxppc-dev@ozlabs.org X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org VPHN supports up to 8 distance fields but the number of entries in ibm,associativity-reference-points signifies how many are in use. Don't look at all the VPHN counts, only distance_ref_points_depth worth. Since we already cap our distance metrics at MAX_DISTANCE_REF_POINTS, use that to size the VPHN arrays and add a BUILD_BUG_ON to avoid it growing larger than the VPHN maximum of 8. Signed-off-by: Anton Blanchard Index: linux-2.6/arch/powerpc/mm/numa.c =================================================================== --- linux-2.6.orig/arch/powerpc/mm/numa.c 2011-01-29 10:48:21.280075270 +1100 +++ linux-2.6/arch/powerpc/mm/numa.c 2011-01-29 10:54:24.547203014 +1100 @@ -1291,8 +1291,7 @@ u64 memory_hotplug_max(void) /* Vrtual Processor Home Node (VPHN) support */ #ifdef CONFIG_PPC_SPLPAR -#define VPHN_NR_CHANGE_CTRS (8) -static u8 vphn_cpu_change_counts[NR_CPUS][VPHN_NR_CHANGE_CTRS]; +static u8 vphn_cpu_change_counts[NR_CPUS][MAX_DISTANCE_REF_POINTS]; static cpumask_t cpu_associativity_changes_mask; static int vphn_enabled; static void set_topology_timer(void); @@ -1305,12 +1304,15 @@ static void setup_cpu_associativity_chan { int cpu = 0; + /* The VPHN feature supports a maximum of 8 reference points */ + BUILD_BUG_ON(MAX_DISTANCE_REF_POINTS > 8); + for_each_possible_cpu(cpu) { int i = 0; u8 *counts = vphn_cpu_change_counts[cpu]; volatile u8 *hypervisor_counts = lppaca[cpu].vphn_assoc_counts; - for (i = 0; i < VPHN_NR_CHANGE_CTRS; i++) { + for (i = 0; i < distance_ref_points_depth; i++) { counts[i] = hypervisor_counts[i]; } } @@ -1339,7 +1341,7 @@ static int update_cpu_associativity_chan u8 *counts = vphn_cpu_change_counts[cpu]; volatile u8 *hypervisor_counts = lppaca[cpu].vphn_assoc_counts; - for (i = 0; i < VPHN_NR_CHANGE_CTRS; i++) { + for (i = 0; i < distance_ref_points_depth; i++) { if (hypervisor_counts[i] > counts[i]) { counts[i] = hypervisor_counts[i]; changed = 1;