[v2,2/8] NUMA Hotplug emulator

Previous thread: [v2,1/8] NUMA Hotplug emulator by Shaohui Zheng on Friday, November 12, 2010 - 11:14 pm. (2 messages)

Next thread: [v2,3/8] NUMA Hotplug emulator by Shaohui Zheng on Friday, November 12, 2010 - 11:15 pm. (2 messages)
From: Shaohui Zheng
Date: Friday, November 12, 2010 - 11:14 pm

From: Haicheng Li <haicheng.li@linux.intel.com>
Subject: hotplug emulator: infrastructure of NUMA hotplug emulation

NUMA hotplug emulator introduces a new node state N_HIDDEN to
identify the fake offlined node. It firstly hides RAM via E820
table and then emulates fake offlined nodes with the hidden RAM.

After system bootup, user is able to hotplug-add these offlined
nodes, which is just similar to a real hardware hotplug behavior.

Using boot option "numa=hide=N*size" to fake offlined nodes:
	- N is the number of hidden nodes
	- size is the memory size (in MB) per hidden node.

OPEN: Kernel might use part of hidden memory region as RAM buffer,
      now emulator directly hide 128M extra space to workaround
      this issue.  Any better way to avoid this conflict?

Signed-off-by: Haicheng Li <haicheng.li@linux.intel.com>
Signed-off-by: Shaohui Zheng <shaohui.zheng@intel.com>
---
diff --git a/arch/x86/include/asm/numa_64.h b/arch/x86/include/asm/numa_64.h
index 823e070..0bb8b37 100644
--- a/arch/x86/include/asm/numa_64.h
+++ b/arch/x86/include/asm/numa_64.h
@@ -37,7 +37,7 @@ extern void __cpuinit numa_clear_node(int cpu);
 extern void __cpuinit numa_add_cpu(int cpu);
 extern void __cpuinit numa_remove_cpu(int cpu);
 
-#ifdef CONFIG_NUMA_EMU
+#if defined(CONFIG_NUMA_EMU) || defined(CONFIG_NODE_HOTPLUG_EMU)
 #define FAKE_NODE_MIN_SIZE	((u64)64 << 20)
 #define FAKE_NODE_MIN_HASH_MASK	(~(FAKE_NODE_MIN_SIZE - 1UL))
 #endif /* CONFIG_NUMA_EMU */
diff --git a/arch/x86/mm/numa_64.c b/arch/x86/mm/numa_64.c
index a7bcc23..a985cb0 100644
--- a/arch/x86/mm/numa_64.c
+++ b/arch/x86/mm/numa_64.c
@@ -304,6 +304,123 @@ void __init numa_init_array(void)
 	}
 }
 
+#ifdef CONFIG_NODE_HOTPLUG_EMU
+static char *hp_cmdline __initdata;
+static struct bootnode *hidden_nodes;
+static u64 hp_start;
+static long hidden_num, hp_size;
+static u64 nodes_size[MAX_NUMNODES] __initdata;
+
+int hotadd_hidden_nodes(int nid)
+{
+	int ret;
+
+	if (!node_hidden(nid))
+		return ...
From: Paul Mundt
Date: Sunday, November 14, 2010 - 11:41 pm

None of these really need to be under ifdef. Secondly, the description
you have provided is pretty ambiguous in comparison to N_POSSIBLE. Is
there some reason you can't just use N_POSSIBLE for this instead?
--

Previous thread: [v2,1/8] NUMA Hotplug emulator by Shaohui Zheng on Friday, November 12, 2010 - 11:14 pm. (2 messages)

Next thread: [v2,3/8] NUMA Hotplug emulator by Shaohui Zheng on Friday, November 12, 2010 - 11:15 pm. (2 messages)