The patch titled Register sysfs file for hotpluged new node has been added to the -mm tree. Its filename is register-sysfs-file-for-hotpluged-new-node.patch See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: Register sysfs file for hotpluged new node From: Yasunori Goto <y-goto@xxxxxxxxxxxxxx> When new node becomes enable by hot-add, new sysfs file must be created for new node. So, if new node is enabled by add_memory(), register_one_node() is called to create it. In addition, I386's arch_register_node() and a part of register_nodes() of powerpc are consolidated to register_one_node() as a generic_code(). This is tested by Tiger4(IPF) with node hot-plug emulation. Signed-off-by: Keiichiro Tokunaga <tokuanga.keiich@xxxxxxxxxxxxxx> Signed-off-by: Yasunori Goto <y-goto@xxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- dev/null | 29 ----------------------------- arch/i386/kernel/topology.c | 9 +++------ arch/powerpc/kernel/sysfs.c | 15 ++------------- drivers/base/node.c | 25 +++++++++++++++++++++++++ include/asm-i386/cpu.h | 2 -- include/linux/node.h | 4 ++++ mm/memory_hotplug.c | 12 +++++++++++- 7 files changed, 45 insertions(+), 51 deletions(-) diff -puN arch/i386/kernel/topology.c~register-sysfs-file-for-hotpluged-new-node arch/i386/kernel/topology.c --- devel/arch/i386/kernel/topology.c~register-sysfs-file-for-hotpluged-new-node 2006-05-18 12:06:51.000000000 -0700 +++ devel-akpm/arch/i386/kernel/topology.c 2006-05-18 12:06:51.000000000 -0700 @@ -38,7 +38,7 @@ int arch_register_cpu(int num){ #ifdef CONFIG_NUMA int node = cpu_to_node(num); if (node_online(node)) - parent = &node_devices[node].node; + parent = &node_devices[parent_node(node)]; #endif /* CONFIG_NUMA */ /* @@ -61,7 +61,7 @@ void arch_unregister_cpu(int num) { #ifdef CONFIG_NUMA int node = cpu_to_node(num); if (node_online(node)) - parent = &node_devices[node].node; + parent = &node_devices[parent_node(node)]; #endif /* CONFIG_NUMA */ return unregister_cpu(&cpu_devices[num].cpu, parent); @@ -74,16 +74,13 @@ EXPORT_SYMBOL(arch_unregister_cpu); #ifdef CONFIG_NUMA #include <linux/mmzone.h> -#include <asm/node.h> - -struct i386_node node_devices[MAX_NUMNODES]; static int __init topology_init(void) { int i; for_each_online_node(i) - arch_register_node(i); + register_one_node(i); for_each_present_cpu(i) arch_register_cpu(i); diff -puN arch/powerpc/kernel/sysfs.c~register-sysfs-file-for-hotpluged-new-node arch/powerpc/kernel/sysfs.c --- devel/arch/powerpc/kernel/sysfs.c~register-sysfs-file-for-hotpluged-new-node 2006-05-18 12:06:51.000000000 -0700 +++ devel-akpm/arch/powerpc/kernel/sysfs.c 2006-05-18 12:06:51.000000000 -0700 @@ -304,23 +304,12 @@ static struct notifier_block sysfs_cpu_n /* NUMA stuff */ #ifdef CONFIG_NUMA -static struct node node_devices[MAX_NUMNODES]; - static void register_nodes(void) { int i; - for (i = 0; i < MAX_NUMNODES; i++) { - if (node_online(i)) { - int p_node = parent_node(i); - struct node *parent = NULL; - - if (p_node != i) - parent = &node_devices[p_node]; - - register_node(&node_devices[i], i, parent); - } - } + for (i = 0; i < MAX_NUMNODES; i++) + register_one_node(i); } int sysfs_add_device_to_node(struct sys_device *dev, int nid) diff -puN drivers/base/node.c~register-sysfs-file-for-hotpluged-new-node drivers/base/node.c --- devel/drivers/base/node.c~register-sysfs-file-for-hotpluged-new-node 2006-05-18 12:06:51.000000000 -0700 +++ devel-akpm/drivers/base/node.c 2006-05-18 12:06:51.000000000 -0700 @@ -190,6 +190,31 @@ void unregister_node(struct node *node) sysdev_unregister(&node->sysdev); } +struct node node_devices[MAX_NUMNODES]; + +int register_one_node(int nid) +{ + int error = 0; + + if (node_online(nid)) { + int p_node = parent_node(nid); + struct node *parent = NULL; + + if (p_node != nid) + parent = &node_devices[p_node]; + + error = register_node(&node_devices[nid], nid, parent); + } + + return error; + +} + +void unregister_one_node(int nid) +{ + unregister_node(&node_devices[nid]); +} + static int __init register_node_type(void) { return sysdev_class_register(&node_class); diff -puN include/asm-i386/cpu.h~register-sysfs-file-for-hotpluged-new-node include/asm-i386/cpu.h --- devel/include/asm-i386/cpu.h~register-sysfs-file-for-hotpluged-new-node 2006-05-18 12:06:51.000000000 -0700 +++ devel-akpm/include/asm-i386/cpu.h 2006-05-18 12:06:51.000000000 -0700 @@ -7,8 +7,6 @@ #include <linux/nodemask.h> #include <linux/percpu.h> -#include <asm/node.h> - struct i386_cpu { struct cpu cpu; }; diff -L include/asm-i386/node.h -puN include/asm-i386/node.h~register-sysfs-file-for-hotpluged-new-node /dev/null --- devel/include/asm-i386/node.h +++ /dev/null 2003-09-15 06:40:47.000000000 -0700 @@ -1,29 +0,0 @@ -#ifndef _ASM_I386_NODE_H_ -#define _ASM_I386_NODE_H_ - -#include <linux/device.h> -#include <linux/mmzone.h> -#include <linux/node.h> -#include <linux/topology.h> -#include <linux/nodemask.h> - -struct i386_node { - struct node node; -}; -extern struct i386_node node_devices[MAX_NUMNODES]; - -static inline int arch_register_node(int num){ - int p_node; - struct node *parent = NULL; - - if (!node_online(num)) - return 0; - p_node = parent_node(num); - - if (p_node != num) - parent = &node_devices[p_node].node; - - return register_node(&node_devices[num].node, num, parent); -} - -#endif /* _ASM_I386_NODE_H_ */ diff -puN include/linux/node.h~register-sysfs-file-for-hotpluged-new-node include/linux/node.h --- devel/include/linux/node.h~register-sysfs-file-for-hotpluged-new-node 2006-05-18 12:06:51.000000000 -0700 +++ devel-akpm/include/linux/node.h 2006-05-18 12:06:51.000000000 -0700 @@ -26,8 +26,12 @@ struct node { struct sys_device sysdev; }; +extern struct node node_devices[]; + extern int register_node(struct node *, int, struct node *); extern void unregister_node(struct node *node); +extern int register_one_node(int nid); +extern void unregister_one_node(int nid); #define to_node(sys_device) container_of(sys_device, struct node, sysdev) diff -puN mm/memory_hotplug.c~register-sysfs-file-for-hotpluged-new-node mm/memory_hotplug.c --- devel/mm/memory_hotplug.c~register-sysfs-file-for-hotpluged-new-node 2006-05-18 12:06:51.000000000 -0700 +++ devel-akpm/mm/memory_hotplug.c 2006-05-18 12:06:51.000000000 -0700 @@ -256,9 +256,19 @@ int add_memory(int nid, u64 start, u64 s if (ret < 0) goto error; - /* we online node here. we have no error path from here. */ + /* we online node here. we can't roll back from here. */ node_set_online(nid); + if (new_pgdat) { + ret = register_one_node(nid); + /* + * If sysfs file of new node can't create, cpu on the node + * can't be hot-added. There is no rollback way now. + * So, check by BUG_ON() to catch it reluctantly.. + */ + BUG_ON(ret); + } + /* register this memory as resource */ register_memory_resource(start, size); _ Patches currently in -mm which might be from y-goto@xxxxxxxxxxxxxx are catch-notification-of-memory-add-event-of-acpi-via-container-driver-register-start-func-for-memory-device.patch catch-notification-of-memory-add-event-of-acpi-via-container-driveravoid-redundant-call-add_memory.patch wait_table-and-zonelist-initializing-for-memory-hotadd-change-name-of-wait_table_size.patch wait_table-and-zonelist-initializing-for-memory-hotadd-change-to-meminit-for-build_zonelist.patch wait_table-and-zonelist-initializing-for-memory-hotaddadd-return-code-for-init_current_empty_zone.patch wait_table-and-zonelist-initializing-for-memory-hotadd-wait_table-initialization.patch wait_table-and-zonelist-initializing-for-memory-hotadd-update-zonelists.patch pgdat-allocation-for-new-node-add-specify-node-id.patch pgdat-allocation-for-new-node-add-specify-node-id-powerpc-fix.patch pgdat-allocation-for-new-node-add-specify-node-id-tidy.patch pgdat-allocation-for-new-node-add-specify-node-id-fix-3.patch pgdat-allocation-for-new-node-add-specify-node-id-build-fixes.patch pgdat-allocation-for-new-node-add-specify-node-id-tidy-cleanup.patch pgdat-allocation-for-new-node-add-get-node-id-by-acpi.patch pgdat-allocation-for-new-node-add-generic-alloc-node_data.patch pgdat-allocation-for-new-node-add-generic-alloc-node_data-tidy.patch pgdat-allocation-for-new-node-add-refresh-node_data.patch pgdat-allocation-for-new-node-add-refresh-node_data-fix.patch pgdat-allocation-for-new-node-add-export-kswapd-start-func.patch pgdat-allocation-for-new-node-add-export-kswapd-start-func-tidy.patch pgdat-allocation-for-new-node-add-call-pgdat-allocation.patch fix-compile-error-undefined-reference-for-sparc64.patch register-sysfs-file-for-hotpluged-new-node.patch pgdat-allocation-and-update-for-ia64-of-memory-hotplughold-pgdat-address-at-system-running.patch pgdat-allocation-and-update-for-ia64-of-memory-hotplug-update-pgdat-address-array.patch pgdat-allocation-and-update-for-ia64-of-memory-hotplugallocate-pgdat-and-per-node-data.patch introduce-mechanism-for-registering-active-regions-of-memory.patch have-power-use-add_active_range-and-free_area_init_nodes.patch have-x86-use-add_active_range-and-free_area_init_nodes.patch have-x86_64-use-add_active_range-and-free_area_init_nodes.patch sparsemem-record-nid-during-memory-present.patch unify-pxm_to_node-and-node_to_pxm.patch unify-pxm_to_node-and-node_to_pxm-update.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html