Skip to contentSkip to conversation

Unify mapping from pxm to node id (take 2).

RFT/PATCH In review Yasunori Goto 3 participants 10 messages Jan 20, 2006 – Jan 29, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hello.

I modified previous patch which is to unify mapping from pxm to node id.
And I could test it on ia64 and x86-64 box with dummy SRAT emulation.
However, I couldn't make NUMA emulation environment for i386 by dummy SRAT. (It couldn't boot up due to fault of mount root dir). So, test of this patch hasn't completed. :-(

Unfortunately, I don't have any i386 NUMA machine.
So, I would like to ask to test this patch on i386 NUMA machine.

Does anyone have i386 NUMA box? If so, please test this.

Thanks.

----------------------------

This patch is to unify mapping from pxm to node id.
In current code, i386, x86-64, and ia64 have its mapping by each own code. But PXM is defined by ACPI and node id is used generically. So, I think there is no reason to define it on each arch's code. This mapping should be written at drivers/acpi/numa.c as a common code.

This patch is for 2.6.15.

arch/i386/kernel/srat.c +2 -15
Index: unify_pxm/arch/i386/kernel/srat.c
===================================================================
@@ -213,13 +213,6 @@ static __init void node_read_chunk(int n
 		node_end_pfn[nid] = memory_chunk->end_pfn;
 }
 
-static u8 pxm_to_nid_map[MAX_PXM_DOMAINS];/* _PXM to logical node ID map */
-
-int pxm_to_node(int pxm)
-{
-	return pxm_to_nid_map[pxm];
-}
-
 /* Parse the ACPI Static Resource Affinity Table */
 static int __init acpi20_parse_srat(struct acpi_table_srat *sratp)
 {
@@ -235,10 +228,6 @@ static int __init acpi20_parse_srat(stru
 	memset(node_memory_chunk, 0, sizeof(node_memory_chunk));
 	memset(zholes_size, 0, sizeof(zholes_size));
 
-	/* -1 in these maps means not available */
-	memset(pxm_to_nid_map, -1, sizeof(pxm_to_nid_map));
-	memset(nid_to_pxm_map, -1, sizeof(nid_to_pxm_map));
-
 	num_memory_chunks = 0;
 	while (p < end) {
 		switch (*p) {
@@ -278,9 +267,7 @@ static int __init acpi20_parse_srat(stru
 	nodes_clear(node_online_map);
 	for (i = 0; i < MAX_PXM_DOMAINS; i++) {
 		if (BMAP_TEST(pxm_bitmap, i)) {
-			nid = num_online_nodes();
-			pxm_to_nid_map[i] = nid;
-			nid_to_pxm_map[nid] = i;
+			int nid = acpi_map_pxm_to_node(i);
 			node_set_online(nid);
 		}
 	}
@@ -288,7 +275,7 @@ static int __init acpi20_parse_srat(stru
 
 	/* set cnode id in memory chunk structure */
 	for (i = 0; i < num_memory_chunks; i++)
-		node_memory_chunk[i].nid = pxm_to_nid_map[node_memory_chunk[i].pxm];
+		node_memory_chunk[i].nid = pxm_to_node(node_memory_chunk[i].pxm);
 
 	printk("pxm bitmap: ");
 	for (i = 0; i < sizeof(pxm_bitmap); i++) {
arch/ia64/kernel/acpi.c +9 -16
Index: unify_pxm/arch/ia64/kernel/acpi.c
===================================================================
@@ -409,9 +409,6 @@ static int __initdata srat_num_cpus;	/* 
 static u32 __devinitdata pxm_flag[PXM_FLAG_LEN];
 #define pxm_bit_set(bit)	(set_bit(bit,(void *)pxm_flag))
 #define pxm_bit_test(bit)	(test_bit(bit,(void *)pxm_flag))
-/* maps to convert between proximity domain and logical node ID */
-int __devinitdata pxm_to_nid_map[MAX_PXM_DOMAINS];
-int __initdata nid_to_pxm_map[MAX_NUMNODES];
 static struct acpi_table_slit __initdata *slit_table;
 
 /*
@@ -500,22 +497,18 @@ void __init acpi_numa_arch_fixup(void)
 	 * MCD - This can probably be dropped now.  No need for pxm ID to node ID
 	 * mapping with sparse node numbering iff MAX_PXM_DOMAINS <= MAX_NUMNODES.
 	 */
-	/* calculate total number of nodes in system from PXM bitmap */
-	memset(pxm_to_nid_map, -1, sizeof(pxm_to_nid_map));
-	memset(nid_to_pxm_map, -1, sizeof(nid_to_pxm_map));
 	nodes_clear(node_online_map);
 	for (i = 0; i < MAX_PXM_DOMAINS; i++) {
 		if (pxm_bit_test(i)) {
-			int nid = num_online_nodes();
-			pxm_to_nid_map[i] = nid;
-			nid_to_pxm_map[nid] = i;
+			int nid = acpi_map_pxm_to_node(i);
+			pxm_bit_set(i);
 			node_set_online(nid);
 		}
 	}
 
 	/* set logical node id in memory chunk structure */
 	for (i = 0; i < num_node_memblks; i++)
-		node_memblk[i].nid = pxm_to_nid_map[node_memblk[i].nid];
+		node_memblk[i].nid = pxm_to_node(node_memblk[i].nid);
 
 	/* assign memory bank numbers for each chunk on each node */
 	for_each_online_node(i) {
@@ -529,7 +522,7 @@ void __init acpi_numa_arch_fixup(void)
 
 	/* set logical node id in cpu structure */
 	for (i = 0; i < srat_num_cpus; i++)
-		node_cpuid[i].nid = pxm_to_nid_map[node_cpuid[i].nid];
+		node_cpuid[i].nid = pxm_to_node(node_cpuid[i].nid);
 
 	printk(KERN_INFO "Number of logical nodes in system = %d\n",
 	       num_online_nodes());
@@ -542,11 +535,11 @@ void __init acpi_numa_arch_fixup(void)
 	for (i = 0; i < slit_table->localities; i++) {
 		if (!pxm_bit_test(i))
 			continue;
-		node_from = pxm_to_nid_map[i];
+		node_from = pxm_to_node(i);
 		for (j = 0; j < slit_table->localities; j++) {
 			if (!pxm_bit_test(j))
 				continue;
-			node_to = pxm_to_nid_map[j];
+			node_to = pxm_to_node(j);
 			node_distance(node_from, node_to) =
 			    slit_table->entry[i * slit_table->localities + j];
 		}
@@ -752,9 +745,9 @@ int acpi_map_cpu2node(acpi_handle handle
 
 	/*
 	 * Assuming that the container driver would have set the proximity
-	 * domain and would have initialized pxm_to_nid_map[pxm_id] && pxm_flag
+	 * domain and would have initialized pxm_to_node(pxm_id) && pxm_flag
 	 */
-	node_cpuid[cpu].nid = (pxm_id < 0) ? 0 : pxm_to_nid_map[pxm_id];
+	node_cpuid[cpu].nid = (pxm_id < 0) ? 0 : pxm_to_node(pxm_id);
 
 	node_cpuid[cpu].phys_id = physid;
 #endif
@@ -880,7 +873,7 @@ acpi_map_iosapic(acpi_handle handle, u32
 	if (pxm < 0)
 		return AE_OK;
 
-	node = pxm_to_nid_map[pxm];
+	node = pxm_to_node(pxm);
 
 	if (node >= MAX_NUMNODES || !node_online(node) ||
 	    cpus_empty(node_to_cpumask(node)))
drivers/acpi/numa.c +44 -0

56 lines not on this page · raw message

arch/x86_64/mm/srat.c +1 -31
Index: unify_pxm/arch/x86_64/mm/srat.c
===================================================================
@@ -21,30 +21,11 @@
 static struct acpi_table_slit *acpi_slit;
 
 static nodemask_t nodes_parsed __initdata;
-static nodemask_t nodes_found __initdata;
 static struct node nodes[MAX_NUMNODES] __initdata;
-static __u8  pxm2node[256] = { [0 ... 255] = 0xff };
-
-static int node_to_pxm(int n);
-
-int pxm_to_node(int pxm)
-{
-	if ((unsigned)pxm >= 256)
-		return 0;
-	return pxm2node[pxm];
-}
 
 static __init int setup_node(int pxm)
 {
-	unsigned node = pxm2node[pxm];
-	if (node == 0xff) {
-		if (nodes_weight(nodes_found) >= MAX_NUMNODES)
-			return -1;
-		node = first_unset_node(nodes_found); 
-		node_set(node, nodes_found);
-		pxm2node[pxm] = node;
-	}
-	return pxm2node[pxm];
+	return acpi_map_pxm_to_node(pxm);
 }
 
 static __init int conflicting_nodes(unsigned long start, unsigned long end)
@@ -205,17 +186,6 @@ int __init acpi_scan_nodes(unsigned long
 	return 0;
 }
 
-static int node_to_pxm(int n)
-{
-       int i;
-       if (pxm2node[n] == n)
-               return n;
-       for (i = 0; i < 256; i++)
-               if (pxm2node[i] == n)
-                       return i;
-       return 0;
-}
-
 int __node_distance(int a, int b)
 {
 	int index;
include/asm-x86_64/numa.h +0 -1
Index: unify_pxm/include/asm-x86_64/numa.h
===================================================================
@@ -9,7 +9,6 @@ struct node { 
 };
 
 extern int compute_hash_shift(struct node *nodes, int numnodes);
-extern int pxm_to_node(int nid);
 
 #define ZONE_ALIGN (1UL << (MAX_ORDER+PAGE_SHIFT))
 
include/acpi/acpi_numa.h new file +18 -0
Index: unify_pxm/include/acpi/acpi_numa.h
===================================================================
@@ -0,0 +1,18 @@
+#ifndef __ACPI_NUMA_H
+#define __ACPI_NUMA_H
+
+#ifdef CONFIG_ACPI_NUMA
+#include <linux/kernel.h>
+
+/* Proximity bitmap length; _PXM is at most 255 (8 bit)*/
+#define MAX_PXM_DOMAINS (256)
+extern u8 __cpuinitdata pxm_to_node_map[MAX_PXM_DOMAINS];
+extern u8 __cpuinitdata node_to_pxm_map[MAX_NUMNODES];
+
+extern int __cpuinit pxm_to_node(u8);
+extern u8 __cpuinit node_to_pxm(int);
+extern int __cpuinit acpi_map_pxm_to_node(u8);
+extern void __cpuinit acpi_unmap_pxm_to_node(int);
+
+#endif				/* CONFIG_ACPI_NUMA */
+#endif				/* __ACP_NUMA_H */
arch/ia64/pci/pci.c +1 -1
Index: unify_pxm/arch/ia64/pci/pci.c
===================================================================
@@ -353,7 +353,7 @@ pci_acpi_scan_root(struct acpi_device *d
 	pxm = acpi_get_pxm(controller->acpi_handle);
 #ifdef CONFIG_NUMA
 	if (pxm >= 0)
-		controller->node = pxm_to_nid_map[pxm];
+		controller->node = pxm_to_node(pxm);
 #endif
 
 	acpi_walk_resources(device->handle, METHOD_NAME__CRS, count_window,
include/linux/acpi.h +1 -0
Index: unify_pxm/include/linux/acpi.h
===================================================================
@@ -38,6 +38,7 @@
 #include <acpi/acpi.h>
 #include <acpi/acpi_bus.h>
 #include <acpi/acpi_drivers.h>
+#include <acpi/acpi_numa.h>
 #include <asm/acpi.h>
 
 
Signature · 1 line
Yasunori Goto 
#1 lore raw

Hello.

Previous patch was for 2.6.15. But, pxm_to_node() of x86_64 is already changed in 2.6.16-rc1.
So, I rewrote my patch for 2.6.16-rc1.

I have not been able to boot up with i386 NUMA emulation. If anyone has i386 NUMA box, please test this.

Thanks.

----------------------------

This patch is to unify mapping from pxm to node id.
In current code, i386, x86-64, and ia64 have its mapping by each own code. But PXM is defined by ACPI and node id is used generically. So, I think there is no reason to define it on each arch's code. This mapping should be written at drivers/acpi/numa.c as a common code.

This patch is for 2.6.15.

arch/i386/kernel/srat.c +2 -15
Index: unify_pxm/arch/i386/kernel/srat.c
===================================================================
@@ -213,13 +213,6 @@ static __init void node_read_chunk(int n
 		node_end_pfn[nid] = memory_chunk->end_pfn;
 }
 
-static u8 pxm_to_nid_map[MAX_PXM_DOMAINS];/* _PXM to logical node ID map */
-
-int pxm_to_node(int pxm)
-{
-	return pxm_to_nid_map[pxm];
-}
-
 /* Parse the ACPI Static Resource Affinity Table */
 static int __init acpi20_parse_srat(struct acpi_table_srat *sratp)
 {
@@ -235,10 +228,6 @@ static int __init acpi20_parse_srat(stru
 	memset(node_memory_chunk, 0, sizeof(node_memory_chunk));
 	memset(zholes_size, 0, sizeof(zholes_size));
 
-	/* -1 in these maps means not available */
-	memset(pxm_to_nid_map, -1, sizeof(pxm_to_nid_map));
-	memset(nid_to_pxm_map, -1, sizeof(nid_to_pxm_map));
-
 	num_memory_chunks = 0;
 	while (p < end) {
 		switch (*p) {
@@ -278,9 +267,7 @@ static int __init acpi20_parse_srat(stru
 	nodes_clear(node_online_map);
 	for (i = 0; i < MAX_PXM_DOMAINS; i++) {
 		if (BMAP_TEST(pxm_bitmap, i)) {
-			nid = num_online_nodes();
-			pxm_to_nid_map[i] = nid;
-			nid_to_pxm_map[nid] = i;
+			int nid = acpi_map_pxm_to_node(i);
 			node_set_online(nid);
 		}
 	}
@@ -288,7 +275,7 @@ static int __init acpi20_parse_srat(stru
 
 	/* set cnode id in memory chunk structure */
 	for (i = 0; i < num_memory_chunks; i++)
-		node_memory_chunk[i].nid = pxm_to_nid_map[node_memory_chunk[i].pxm];
+		node_memory_chunk[i].nid = pxm_to_node(node_memory_chunk[i].pxm);
 
 	printk("pxm bitmap: ");
 	for (i = 0; i < sizeof(pxm_bitmap); i++) {
arch/ia64/kernel/acpi.c +9 -16
Index: unify_pxm/arch/ia64/kernel/acpi.c
===================================================================
@@ -409,9 +409,6 @@ static int __initdata srat_num_cpus;	/* 
 static u32 __devinitdata pxm_flag[PXM_FLAG_LEN];
 #define pxm_bit_set(bit)	(set_bit(bit,(void *)pxm_flag))
 #define pxm_bit_test(bit)	(test_bit(bit,(void *)pxm_flag))
-/* maps to convert between proximity domain and logical node ID */
-int __devinitdata pxm_to_nid_map[MAX_PXM_DOMAINS];
-int __initdata nid_to_pxm_map[MAX_NUMNODES];
 static struct acpi_table_slit __initdata *slit_table;
 
 /*
@@ -500,22 +497,18 @@ void __init acpi_numa_arch_fixup(void)
 	 * MCD - This can probably be dropped now.  No need for pxm ID to node ID
 	 * mapping with sparse node numbering iff MAX_PXM_DOMAINS <= MAX_NUMNODES.
 	 */
-	/* calculate total number of nodes in system from PXM bitmap */
-	memset(pxm_to_nid_map, -1, sizeof(pxm_to_nid_map));
-	memset(nid_to_pxm_map, -1, sizeof(nid_to_pxm_map));
 	nodes_clear(node_online_map);
 	for (i = 0; i < MAX_PXM_DOMAINS; i++) {
 		if (pxm_bit_test(i)) {
-			int nid = num_online_nodes();
-			pxm_to_nid_map[i] = nid;
-			nid_to_pxm_map[nid] = i;
+			int nid = acpi_map_pxm_to_node(i);
+			pxm_bit_set(i);
 			node_set_online(nid);
 		}
 	}
 
 	/* set logical node id in memory chunk structure */
 	for (i = 0; i < num_node_memblks; i++)
-		node_memblk[i].nid = pxm_to_nid_map[node_memblk[i].nid];
+		node_memblk[i].nid = pxm_to_node(node_memblk[i].nid);
 
 	/* assign memory bank numbers for each chunk on each node */
 	for_each_online_node(i) {
@@ -529,7 +522,7 @@ void __init acpi_numa_arch_fixup(void)
 
 	/* set logical node id in cpu structure */
 	for (i = 0; i < srat_num_cpus; i++)
-		node_cpuid[i].nid = pxm_to_nid_map[node_cpuid[i].nid];
+		node_cpuid[i].nid = pxm_to_node(node_cpuid[i].nid);
 
 	printk(KERN_INFO "Number of logical nodes in system = %d\n",
 	       num_online_nodes());
@@ -542,11 +535,11 @@ void __init acpi_numa_arch_fixup(void)
 	for (i = 0; i < slit_table->localities; i++) {
 		if (!pxm_bit_test(i))
 			continue;
-		node_from = pxm_to_nid_map[i];
+		node_from = pxm_to_node(i);
 		for (j = 0; j < slit_table->localities; j++) {
 			if (!pxm_bit_test(j))
 				continue;
-			node_to = pxm_to_nid_map[j];
+			node_to = pxm_to_node(j);
 			node_distance(node_from, node_to) =
 			    slit_table->entry[i * slit_table->localities + j];
 		}
@@ -752,9 +745,9 @@ int acpi_map_cpu2node(acpi_handle handle
 
 	/*
 	 * Assuming that the container driver would have set the proximity
-	 * domain and would have initialized pxm_to_nid_map[pxm_id] && pxm_flag
+	 * domain and would have initialized pxm_to_node(pxm_id) && pxm_flag
 	 */
-	node_cpuid[cpu].nid = (pxm_id < 0) ? 0 : pxm_to_nid_map[pxm_id];
+	node_cpuid[cpu].nid = (pxm_id < 0) ? 0 : pxm_to_node(pxm_id);
 
 	node_cpuid[cpu].phys_id = physid;
 #endif
@@ -880,7 +873,7 @@ acpi_map_iosapic(acpi_handle handle, u32
 	if (pxm < 0)
 		return AE_OK;
 
-	node = pxm_to_nid_map[pxm];
+	node = pxm_to_node(pxm);
 
 	if (node >= MAX_NUMNODES || !node_online(node) ||
 	    cpus_empty(node_to_cpumask(node)))
drivers/acpi/numa.c +50 -0

62 lines not on this page · raw message

arch/x86_64/mm/srat.c +1 -32
Index: unify_pxm/arch/x86_64/mm/srat.c
===================================================================
@@ -22,31 +22,11 @@
 static struct acpi_table_slit *acpi_slit;
 
 static nodemask_t nodes_parsed __initdata;
-static nodemask_t nodes_found __initdata;
 static struct node nodes[MAX_NUMNODES] __initdata;
-static u8 pxm2node[256] = { [0 ... 255] = 0xff };
-
-static int node_to_pxm(int n);
-
-int pxm_to_node(int pxm)
-{
-	if ((unsigned)pxm >= 256)
-		return -1;
-	/* Extend 0xff to (int)-1 */
-	return (signed char)pxm2node[pxm];
-}
 
 static __init int setup_node(int pxm)
 {
-	unsigned node = pxm2node[pxm];
-	if (node == 0xff) {
-		if (nodes_weight(nodes_found) >= MAX_NUMNODES)
-			return -1;
-		node = first_unset_node(nodes_found); 
-		node_set(node, nodes_found);
-		pxm2node[pxm] = node;
-	}
-	return pxm2node[pxm];
+	acpi_map_pxm_to_node(pxm);
 }
 
 static __init int conflicting_nodes(unsigned long start, unsigned long end)
@@ -266,17 +246,6 @@ int __init acpi_scan_nodes(unsigned long
 	return 0;
 }
 
-static int node_to_pxm(int n)
-{
-       int i;
-       if (pxm2node[n] == n)
-               return n;
-       for (i = 0; i < 256; i++)
-               if (pxm2node[i] == n)
-                       return i;
-       return 0;
-}
-
 int __node_distance(int a, int b)
 {
 	int index;
include/asm-x86_64/numa.h +0 -1
Index: unify_pxm/include/asm-x86_64/numa.h
===================================================================
@@ -9,7 +9,6 @@ struct node { 
 };
 
 extern int compute_hash_shift(struct node *nodes, int numnodes);
-extern int pxm_to_node(int nid);
 
 #define ZONE_ALIGN (1UL << (MAX_ORDER+PAGE_SHIFT))
 
include/acpi/acpi_numa.h new file +18 -0
Index: unify_pxm/include/acpi/acpi_numa.h
===================================================================
@@ -0,0 +1,18 @@
+#ifndef __ACPI_NUMA_H
+#define __ACPI_NUMA_H
+
+#ifdef CONFIG_ACPI_NUMA
+#include <linux/kernel.h>
+
+/* Proximity bitmap length; _PXM is at most 255 (8 bit)*/
+#define MAX_PXM_DOMAINS (256)
+extern u8 __cpuinitdata pxm_to_node_map[MAX_PXM_DOMAINS];
+extern u8 __cpuinitdata node_to_pxm_map[MAX_NUMNODES];
+
+extern int __cpuinit pxm_to_node(int);
+extern int __cpuinit node_to_pxm(int);
+extern int __cpuinit acpi_map_pxm_to_node(u8);
+extern void __cpuinit acpi_unmap_pxm_to_node(int);
+
+#endif				/* CONFIG_ACPI_NUMA */
+#endif				/* __ACP_NUMA_H */
arch/ia64/pci/pci.c +1 -1
Index: unify_pxm/arch/ia64/pci/pci.c
===================================================================
@@ -353,7 +353,7 @@ pci_acpi_scan_root(struct acpi_device *d
 	pxm = acpi_get_pxm(controller->acpi_handle);
 #ifdef CONFIG_NUMA
 	if (pxm >= 0)
-		controller->node = pxm_to_nid_map[pxm];
+		controller->node = pxm_to_node(pxm);
 #endif
 
 	acpi_walk_resources(device->handle, METHOD_NAME__CRS, count_window,
include/linux/acpi.h +1 -0
Index: unify_pxm/include/linux/acpi.h
===================================================================
@@ -38,6 +38,7 @@
 #include <acpi/acpi.h>
 #include <acpi/acpi_bus.h>
 #include <acpi/acpi_drivers.h>
+#include <acpi/acpi_numa.h>
 #include <asm/acpi.h>
 
 
Signature · 1 line
Yasunori Goto 
#2 lore raw

This patch doesn't work for arch/ia64/sn (probably not for ia64/hp either).

The final link fails:
---------------------
arch/ia64/sn/built-in.o(.init.text+0x1c90): In function `sn_setup':
arch/ia64/sn/kernel/setup.c:151: undefined reference to nid_to_pxm_map' arch/ia64/sn/built-in.o(.init.text+0x1c91):arch/ia64/sn/kernel/setup.c:155: undefined reference to pxm_to_nid_map' arch/ia64/sn/built-in.o(.init.text+0x1ca0):arch/ia64/sn/kernel/setup.c:151: undefined reference to nid_to_pxm_map' arch/ia64/sn/built-in.o(.init.text+0x1cb0):arch/ia64/sn/kernel/setup.c:155: undefined reference to pxm_to_nid_map'

It looks like you removed the definitions of pxm_to_nid_map and nid_to_pxm_map, but did not remove all the uses. I recommend when removing global kernel symbols that one grep all the kernel files for other uses.

A grep of the kernel (in Andrew's 2.6.16-rc1-mm3 quilt stack, just after this patch and its first fix are applied) shows:

$ grep -rEIw pxm_to_nid_map\|nid_to_pxm_map * | grep -vE patches\|System.map
arch/i386/kernel/srat.c:        u8 nid_to_pxm_map[MAX_NUMNODES];/* logical node ID to _PXM map */
arch/ia64/hp/common/sba_iommu.c:        node = pxm_to_nid_map[pxm];
arch/ia64/sn/kernel/setup.c:    nid = pxm_to_nid_map[pxm];
arch/ia64/sn/kernel/setup.c:            nasid = pxm_to_nasid(nid_to_pxm_map[node]);
include/asm-ia64/acpi.h:extern int __devinitdata pxm_to_nid_map[MAX_PXM_DOMAINS];
include/asm-ia64/acpi.h:extern int __initdata nid_to_pxm_map[MAX_NUMNODES];
Quoted 1 line

From the above, I presume that arch/ia64/hp is broken, along with

arch/ia64/sn. And it looks like the nid_to_pxm_map[] in srat.c is a waste of stack space, and the two remaining externs in asm-ia64/acpi.h should be removed.

Signature · 3 lines
                  I won't rest till it's the best ...
                  Programmer, Linux Scalability
                  Paul Jackson <[email protected]> 1.925.600.0401
#3 lore raw

PATCH 1/3 Fix unify mapping from pxm to node id.

I'm sorry for my lazy work.
There were some compile errors for i386 and ia64. Not only Paul-san, Bob-san and Andy-san also sent me result of complile or patches. (Thanks a lot!)
To tell all of here and summarize what was wrong,
I'll repost all patches to solve them. These are for 2.6.16-rc1-mm3.

Andrew-san. Please apply.

----------------

This is for fix unification from pxm to node id against i386. acpi_numa_processor_affinity_init() and other 3 function was defined for x86-64 and ia64. But i386 doesn't use them.
This is just dummy function for compile.
And some of garbages are removed.

Index: new_pxm/arch/i386/Kconfig =================================--- new_pxm.orig/arch/i386/Kconfig +++ new_pxm/arch/i386/Kconfig
@@ -141,6 +141,11 @@ config ACPI_SRAT
depends on NUMA && (X86_SUMMIT || X86_GENERICARCH) select ACPI_NUMA

+config HAVE_ARCH_PARSE_SRAT

+       bool
+       default y
+       depends on ACPI_SRAT

+
config X86_SUMMIT_NUMA
bool
default y
Index: new_pxm/include/linux/acpi.h =================================--- new_pxm.orig/include/linux/acpi.h +++ new_pxm/include/linux/acpi.h
@@ -409,10 +409,18 @@ void acpi_table_print_madt_entry (acpi_t
void acpi_table_print_srat_entry (acpi_table_entry_header *srat);

/* the following four functions are architecture-dependent */
+#ifdef CONFIG_HAVE_ARCH_PARSE_SRAT
+#define NR_NODE_MEMBLKS MAX_NUMNODES
+#define acpi_numa_slit_init(slit) do {} while (0)
+#define acpi_numa_processor_affinity_init(pa) do {} while (0) +#define acpi_numa_memory_affinity_init(ma) do {} while (0)
+#define acpi_numa_arch_fixup() do {} while (0)
+#else
void acpi_numa_slit_init (struct acpi_table_slit *slit);
void acpi_numa_processor_affinity_init (struct acpi_table_processor_affinity *pa); void acpi_numa_memory_affinity_init (struct acpi_table_memory_affinity *ma); void acpi_numa_arch_fixup(void);
+#endif

#ifdef CONFIG_ACPI_HOTPLUG_CPU
/* Arch dependent functions for cpu hotplug support */
Index: new_pxm/arch/i386/kernel/srat.c =================================--- new_pxm.orig/arch/i386/kernel/srat.c +++ new_pxm/arch/i386/kernel/srat.c
@@ -39,7 +39,6 @@
#define NODE_ARRAY_OFFSET(x) ((x) % 8) /* 8 bits/char */
#define BMAP_SET(bmap, bit) ((bmap)[NODE_ARRAY_INDEX(bit)] |= 1 << NODE_ARRAY_OFFSET(bit))
#define BMAP_TEST(bmap, bit) ((bmap)[NODE_ARRAY_INDEX(bit)] & (1 << NODE_ARRAY_OFFSET(bit)))
-#define MAX_PXM_DOMAINS 256 /* 1 byte and no promises about values */
/* bitmap length; _PXM is at most 255 */
#define PXM_BITMAP_LEN (MAX_PXM_DOMAINS / 8)
static u8 pxm_bitmap[PXM_BITMAP_LEN]; /* bitmap of proximity domains */
@@ -218,7 +217,6 @@ static int __init acpi20_parse_srat(stru
{
u8 *start, *end, *p;
int i, j, nid;
- u8 nid_to_pxm_map[MAX_NUMNODES];/* logical node ID to _PXM map */

start = (u8 *)(&(sratp->reserved) + 1); /* skip header */
p = start;

Signature · 1 line
Yasunori Goto 
#4 lore raw

Re: [PATCH 001/003]Fix unify mapping from pxm to node id.

Yasunori-san,

Thank-you for updating your patch.

However I am still puzzled by one detail.

Your latest patchset removes the defines:
-#define MAX_PXM_DOMAINS 256 /* 1 byte and no promises about values */

and:
-#define MAX_PXM_DOMAINS (256)

but continues to have code using MAX_PXM_DOMAINS. I am unable to compile ia64 with it now, for lack of this define.

Signature · 3 lines
                  I won't rest till it's the best ...
                  Programmer, Linux Scalability
                  Paul Jackson <[email protected]> 1.925.600.0401
#5 lore raw

Re: [PATCH 001/003]Fix unify mapping from pxm to node id.

Paul Jackson wrote: [Sat Jan 28 2006, 02:15:17AM EST]

Quoted 6 lines

Yasunori-san,

Thank-you for updating your patch.

However I am still puzzled by one detail.

Quoted 13 lines

Your latest patchset removes the defines:
-#define MAX_PXM_DOMAINS 256 /* 1 byte and no promises about values */

and:
-#define MAX_PXM_DOMAINS (256)

but continues to have code using MAX_PXM_DOMAINS. I am unable to compile ia64 with it now, for lack of this define.

Signature · 3 lines
                  I won't rest till it's the best ...
                  Programmer, Linux Scalability
                  Paul Jackson <[email protected]> 1.925.600.0401

Hi Paul.

MAX_PXM_DOMAINS is defined in include/acpi/acpi_numa.h. So I'm confused.

I just built sn2 with Yasunori's patches applied to -mm3. I had previously built sn2 with a slightly different patch series of mine which Yasunori later incorporated most of into this patch series. Would you please send your .config and the error output from the build?

thanks,

bob

#6 lore raw

Re: [PATCH 001/003]Fix unify mapping from pxm to node id.

Quoted 1 line · Bob

MAX_PXM_DOMAINS is defined in include/acpi/acpi_numa.h. So I'm confused.

Ah - there it is. My mistake.

I did not realize that the list set of 3 patches was in addition to, rather than replacing the previous patches.

I am retesting my build now -- I should be able to report success in a few hours.

Signature · 3 lines
                  I won't rest till it's the best ...
                  Programmer, Linux Scalability
                  Paul Jackson <[email protected]> 1.925.600.0401
Acked-by
#7 lore raw

Re: [PATCH 001/003]Fix unify mapping from pxm to node id.

In reply to Bob Picco

Now that I applied the patches correctly:
x86-x86_64-ia64-unify-mapping-from-pxm-to-node-id.patch x86-x86_64-ia64-unify-mapping-from-pxm-to-node-id-fix.patch [PATCH 001/003]Fix unify mapping from pxm to node id. [PATCH 002/003]Fix unify mapping from pxm to node id. [PATCH 003/003]Fix unify mapping from pxm to node id.

They compiled on a 2.6.16-rc1-mm3 source base, for archs:
alpha arm i386 ia64 sparc x86_64

and they compiled and booted ok on SN2 (ia64 sn2_defconfig).

I just noticed as I typed the above that the last 3 patches all had the same Subject "Fix unify mapping from pxm to node id." Each patch should have a different Subject (after the [...] is stripped.)

Other than that detail ... looks good.

Signature · 3 lines
                  I won't rest till it's the best ...
                  Programmer, Linux Scalability
                  Paul Jackson <[email protected]> 1.925.600.0401
#8 lore raw

PATCH 2/3 Fix unify mapping from pxm to node id.

In reply to Paul Jackson

Enable ACPI_NUMA for x86 machines with SRAT's.

 arch/i386/Kconfig    |    1 +
 drivers/acpi/Kconfig |    2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
arch/i386/Kconfig +1 -0
diff -upN reference/arch/i386/Kconfig current/arch/i386/Kconfig
@@ -139,6 +139,7 @@ config ACPI_SRAT
 	bool
 	default y
 	depends on NUMA && (X86_SUMMIT || X86_GENERICARCH)
+	select ACPI_NUMA
 
 config X86_SUMMIT_NUMA
 	bool
drivers/acpi/Kconfig +1 -1
diff -upN reference/drivers/acpi/Kconfig current/drivers/acpi/Kconfig
@@ -162,7 +162,7 @@ config ACPI_THERMAL
 config ACPI_NUMA
 	bool "NUMA support"
 	depends on NUMA
-	depends on (IA64 || X86_64)
+	depends on (X86_32 || IA64 || X86_64)
 	default y if IA64_GENERIC || IA64_SGI_SN2
 
 config ACPI_ASUS
Signature · 1 line
Yasunori Goto 
#9 lore raw

PATCH 3/3 Fix unify mapping from pxm to node id.

In reply to Paul Jackson

This is to fix/remove old pxm_to_nid_map[] for ia64(hp and SN).

Index: fix_pxm/include/asm-ia64/acpi.h
=================================--- fix_pxm.orig/include/asm-ia64/acpi.h 2006-01-28 10:45:46.000000000 +0900
+++ fix_pxm/include/asm-ia64/acpi.h 2006-01-28 11:45:04.000000000 +0900
@@ -107,13 +107,6 @@ extern unsigned int is_cpu_cpei_target(u
extern void set_cpei_target_cpu(unsigned int cpu); extern unsigned int get_cpei_target_cpu(void);

-#ifdef CONFIG_ACPI_NUMA
-/* Proximity bitmap length; _PXM is at most 255 (8 bit)*/ -#define MAX_PXM_DOMAINS (256)
-extern int __devinitdata pxm_to_nid_map[MAX_PXM_DOMAINS]; -extern int __initdata nid_to_pxm_map[MAX_NUMNODES]; -#endif
-
extern u16 ia64_acpiid_to_sapicid[];

/*
Index: fix_pxm/arch/ia64/hp/common/sba_iommu.c
=================================--- fix_pxm.orig/arch/ia64/hp/common/sba_iommu.c 2006-01-28 10:45:46.000000000 +0900
+++ fix_pxm/arch/ia64/hp/common/sba_iommu.c 2006-01-28 10:58:18.000000000 +0900
@@ -1958,7 +1958,7 @@ sba_map_ioc_to_node(struct ioc *ioc, acp
if (pxm < 0)
return;

- node = pxm_to_nid_map[pxm];
+ node = pxm_to_node(pxm);

if (node >= MAX_NUMNODES || !node_online(node))
return;
Index: fix_pxm/arch/ia64/sn/kernel/setup.c
=================================--- fix_pxm.orig/arch/ia64/sn/kernel/setup.c 2006-01-28 10:49:30.000000000 +0900
+++ fix_pxm/arch/ia64/sn/kernel/setup.c 2006-01-28 10:58:18.000000000 +0900
@@ -152,7 +152,7 @@ static int __init pxm_to_nasid(int pxm)
int i;
int nid;

- nid = pxm_to_nid_map[pxm];
+ nid = pxm_to_node(pxm);
for (i = 0; i < num_node_memblks; i++) {
if (node_memblk[i].nid = nid) {
return NASID_GET(node_memblk[i].start_paddr);
@@ -696,7 +696,7 @@ void __init build_cnode_tables(void)
* cnode = node for all C & M bricks.
*/
for_each_online_node(node) {
- nasid = pxm_to_nasid(nid_to_pxm_map[node]);
+ nasid = pxm_to_nasid(node_to_pxm(node));
sn_cnodeid_to_nasid[node] = nasid; physical_node_map[nasid] = node;
}