public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ia64: default the NUMA node distance when there is no ACPI SLIT
@ 2007-08-15 14:50 Andy Whitcroft
  2007-08-15 16:34 ` Luck, Tony
  0 siblings, 1 reply; 2+ messages in thread
From: Andy Whitcroft @ 2007-08-15 14:50 UTC (permalink / raw)
  To: Tony Luck; +Cc: Andy Whitcroft, linux-ia64, linux-kernel


If during boot no ACPI 2.0 SLIT table is found we do not initialise
the NUMA node distance table, leaving all node distances as 0.
This causes IA-64 to fail the regression tests for libnuma.  Also,
when we have a bad formatted table we will set all node distances
to 10.  Both of these forms lose all NUMA information by indicating
all nodes are as close as the "local node", and are inconsistant
in their values.

When an architecture does not offer NUMA topology support the default
node_distance is a distance of LOCAL_DISTANCE (10) to the local node
and REMOTE_DISTANCE (20) to all others.  It seems more correct to
follow this model when the SLIT information is missing or corrupt.

This patch updates the SLIT failure paths to fill in the NUMA node
distance table with this default.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
---
 arch/ia64/kernel/acpi.c |   62 ++++++++++++++++++++++++++++++++++------------
 1 files changed, 46 insertions(+), 16 deletions(-)
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
index 3d45d24..3cd3e5b 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -445,7 +445,6 @@ void __init acpi_numa_slit_init(struct acpi_table_slit *slit)
 		printk(KERN_ERR
 		       "ACPI 2.0 SLIT: size mismatch: %d expected, %d actual\n",
 		       len, slit->header.length);
-		memset(numa_slit, 10, sizeof(numa_slit));
 		return;
 	}
 	slit_table = slit;
@@ -507,9 +506,50 @@ acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma)
 	num_node_memblks++;
 }
 
+void __init acpi_numa_distance_from_slit(void)
+{
+	int i, j;
+	int node_from;
+	int node_to;
+	int nodes = slit_table->locality_count;
+
+	printk(KERN_INFO "Building NUMA distance from ACPI 2.0 SLIT\n");
+
+	for (i = 0; i < nodes; i++) {
+		if (!pxm_bit_test(i))
+			continue;
+		node_from = pxm_to_node(i);
+		for (j = 0; j < nodes; j++) {
+			if (!pxm_bit_test(j))
+				continue;
+			node_to = pxm_to_node(j);
+			node_distance(node_from, node_to) +					  slit_table->entry[i * nodes + j];
+		}
+	}
+}
+
+void __init acpi_numa_distance_default(void)
+{
+	int i, j;
+	int node_from;
+	int node_to;
+
+	printk(KERN_INFO "No SLIT table, defaulting NUMA distance\n");
+
+	for_each_online_node(i) {
+		node_from = pxm_to_node(i);
+		for_each_online_node(j) {
+			node_to = pxm_to_node(j);
+			node_distance(node_from, node_to) = (i = j)?
+				LOCAL_DISTANCE : REMOTE_DISTANCE;
+		}
+	}
+}
+
 void __init acpi_numa_arch_fixup(void)
 {
-	int i, j, node_from, node_to;
+	int i, j;
 
 	/* If there's no SRAT, fix the phys_id and mark node 0 online */
 	if (srat_num_cpus = 0) {
@@ -553,21 +593,11 @@ void __init acpi_numa_arch_fixup(void)
 	printk(KERN_INFO "Number of memory chunks in system = %d\n",
 	       num_node_memblks);
 
-	if (!slit_table)
-		return;
 	memset(numa_slit, -1, sizeof(numa_slit));
-	for (i = 0; i < slit_table->locality_count; i++) {
-		if (!pxm_bit_test(i))
-			continue;
-		node_from = pxm_to_node(i);
-		for (j = 0; j < slit_table->locality_count; j++) {
-			if (!pxm_bit_test(j))
-				continue;
-			node_to = pxm_to_node(j);
-			node_distance(node_from, node_to) -			    slit_table->entry[i * slit_table->locality_count + j];
-		}
-	}
+	if (slit_table)
+		acpi_numa_distance_from_slit();
+	else
+		acpi_numa_distance_default();
 
 #ifdef SLIT_DEBUG
 	printk("ACPI 2.0 SLIT locality table:\n");

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-08-15 16:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-15 14:50 [PATCH] ia64: default the NUMA node distance when there is no ACPI SLIT Andy Whitcroft
2007-08-15 16:34 ` Luck, Tony

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox