[PATCH] ppc64: Add NUMA cpu summary at boot

Anton Blanchard anton at samba.org
Tue Dec 13 06:56:47 EST 2005


We used to print a NUMA cpu summary at boot before the hotplug cpu code
was added. This has been useful for catching machine configuration as
well as firmware bugs in the past.

This patch restores that functionality. An example of the output is:

Node 0 CPUs: 0-7
Node 1 CPUs: 8-15

Signed-off-by: Anton Blanchard <anton at samba.org>
---

Index: build/arch/powerpc/mm/numa.c
===================================================================
--- build.orig/arch/powerpc/mm/numa.c	2005-12-13 06:19:08.000000000 +1100
+++ build/arch/powerpc/mm/numa.c	2005-12-13 06:22:30.000000000 +1100
@@ -497,7 +497,41 @@
 	node_set_online(0);
 }
 
-static void __init dump_numa_topology(void)
+void __init dump_numa_cpu_topology(void)
+{
+	unsigned int node;
+	unsigned int cpu, count;
+
+	if (min_common_depth == -1 || !numa_enabled)
+		return;
+
+	for_each_online_node(node) {
+		printk(KERN_INFO "Node %d CPUs:", node);
+
+		count = 0;
+		/*
+		 * If we used a CPU iterator here we would miss printing
+		 * the holes in the cpumap.
+		 */
+		for (cpu = 0; cpu < NR_CPUS; cpu++) {
+			if (cpu_isset(cpu, numa_cpumask_lookup_table[node])) {
+				if (count == 0)
+					printk(" %u", cpu);
+				++count;
+			} else {
+				if (count > 1)
+					printk("-%u", cpu - 1);
+				count = 0;
+			}
+		}
+
+		if (count > 1)
+			printk("-%u", NR_CPUS - 1);
+		printk("\n");
+	}
+}
+
+static void __init dump_numa_memory_topology(void)
 {
 	unsigned int node;
 	unsigned int count;
@@ -529,7 +563,6 @@
 			printk("-0x%lx", i);
 		printk("\n");
 	}
-	return;
 }
 
 /*
@@ -591,7 +624,7 @@
 	if (parse_numa_properties())
 		setup_nonnuma();
 	else
-		dump_numa_topology();
+		dump_numa_memory_topology();
 
 	register_cpu_notifier(&ppc64_numa_nb);
 
Index: build/arch/powerpc/kernel/smp.c
===================================================================
--- build.orig/arch/powerpc/kernel/smp.c	2005-11-20 15:01:36.000000000 +1100
+++ build/arch/powerpc/kernel/smp.c	2005-12-13 06:22:51.000000000 +1100
@@ -31,6 +31,7 @@
 #include <linux/sysdev.h>
 #include <linux/cpu.h>
 #include <linux/notifier.h>
+#include <linux/topology.h>
 
 #include <asm/ptrace.h>
 #include <asm/atomic.h>
@@ -554,6 +555,8 @@
 	smp_ops->setup_cpu(boot_cpuid);
 
 	set_cpus_allowed(current, old_mask);
+
+	dump_numa_cpu_topology();
 }
 
 #ifdef CONFIG_HOTPLUG_CPU
Index: build/include/asm-powerpc/topology.h
===================================================================
--- build.orig/include/asm-powerpc/topology.h	2005-11-20 15:01:36.000000000 +1100
+++ build/include/asm-powerpc/topology.h	2005-12-13 06:22:30.000000000 +1100
@@ -55,8 +55,12 @@
 	.nr_balance_failed	= 0,			\
 }
 
+extern void __init dump_numa_cpu_topology(void);
+
 #else
 
+static inline void dump_numa_cpu_topology(void) {}
+
 #include <asm-generic/topology.h>
 
 #endif /* CONFIG_NUMA */



More information about the Linuxppc64-dev mailing list