Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8c2676a5 authored by Keith Mannthey's avatar Keith Mannthey Committed by Linus Torvalds
Browse files

[PATCH] hot-add-mem x86_64: memory_add_physaddr_to_nid node fixup



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: default avatarKeith Mannthey <kmannth@us.ibm.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Andi Kleen <ak@muc.de>
Signed-off-by: default avatarKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Signed-off-by: default avatarYasunori Goto <y-goto@jp.fujitsu.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 4942e998
Loading
Loading
Loading
Loading
+18 −0
Original line number Original line Diff line number Diff line
@@ -16,6 +16,7 @@
#include <linux/node.h>
#include <linux/node.h>
#include <linux/init.h>
#include <linux/init.h>
#include <linux/bootmem.h>
#include <linux/bootmem.h>
#include <linux/module.h>
#include <asm/mmzone.h>
#include <asm/mmzone.h>
#include <asm/numa.h>
#include <asm/numa.h>


@@ -69,4 +70,21 @@ int early_pfn_to_nid(unsigned long pfn)


	return 0;
	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
#endif
+1 −0
Original line number Original line Diff line number Diff line
@@ -498,6 +498,7 @@ int memory_add_physaddr_to_nid(u64 start)
{
{
	return 0;
	return 0;
}
}
EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid);
#endif
#endif


#else /* CONFIG_MEMORY_HOTPLUG */
#else /* CONFIG_MEMORY_HOTPLUG */
+2 −0
Original line number Original line Diff line number Diff line
@@ -477,3 +477,5 @@ int memory_add_physaddr_to_nid(u64 start)


	return ret;
	return ret;
}
}
EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid);
+4 −0
Original line number Original line Diff line number Diff line
@@ -238,6 +238,10 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device)
			num_enabled++;
			num_enabled++;
			continue;
			continue;
		}
		}

		if (node < 0)
			node = memory_add_physaddr_to_nid(info->start_addr);

		result = add_memory(node, info->start_addr, info->length);
		result = add_memory(node, info->start_addr, info->length);
		if (result)
		if (result)
			continue;
			continue;