aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorYasunori Goto <y-goto@jp.fujitsu.com>2006-06-27 05:53:38 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-27 20:32:36 -0400
commit0fc44159bfcb5b0afa178f9c3f50db23aebc76ff (patch)
treed87e47c0f5e6b2eff1d9113d3495d185924734d9 /arch
parent1f04bbd2d396a701c5af2e5b92bad896c2550c16 (diff)
[PATCH] Register sysfs file for hotplugged new node
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@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>
Diffstat (limited to 'arch')
-rw-r--r--arch/i386/kernel/topology.c9
-rw-r--r--arch/ia64/kernel/topology.c15
-rw-r--r--arch/powerpc/kernel/sysfs.c15
3 files changed, 8 insertions, 31 deletions
diff --git a/arch/i386/kernel/topology.c b/arch/i386/kernel/topology.c
index 296355292c7c..1eecc2e1bd4b 100644
--- a/arch/i386/kernel/topology.c
+++ b/arch/i386/kernel/topology.c
@@ -38,7 +38,7 @@ int arch_register_cpu(int num){
38#ifdef CONFIG_NUMA 38#ifdef CONFIG_NUMA
39 int node = cpu_to_node(num); 39 int node = cpu_to_node(num);
40 if (node_online(node)) 40 if (node_online(node))
41 parent = &node_devices[node].node; 41 parent = &node_devices[parent_node(node)];
42#endif /* CONFIG_NUMA */ 42#endif /* CONFIG_NUMA */
43 43
44 /* 44 /*
@@ -61,7 +61,7 @@ void arch_unregister_cpu(int num) {
61#ifdef CONFIG_NUMA 61#ifdef CONFIG_NUMA
62 int node = cpu_to_node(num); 62 int node = cpu_to_node(num);
63 if (node_online(node)) 63 if (node_online(node))
64 parent = &node_devices[node].node; 64 parent = &node_devices[parent_node(node)];
65#endif /* CONFIG_NUMA */ 65#endif /* CONFIG_NUMA */
66 66
67 return unregister_cpu(&cpu_devices[num].cpu, parent); 67 return unregister_cpu(&cpu_devices[num].cpu, parent);
@@ -74,16 +74,13 @@ EXPORT_SYMBOL(arch_unregister_cpu);
74 74
75#ifdef CONFIG_NUMA 75#ifdef CONFIG_NUMA
76#include <linux/mmzone.h> 76#include <linux/mmzone.h>
77#include <asm/node.h>
78
79struct i386_node node_devices[MAX_NUMNODES];
80 77
81static int __init topology_init(void) 78static int __init topology_init(void)
82{ 79{
83 int i; 80 int i;
84 81
85 for_each_online_node(i) 82 for_each_online_node(i)
86 arch_register_node(i); 83 register_one_node(i);
87 84
88 for_each_present_cpu(i) 85 for_each_present_cpu(i)
89 arch_register_cpu(i); 86 arch_register_cpu(i);
diff --git a/arch/ia64/kernel/topology.c b/arch/ia64/kernel/topology.c
index 879edb51d1e0..42cb05bdc680 100644
--- a/arch/ia64/kernel/topology.c
+++ b/arch/ia64/kernel/topology.c
@@ -26,9 +26,6 @@
26#include <asm/numa.h> 26#include <asm/numa.h>
27#include <asm/cpu.h> 27#include <asm/cpu.h>
28 28
29#ifdef CONFIG_NUMA
30static struct node *sysfs_nodes;
31#endif
32static struct ia64_cpu *sysfs_cpus; 29static struct ia64_cpu *sysfs_cpus;
33 30
34int arch_register_cpu(int num) 31int arch_register_cpu(int num)
@@ -36,7 +33,7 @@ int arch_register_cpu(int num)
36 struct node *parent = NULL; 33 struct node *parent = NULL;
37 34
38#ifdef CONFIG_NUMA 35#ifdef CONFIG_NUMA
39 parent = &sysfs_nodes[cpu_to_node(num)]; 36 parent = &node_devices[cpu_to_node(num)];
40#endif /* CONFIG_NUMA */ 37#endif /* CONFIG_NUMA */
41 38
42#if defined (CONFIG_ACPI) && defined (CONFIG_HOTPLUG_CPU) 39#if defined (CONFIG_ACPI) && defined (CONFIG_HOTPLUG_CPU)
@@ -59,7 +56,7 @@ void arch_unregister_cpu(int num)
59 56
60#ifdef CONFIG_NUMA 57#ifdef CONFIG_NUMA
61 int node = cpu_to_node(num); 58 int node = cpu_to_node(num);
62 parent = &sysfs_nodes[node]; 59 parent = &node_devices[node];
63#endif /* CONFIG_NUMA */ 60#endif /* CONFIG_NUMA */
64 61
65 return unregister_cpu(&sysfs_cpus[num].cpu, parent); 62 return unregister_cpu(&sysfs_cpus[num].cpu, parent);
@@ -74,17 +71,11 @@ static int __init topology_init(void)
74 int i, err = 0; 71 int i, err = 0;
75 72
76#ifdef CONFIG_NUMA 73#ifdef CONFIG_NUMA
77 sysfs_nodes = kzalloc(sizeof(struct node) * MAX_NUMNODES, GFP_KERNEL);
78 if (!sysfs_nodes) {
79 err = -ENOMEM;
80 goto out;
81 }
82
83 /* 74 /*
84 * MCD - Do we want to register all ONLINE nodes, or all POSSIBLE nodes? 75 * MCD - Do we want to register all ONLINE nodes, or all POSSIBLE nodes?
85 */ 76 */
86 for_each_online_node(i) { 77 for_each_online_node(i) {
87 if ((err = register_node(&sysfs_nodes[i], i, 0))) 78 if ((err = register_one_node(i)))
88 goto out; 79 goto out;
89 } 80 }
90#endif 81#endif
diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c
index 5bc2585c8036..338491d1604a 100644
--- a/arch/powerpc/kernel/sysfs.c
+++ b/arch/powerpc/kernel/sysfs.c
@@ -304,23 +304,12 @@ static struct notifier_block sysfs_cpu_nb = {
304/* NUMA stuff */ 304/* NUMA stuff */
305 305
306#ifdef CONFIG_NUMA 306#ifdef CONFIG_NUMA
307static struct node node_devices[MAX_NUMNODES];
308
309static void register_nodes(void) 307static void register_nodes(void)
310{ 308{
311 int i; 309 int i;
312 310
313 for (i = 0; i < MAX_NUMNODES; i++) { 311 for (i = 0; i < MAX_NUMNODES; i++)
314 if (node_online(i)) { 312 register_one_node(i);
315 int p_node = parent_node(i);
316 struct node *parent = NULL;
317
318 if (p_node != i)
319 parent = &node_devices[p_node];
320
321 register_node(&node_devices[i], i, parent);
322 }
323 }
324} 313}
325 314
326int sysfs_add_device_to_node(struct sys_device *dev, int nid) 315int sysfs_add_device_to_node(struct sys_device *dev, int nid)