Skip to contentSkip to conversation

3/5 in support of hot-add memory x86_64 arch_find_node x86_64

PATCH In review keith mannthey 3 participants 3 messages Jul 29, 2006 – Jul 31, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 3/5 in support of hot-add memory x86_64 arch_find_node x86_64

Hello all
This is a enablement of the generic arch_find_node for x86_64. It uses
the nodes_add date collected from the SRAT to do it's lookup.

I suspect and i386 version will be needed when I get to that arch with my work.

This was built against 2.6.18-rc2.

arch/x86_64/Kconfig +4 -0
diff -urN orig/arch/x86_64/Kconfig work/arch/x86_64/Kconfig
@@ -343,6 +343,10 @@
 	def_bool y
 	depends on MEMORY_HOTPLUG
 
+config ARCH_FIND_NODE
+	def_bool y
+	depends on MEMORY_HOTPLUG
+
 config ARCH_FLATMEM_ENABLE
 	def_bool y
 	depends on !NUMA
arch/x86_64/mm/srat.c +12 -0
diff -urN orig/arch/x86_64/mm/srat.c work/arch/x86_64/mm/srat.c
@@ -450,3 +450,15 @@
 }
 
 EXPORT_SYMBOL(__node_distance);
+
+int arch_find_node(unsigned long start, unsigned long size) 
+{
+	int i, ret = 0;
+	unsigned long end = start+size;
+	
+	for_each_node(i) {
+		if (nodes_add[i].start <= start && nodes_add[i].end >= end)
+			ret = i;
+	}
+	return ret;
+}
#1 lore raw
Quoted 9 lines

diff -urN orig/arch/x86_64/mm/srat.c work/arch/x86_64/mm/srat.c

arch/x86_64/mm/srat.c +2 -0
@@ -450,3 +450,15 @@
 }
 
 EXPORT_SYMBOL(__node_distance);
+
+int arch_find_node(unsigned long start, unsigned long size) 

arch/x86_64/mm/srat.c line 464

Quoted 10 lines
arch/x86_64/mm/srat.c +10 -0
+{
+	int i, ret = 0;
+	unsigned long end = start+size;
+	
+	for_each_node(i) {
+		if (nodes_add[i].start <= start && nodes_add[i].end >= end)
+			ret = i;
+	}
+	return ret;
+}

BTW, does anyone know why nodes_add[] becomes arch dependent code?

I know it is defined in x86-64. But I mean that SRAT is not arch dependent. It is defined by just ACPI.
However, each arch which uses ACPI has a own code to parse SRAT table. Is it hard to merge all of them? Are there any special case?

If they can be merged, this code can be written in driver/acpi/numa.c.

Bye.

Signature · 1 line
Yasunori Goto 
#2 lore raw
Quoted 5 lines

I know it is defined in x86-64. But I mean that SRAT is not arch dependent. It is defined by just ACPI.
However, each arch which uses ACPI has a own code to parse SRAT table. Is it hard to merge all of them? Are there any special case?

Node setup is architecture specific and quite different between x86-64 and ia64. I guess one could factor out some common sanity code though, but I'm not sure it is worth it. Iirc ia64 doesn't do much sanity checking because they assume the firmware was written by sane people; x86-64 doesn't have that luxury.

-Andi