linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Anton Blanchard <anton@samba.org>
To: Nishanth Aravamudan <nacc@us.ibm.com>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	jlarrew@linux.vnet.ibm.com
Cc: linuxppc-dev@ozlabs.org
Subject: [PATCH 1/5] powerpc/numa: Only use active VPHN count fields
Date: Sun, 30 Jan 2011 09:24:34 +1100	[thread overview]
Message-ID: <20110130092434.42a887ef@kryten> (raw)
In-Reply-To: <20110130092217.70ebb424@kryten>


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 <anton@samba.org>
---

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;

  reply	other threads:[~2011-01-29 22:24 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-18  1:31 2.6.37-git17 virtual IO boot failure Anton Blanchard
2011-01-18 22:47 ` Nishanth Aravamudan
2011-01-19  0:48   ` Nishanth Aravamudan
2011-01-19  6:06     ` Benjamin Herrenschmidt
2011-01-19 22:26       ` Nishanth Aravamudan
2011-01-19  4:06   ` Benjamin Herrenschmidt
2011-01-19  4:37     ` Nishanth Aravamudan
2011-01-19  4:54       ` Benjamin Herrenschmidt
2011-01-29 22:22       ` Anton Blanchard
2011-01-29 22:24         ` Anton Blanchard [this message]
2011-01-29 22:26           ` [PATCH 2/5] powerpc/numa: Check for all VPHN changes Anton Blanchard
2011-01-29 22:28           ` [PATCH 3/5] powerpc/numa: Add length when creating OF properties via VPHN Anton Blanchard
2011-01-29 22:35           ` [PATCH 4/5] powerpc/numa: Disable VPHN on dedicated processor partitions Anton Blanchard
2011-01-29 22:37           ` [PATCH 5/5] powerpc/numa: Fix bug in unmap_cpu_from_node Anton Blanchard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110130092434.42a887ef@kryten \
    --to=anton@samba.org \
    --cc=benh@kernel.crashing.org \
    --cc=jlarrew@linux.vnet.ibm.com \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=nacc@us.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).