]> git.baikalelectronics.ru Git - kernel.git/commitdiff
[PATCH] hot-add-mem x86_64: memory_add_physaddr_to_nid node fixup
authorKeith Mannthey <kmannth@us.ibm.com>
Sun, 1 Oct 2006 06:27:07 +0000 (23:27 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Sun, 1 Oct 2006 07:39:18 +0000 (00:39 -0700)
In cases where the acpi memory-add event does not containe the pxm (node)
infomation allow the driver to look up node info based on the address.  The
acpi_get_node call returns -1 if it can't decode the pxm info, this causes
add_memory to panic.  acpi_get_node would have to decode the resource from the
handle (a lenghty proposition).  This seems to be the cleanist point to
interject the hook.

[kamezawa.hiroyu@jp.fujitsu.com: build fixes]
[y-goto@jp.fujitsu.com: build fixes]
Signed-off-by: Keith Mannthey <kmannth@us.ibm.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Andi Kleen <ak@muc.de>
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Signed-off-by: Yasunori Goto <y-goto@jp.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
arch/ia64/mm/numa.c
arch/x86_64/mm/init.c
arch/x86_64/mm/srat.c
drivers/acpi/acpi_memhotplug.c

index 64e4c21f311cdc7f328165b18ae189e07476f885..7807fc5c04224fcad33d98a83d96a48a1df25423 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/node.h>
 #include <linux/init.h>
 #include <linux/bootmem.h>
+#include <linux/module.h>
 #include <asm/mmzone.h>
 #include <asm/numa.h>
 
@@ -69,4 +70,21 @@ int early_pfn_to_nid(unsigned long pfn)
 
        return 0;
 }
+
+#ifdef CONFIG_MEMORY_HOTPLUG
+/*
+ *  SRAT information is stored in node_memblk[], then we can use SRAT
+ *  information at memory-hot-add if necessary.
+ */
+
+int memory_add_physaddr_to_nid(u64 addr)
+{
+       int nid = paddr_to_nid(addr);
+       if (nid < 0)
+               return 0;
+       return nid;
+}
+
+EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid);
+#endif
 #endif
index e759109abb36d8d260e030465deebc0216d0bc19..71ecbb3f3262f21f27ab3e719d0b8e93af67d680 100644 (file)
@@ -498,6 +498,7 @@ int memory_add_physaddr_to_nid(u64 start)
 {
        return 0;
 }
+EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid);
 #endif
 
 #else /* CONFIG_MEMORY_HOTPLUG */
index 8491300ef909ac4dc79af12453950185b9c910f2..3cc0544e25f5a8569af1a727c3f819b252fe3635 100644 (file)
@@ -477,3 +477,5 @@ int memory_add_physaddr_to_nid(u64 start)
 
        return ret;
 }
+EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid);
+
index 1dda370f402b69d4d69dd433c6dcfab2e58cd5d5..98099de59b45bcfec5ee8636650c5eb29ee5fbd0 100644 (file)
@@ -238,6 +238,10 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device)
                        num_enabled++;
                        continue;
                }
+
+               if (node < 0)
+                       node = memory_add_physaddr_to_nid(info->start_addr);
+
                result = add_memory(node, info->start_addr, info->length);
                if (result)
                        continue;