All of lore.kernel.org
 help / color / mirror / Atom feed
From: shaohui.zheng@intel.com
To: akpm@linux-foundation.org, linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org, haicheng.li@linux.intel.com,
	lethal@linux-sh.org, ak@linux.intel.com,
	shaohui.zheng@linux.intel.com, rientjes@google.com,
	dave@linux.vnet.ibm.com, gregkh@suse.de,
	Shaohui Zheng <shaohui.zheng@intel.com>,
	Haicheng Li <haicheng.li@intel.com>
Subject: [7/8, v5] NUMA Hotplug Emulator: implement debugfs interface for memory probe
Date: Mon, 29 Nov 2010 17:17:57 +0800	[thread overview]
Message-ID: <20101129091936.219153586@intel.com> (raw)
In-Reply-To: 20101129091750.950277284@intel.com

[-- Attachment #1: 007-hotplug-emulator-implement-memory-probe-debugfs-interface.patch --]
[-- Type: text/plain, Size: 3692 bytes --]

From: Shaohui Zheng <shaohui.zheng@intel.com>

Implement a debugfs inteface /sys/kernel/debug/memory/probe for meomory hotplug
emulation.  it accepts the same parameters like
/sys/devices/system/memory/probe.

Document the interface usage to file Documentation/memory-hotplug.txt.

CC: Dave Hansen <dave@linux.vnet.ibm.com>
Signed-off-by: Shaohui Zheng <shaohui.zheng@intel.com>
Signed-off-by: Haicheng Li <haicheng.li@intel.com>
--
Index: linux-hpe4/mm/memory_hotplug.c
===================================================================
--- linux-hpe4.orig/mm/memory_hotplug.c	2010-11-29 15:15:53.209066001 +0800
+++ linux-hpe4/mm/memory_hotplug.c	2010-11-29 15:16:00.059065999 +0800
@@ -982,4 +982,35 @@
 }
 
 module_init(node_debug_init);
+
+#ifdef CONFIG_ARCH_MEMORY_PROBE
+static struct dentry *memory_debug_root;
+
+static ssize_t debug_memory_probe_store(struct file *file, const char __user *buf,
+				size_t count, loff_t *ppos)
+{
+	return parse_memory_probe_store(buf, count);
+}
+
+static const struct file_operations memory_probe_file_ops = {
+	.write		= debug_memory_probe_store,
+	.llseek		= generic_file_llseek,
+};
+
+static int __init memory_debug_init(void)
+{
+	memory_debug_root = debugfs_create_dir("memory", NULL);
+	if (!memory_debug_root)
+		return -ENOMEM;
+
+	if (!debugfs_create_file("probe", S_IWUSR, memory_debug_root,
+			NULL, &memory_probe_file_ops))
+		return -ENOMEM;
+
+	return 0;
+}
+
+module_init(memory_debug_init);
+
+#endif /* CONFIG_ARCH_MEMORY_PROBE */
 #endif /* CONFIG_DEBUG_FS */
Index: linux-hpe4/Documentation/memory-hotplug.txt
===================================================================
--- linux-hpe4.orig/Documentation/memory-hotplug.txt	2010-11-29 15:16:53.739066001 +0800
+++ linux-hpe4/Documentation/memory-hotplug.txt	2010-11-29 15:39:23.209066001 +0800
@@ -198,23 +198,39 @@
 In some environments, especially virtualized environment, firmware will not
 notify memory hotplug event to the kernel. For such environment, "probe"
 interface is supported. This interface depends on CONFIG_ARCH_MEMORY_PROBE.
+It can be also used for physical memory hotplug emulation.
 
-Now, CONFIG_ARCH_MEMORY_PROBE is supported only by powerpc but it does not
-contain highly architecture codes. Please add config if you need "probe"
+Now, CONFIG_ARCH_MEMORY_PROBE is supported by powerpc and x86_64, but it does
+not contain highly architecture codes. Please add config if you need "probe"
 interface.
 
-Probe interface is located at
-/sys/devices/system/memory/probe
+We have both sysfs and debugfs interface for memory probe. They are located at
+/sys/devices/system/memory/probe (sysfs) and /sys/kernel/debug/memory/probe
+(debugfs), We can try any of them, they accpet the same parameters.
 
 You can tell the physical address of new memory to the kernel by
 
-% echo start_address_of_new_memory > /sys/devices/system/memory/probe
+% echo start_address_of_new_memory > memory/probe
 
 Then, [start_address_of_new_memory, start_address_of_new_memory + section_size)
 memory range is hot-added. In this case, hotplug script is not called (in
 current implementation). You'll have to online memory by yourself.
 Please see "How to online memory" in this text.
 
+memory/probe interface accepts more flexible parameters, for example:
+
+Add a memory section(128M) to node 3(boots with mem=1024m)
+
+	echo 0x40000000,3 > memory/probe
+
+And more we make it friendly, it is possible to add memory to do
+
+	echo 3g > memory/probe
+	echo 1024m,3 > memory/probe
+
+Another format suggested by Dave Hansen:
+
+	echo physical_address=0x40000000 numa_node=3 > memory/probe
 
 4.3 Node hotplug emulation
 ------------

-- 
Thanks & Regards,
Shaohui



WARNING: multiple messages have this Message-ID (diff)
From: shaohui.zheng@intel.com
To: akpm@linux-foundation.org, linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org, haicheng.li@linux.intel.com,
	lethal@linux-sh.org, ak@linux.intel.com,
	shaohui.zheng@linux.intel.com, rientjes@google.com,
	dave@linux.vnet.ibm.com, gregkh@suse.de,
	Shaohui Zheng <shaohui.zheng@intel.com>,
	Haicheng Li <haicheng.li@intel.com>
Subject: [7/8, v5] NUMA Hotplug Emulator: implement debugfs interface for memory probe
Date: Mon, 29 Nov 2010 17:17:57 +0800	[thread overview]
Message-ID: <20101129091936.219153586@intel.com> (raw)
In-Reply-To: 20101129091750.950277284@intel.com

[-- Attachment #1: 007-hotplug-emulator-implement-memory-probe-debugfs-interface.patch --]
[-- Type: text/plain, Size: 3988 bytes --]

From: Shaohui Zheng <shaohui.zheng@intel.com>

Implement a debugfs inteface /sys/kernel/debug/memory/probe for meomory hotplug
emulation.  it accepts the same parameters like
/sys/devices/system/memory/probe.

Document the interface usage to file Documentation/memory-hotplug.txt.

CC: Dave Hansen <dave@linux.vnet.ibm.com>
Signed-off-by: Shaohui Zheng <shaohui.zheng@intel.com>
Signed-off-by: Haicheng Li <haicheng.li@intel.com>
--
Index: linux-hpe4/mm/memory_hotplug.c
===================================================================
--- linux-hpe4.orig/mm/memory_hotplug.c	2010-11-29 15:15:53.209066001 +0800
+++ linux-hpe4/mm/memory_hotplug.c	2010-11-29 15:16:00.059065999 +0800
@@ -982,4 +982,35 @@
 }
 
 module_init(node_debug_init);
+
+#ifdef CONFIG_ARCH_MEMORY_PROBE
+static struct dentry *memory_debug_root;
+
+static ssize_t debug_memory_probe_store(struct file *file, const char __user *buf,
+				size_t count, loff_t *ppos)
+{
+	return parse_memory_probe_store(buf, count);
+}
+
+static const struct file_operations memory_probe_file_ops = {
+	.write		= debug_memory_probe_store,
+	.llseek		= generic_file_llseek,
+};
+
+static int __init memory_debug_init(void)
+{
+	memory_debug_root = debugfs_create_dir("memory", NULL);
+	if (!memory_debug_root)
+		return -ENOMEM;
+
+	if (!debugfs_create_file("probe", S_IWUSR, memory_debug_root,
+			NULL, &memory_probe_file_ops))
+		return -ENOMEM;
+
+	return 0;
+}
+
+module_init(memory_debug_init);
+
+#endif /* CONFIG_ARCH_MEMORY_PROBE */
 #endif /* CONFIG_DEBUG_FS */
Index: linux-hpe4/Documentation/memory-hotplug.txt
===================================================================
--- linux-hpe4.orig/Documentation/memory-hotplug.txt	2010-11-29 15:16:53.739066001 +0800
+++ linux-hpe4/Documentation/memory-hotplug.txt	2010-11-29 15:39:23.209066001 +0800
@@ -198,23 +198,39 @@
 In some environments, especially virtualized environment, firmware will not
 notify memory hotplug event to the kernel. For such environment, "probe"
 interface is supported. This interface depends on CONFIG_ARCH_MEMORY_PROBE.
+It can be also used for physical memory hotplug emulation.
 
-Now, CONFIG_ARCH_MEMORY_PROBE is supported only by powerpc but it does not
-contain highly architecture codes. Please add config if you need "probe"
+Now, CONFIG_ARCH_MEMORY_PROBE is supported by powerpc and x86_64, but it does
+not contain highly architecture codes. Please add config if you need "probe"
 interface.
 
-Probe interface is located at
-/sys/devices/system/memory/probe
+We have both sysfs and debugfs interface for memory probe. They are located at
+/sys/devices/system/memory/probe (sysfs) and /sys/kernel/debug/memory/probe
+(debugfs), We can try any of them, they accpet the same parameters.
 
 You can tell the physical address of new memory to the kernel by
 
-% echo start_address_of_new_memory > /sys/devices/system/memory/probe
+% echo start_address_of_new_memory > memory/probe
 
 Then, [start_address_of_new_memory, start_address_of_new_memory + section_size)
 memory range is hot-added. In this case, hotplug script is not called (in
 current implementation). You'll have to online memory by yourself.
 Please see "How to online memory" in this text.
 
+memory/probe interface accepts more flexible parameters, for example:
+
+Add a memory section(128M) to node 3(boots with mem=1024m)
+
+	echo 0x40000000,3 > memory/probe
+
+And more we make it friendly, it is possible to add memory to do
+
+	echo 3g > memory/probe
+	echo 1024m,3 > memory/probe
+
+Another format suggested by Dave Hansen:
+
+	echo physical_address=0x40000000 numa_node=3 > memory/probe
 
 4.3 Node hotplug emulation
 ------------

-- 
Thanks & Regards,
Shaohui


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2010-11-29 10:46 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-29  9:17 [0/8, v5] NUMA Hotplug Emulator(v5) - Feedbacks & Responses shaohui.zheng
2010-11-29  9:17 ` shaohui.zheng
2010-11-29  9:17 ` [1/8, v5] NUMA Hotplug Emulator: Add numa=possibe options shaohui.zheng
2010-11-29  9:17   ` shaohui.zheng
2010-11-29 23:59   ` David Rientjes
2010-11-29 23:59     ` David Rientjes
2010-11-30  1:09     ` Shaohui Zheng
2010-11-30  1:09       ` Shaohui Zheng
2010-11-29  9:17 ` [2/8, v5] NUMA Hotplug Emulator: Add node hotplug emulation shaohui.zheng
2010-11-29  9:17   ` shaohui.zheng
2010-11-30  0:01   ` David Rientjes
2010-11-30  0:01     ` David Rientjes
2010-11-30  1:22     ` Shaohui Zheng
2010-11-30  1:22       ` Shaohui Zheng
2010-11-30 20:10       ` David Rientjes
2010-11-30 20:10         ` David Rientjes
2010-11-30 23:16         ` Shaohui Zheng
2010-11-30 23:16           ` Shaohui Zheng
2010-12-02  0:59           ` David Rientjes
2010-12-02  0:59             ` David Rientjes
2010-11-29  9:17 ` [3/8, v5] NUMA Hotplug Emulation: Abstract cpu register functions shaohui.zheng
2010-11-29  9:17   ` shaohui.zheng
2010-11-29  9:17 ` [4/8, v5] NUMA Hotplug Emulator: support cpu probe/release in x86_64 shaohui.zheng
2010-11-29  9:17   ` shaohui.zheng
2010-11-29  9:17 ` [5/8, v5] NUMA Hotplug Emulator: Fake CPU socket with logical CPU on x86 shaohui.zheng
2010-11-29  9:17   ` shaohui.zheng
2010-11-29  9:17 ` [6/8, v5] From: Shaohui Zheng <shaohui.zheng@intel.com> shaohui.zheng
2010-11-29  9:17   ` shaohui.zheng
2010-11-29  9:17 ` shaohui.zheng [this message]
2010-11-29  9:17   ` [7/8, v5] NUMA Hotplug Emulator: implement debugfs interface for memory probe shaohui.zheng
2010-11-29  9:17 ` [8/8, v5] NUMA Hotplug Emulator: documentation shaohui.zheng
2010-11-29  9:17   ` shaohui.zheng
2010-11-29 18:19   ` Valdis.Kletnieks
2010-11-30  1:31     ` Shaohui Zheng
2010-11-30  1:31       ` Shaohui Zheng
2010-11-30  0:02   ` David Rientjes
2010-11-30  0:02     ` David Rientjes
2010-11-30  1:32     ` Shaohui Zheng
2010-11-30  1:32       ` Shaohui Zheng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101129091936.219153586@intel.com \
    --to=shaohui.zheng@intel.com \
    --cc=ak@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=dave@linux.vnet.ibm.com \
    --cc=gregkh@suse.de \
    --cc=haicheng.li@intel.com \
    --cc=haicheng.li@linux.intel.com \
    --cc=lethal@linux-sh.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=rientjes@google.com \
    --cc=shaohui.zheng@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.