diff options
author | KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> | 2006-06-27 05:53:41 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-27 20:32:37 -0400 |
commit | 76b67ed9dce69a6a329cdd66f94af1787f417b62 (patch) | |
tree | 4d80993e607ae4a870f98ad3441795737570b012 /arch | |
parent | dd0932d9d4301bd58a4d5a634a3a8298c4fc5e24 (diff) |
[PATCH] node hotplug: register cpu: remove node struct
With Goto-san's patch, we can add new pgdat/node at runtime. I'm now
considering node-hot-add with cpu + memory on ACPI.
I found acpi container, which describes node, could evaluate cpu before
memory. This means cpu-hot-add occurs before memory hot add.
In most part, cpu-hot-add doesn't depend on node hot add. But register_cpu(),
which creates symbolic link from node to cpu, requires that node should be
onlined before register_cpu(). When a node is onlined, its pgdat should be
there.
This patch-set holds off creating symbolic link from node to cpu
until node is onlined.
This removes node arguments from register_cpu().
Now, register_cpu() requires 'struct node' as its argument. But the array of
struct node is now unified in driver/base/node.c now (By Goto's node hotplug
patch). We can get struct node in generic way. So, this argument is not
necessary now.
This patch also guarantees add cpu under node only when node is onlined. It
is necessary for node-hot-add vs. cpu-hot-add patch following this.
Moreover, register_cpu calculates cpu->node_id by cpu_to_node() without regard
to its 'struct node *root' argument. This patch removes it.
Also modify callers of register_cpu()/unregister_cpu, whose args are changed
by register-cpu-remove-node-struct patch.
[Brice.Goglin@ens-lyon.org: fix it]
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Yasunori Goto <y-goto@jp.fujitsu.com>
Cc: Ashok Raj <ashok.raj@intel.com>
Cc: Dave Hansen <haveblue@us.ibm.com>
Signed-off-by: Brice Goglin <Brice.Goglin@ens-lyon.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/alpha/kernel/setup.c | 2 | ||||
-rw-r--r-- | arch/arm/kernel/setup.c | 2 | ||||
-rw-r--r-- | arch/i386/kernel/topology.c | 23 | ||||
-rw-r--r-- | arch/ia64/kernel/topology.c | 17 | ||||
-rw-r--r-- | arch/m32r/kernel/setup.c | 2 | ||||
-rw-r--r-- | arch/mips/kernel/smp.c | 2 | ||||
-rw-r--r-- | arch/parisc/kernel/topology.c | 3 | ||||
-rw-r--r-- | arch/powerpc/kernel/setup_32.c | 2 | ||||
-rw-r--r-- | arch/powerpc/kernel/sysfs.c | 12 | ||||
-rw-r--r-- | arch/ppc/kernel/setup.c | 2 | ||||
-rw-r--r-- | arch/s390/kernel/smp.c | 2 | ||||
-rw-r--r-- | arch/sh/kernel/setup.c | 2 | ||||
-rw-r--r-- | arch/sh64/kernel/setup.c | 2 | ||||
-rw-r--r-- | arch/sparc64/kernel/setup.c | 2 |
14 files changed, 18 insertions, 57 deletions
diff --git a/arch/alpha/kernel/setup.c b/arch/alpha/kernel/setup.c index 558b83368559..254c507a608c 100644 --- a/arch/alpha/kernel/setup.c +++ b/arch/alpha/kernel/setup.c | |||
@@ -481,7 +481,7 @@ register_cpus(void) | |||
481 | struct cpu *p = kzalloc(sizeof(*p), GFP_KERNEL); | 481 | struct cpu *p = kzalloc(sizeof(*p), GFP_KERNEL); |
482 | if (!p) | 482 | if (!p) |
483 | return -ENOMEM; | 483 | return -ENOMEM; |
484 | register_cpu(p, i, NULL); | 484 | register_cpu(p, i); |
485 | } | 485 | } |
486 | return 0; | 486 | return 0; |
487 | } | 487 | } |
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index 9fc9af88c60c..093ccba0503c 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c | |||
@@ -808,7 +808,7 @@ static int __init topology_init(void) | |||
808 | int cpu; | 808 | int cpu; |
809 | 809 | ||
810 | for_each_possible_cpu(cpu) | 810 | for_each_possible_cpu(cpu) |
811 | register_cpu(&per_cpu(cpu_data, cpu).cpu, cpu, NULL); | 811 | register_cpu(&per_cpu(cpu_data, cpu).cpu, cpu); |
812 | 812 | ||
813 | return 0; | 813 | return 0; |
814 | } | 814 | } |
diff --git a/arch/i386/kernel/topology.c b/arch/i386/kernel/topology.c index 1eecc2e1bd4b..e2e281d4bcc8 100644 --- a/arch/i386/kernel/topology.c +++ b/arch/i386/kernel/topology.c | |||
@@ -32,15 +32,8 @@ | |||
32 | 32 | ||
33 | static struct i386_cpu cpu_devices[NR_CPUS]; | 33 | static struct i386_cpu cpu_devices[NR_CPUS]; |
34 | 34 | ||
35 | int arch_register_cpu(int num){ | 35 | int arch_register_cpu(int num) |
36 | struct node *parent = NULL; | 36 | { |
37 | |||
38 | #ifdef CONFIG_NUMA | ||
39 | int node = cpu_to_node(num); | ||
40 | if (node_online(node)) | ||
41 | parent = &node_devices[parent_node(node)]; | ||
42 | #endif /* CONFIG_NUMA */ | ||
43 | |||
44 | /* | 37 | /* |
45 | * CPU0 cannot be offlined due to several | 38 | * CPU0 cannot be offlined due to several |
46 | * restrictions and assumptions in kernel. This basically | 39 | * restrictions and assumptions in kernel. This basically |
@@ -50,21 +43,13 @@ int arch_register_cpu(int num){ | |||
50 | if (!num) | 43 | if (!num) |
51 | cpu_devices[num].cpu.no_control = 1; | 44 | cpu_devices[num].cpu.no_control = 1; |
52 | 45 | ||
53 | return register_cpu(&cpu_devices[num].cpu, num, parent); | 46 | return register_cpu(&cpu_devices[num].cpu, num); |
54 | } | 47 | } |
55 | 48 | ||
56 | #ifdef CONFIG_HOTPLUG_CPU | 49 | #ifdef CONFIG_HOTPLUG_CPU |
57 | 50 | ||
58 | void arch_unregister_cpu(int num) { | 51 | void arch_unregister_cpu(int num) { |
59 | struct node *parent = NULL; | 52 | return unregister_cpu(&cpu_devices[num].cpu); |
60 | |||
61 | #ifdef CONFIG_NUMA | ||
62 | int node = cpu_to_node(num); | ||
63 | if (node_online(node)) | ||
64 | parent = &node_devices[parent_node(node)]; | ||
65 | #endif /* CONFIG_NUMA */ | ||
66 | |||
67 | return unregister_cpu(&cpu_devices[num].cpu, parent); | ||
68 | } | 53 | } |
69 | EXPORT_SYMBOL(arch_register_cpu); | 54 | EXPORT_SYMBOL(arch_register_cpu); |
70 | EXPORT_SYMBOL(arch_unregister_cpu); | 55 | EXPORT_SYMBOL(arch_unregister_cpu); |
diff --git a/arch/ia64/kernel/topology.c b/arch/ia64/kernel/topology.c index 42cb05bdc680..5737c9a061ef 100644 --- a/arch/ia64/kernel/topology.c +++ b/arch/ia64/kernel/topology.c | |||
@@ -30,12 +30,6 @@ static struct ia64_cpu *sysfs_cpus; | |||
30 | 30 | ||
31 | int arch_register_cpu(int num) | 31 | int arch_register_cpu(int num) |
32 | { | 32 | { |
33 | struct node *parent = NULL; | ||
34 | |||
35 | #ifdef CONFIG_NUMA | ||
36 | parent = &node_devices[cpu_to_node(num)]; | ||
37 | #endif /* CONFIG_NUMA */ | ||
38 | |||
39 | #if defined (CONFIG_ACPI) && defined (CONFIG_HOTPLUG_CPU) | 33 | #if defined (CONFIG_ACPI) && defined (CONFIG_HOTPLUG_CPU) |
40 | /* | 34 | /* |
41 | * If CPEI cannot be re-targetted, and this is | 35 | * If CPEI cannot be re-targetted, and this is |
@@ -45,21 +39,14 @@ int arch_register_cpu(int num) | |||
45 | sysfs_cpus[num].cpu.no_control = 1; | 39 | sysfs_cpus[num].cpu.no_control = 1; |
46 | #endif | 40 | #endif |
47 | 41 | ||
48 | return register_cpu(&sysfs_cpus[num].cpu, num, parent); | 42 | return register_cpu(&sysfs_cpus[num].cpu, num); |
49 | } | 43 | } |
50 | 44 | ||
51 | #ifdef CONFIG_HOTPLUG_CPU | 45 | #ifdef CONFIG_HOTPLUG_CPU |
52 | 46 | ||
53 | void arch_unregister_cpu(int num) | 47 | void arch_unregister_cpu(int num) |
54 | { | 48 | { |
55 | struct node *parent = NULL; | 49 | return unregister_cpu(&sysfs_cpus[num].cpu); |
56 | |||
57 | #ifdef CONFIG_NUMA | ||
58 | int node = cpu_to_node(num); | ||
59 | parent = &node_devices[node]; | ||
60 | #endif /* CONFIG_NUMA */ | ||
61 | |||
62 | return unregister_cpu(&sysfs_cpus[num].cpu, parent); | ||
63 | } | 50 | } |
64 | EXPORT_SYMBOL(arch_register_cpu); | 51 | EXPORT_SYMBOL(arch_register_cpu); |
65 | EXPORT_SYMBOL(arch_unregister_cpu); | 52 | EXPORT_SYMBOL(arch_unregister_cpu); |
diff --git a/arch/m32r/kernel/setup.c b/arch/m32r/kernel/setup.c index 3cd3c2988a48..1ff483c8a4c9 100644 --- a/arch/m32r/kernel/setup.c +++ b/arch/m32r/kernel/setup.c | |||
@@ -275,7 +275,7 @@ static int __init topology_init(void) | |||
275 | int i; | 275 | int i; |
276 | 276 | ||
277 | for_each_present_cpu(i) | 277 | for_each_present_cpu(i) |
278 | register_cpu(&cpu_devices[i], i, NULL); | 278 | register_cpu(&cpu_devices[i], i); |
279 | 279 | ||
280 | return 0; | 280 | return 0; |
281 | } | 281 | } |
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c index 298f82fe8440..9096a5ea4229 100644 --- a/arch/mips/kernel/smp.c +++ b/arch/mips/kernel/smp.c | |||
@@ -446,7 +446,7 @@ static int __init topology_init(void) | |||
446 | int ret; | 446 | int ret; |
447 | 447 | ||
448 | for_each_present_cpu(cpu) { | 448 | for_each_present_cpu(cpu) { |
449 | ret = register_cpu(&per_cpu(cpu_devices, cpu), cpu, NULL); | 449 | ret = register_cpu(&per_cpu(cpu_devices, cpu), cpu); |
450 | if (ret) | 450 | if (ret) |
451 | printk(KERN_WARNING "topology_init: register_cpu %d " | 451 | printk(KERN_WARNING "topology_init: register_cpu %d " |
452 | "failed (%d)\n", cpu, ret); | 452 | "failed (%d)\n", cpu, ret); |
diff --git a/arch/parisc/kernel/topology.c b/arch/parisc/kernel/topology.c index 3ba040050e4c..068b20d822e7 100644 --- a/arch/parisc/kernel/topology.c +++ b/arch/parisc/kernel/topology.c | |||
@@ -26,11 +26,10 @@ static struct cpu cpu_devices[NR_CPUS] __read_mostly; | |||
26 | 26 | ||
27 | static int __init topology_init(void) | 27 | static int __init topology_init(void) |
28 | { | 28 | { |
29 | struct node *parent = NULL; | ||
30 | int num; | 29 | int num; |
31 | 30 | ||
32 | for_each_present_cpu(num) { | 31 | for_each_present_cpu(num) { |
33 | register_cpu(&cpu_devices[num], num, parent); | 32 | register_cpu(&cpu_devices[num], num); |
34 | } | 33 | } |
35 | return 0; | 34 | return 0; |
36 | } | 35 | } |
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c index e5a44812441a..0932a62a1c96 100644 --- a/arch/powerpc/kernel/setup_32.c +++ b/arch/powerpc/kernel/setup_32.c | |||
@@ -215,7 +215,7 @@ int __init ppc_init(void) | |||
215 | 215 | ||
216 | /* register CPU devices */ | 216 | /* register CPU devices */ |
217 | for_each_possible_cpu(i) | 217 | for_each_possible_cpu(i) |
218 | register_cpu(&cpu_devices[i], i, NULL); | 218 | register_cpu(&cpu_devices[i], i); |
219 | 219 | ||
220 | /* call platform init */ | 220 | /* call platform init */ |
221 | if (ppc_md.init != NULL) { | 221 | if (ppc_md.init != NULL) { |
diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c index 338491d1604a..412ad00e222d 100644 --- a/arch/powerpc/kernel/sysfs.c +++ b/arch/powerpc/kernel/sysfs.c | |||
@@ -348,23 +348,13 @@ static SYSDEV_ATTR(physical_id, 0444, show_physical_id, NULL); | |||
348 | static int __init topology_init(void) | 348 | static int __init topology_init(void) |
349 | { | 349 | { |
350 | int cpu; | 350 | int cpu; |
351 | struct node *parent = NULL; | ||
352 | 351 | ||
353 | register_nodes(); | 352 | register_nodes(); |
354 | |||
355 | register_cpu_notifier(&sysfs_cpu_nb); | 353 | register_cpu_notifier(&sysfs_cpu_nb); |
356 | 354 | ||
357 | for_each_possible_cpu(cpu) { | 355 | for_each_possible_cpu(cpu) { |
358 | struct cpu *c = &per_cpu(cpu_devices, cpu); | 356 | struct cpu *c = &per_cpu(cpu_devices, cpu); |
359 | 357 | ||
360 | #ifdef CONFIG_NUMA | ||
361 | /* The node to which a cpu belongs can't be known | ||
362 | * until the cpu is made present. | ||
363 | */ | ||
364 | parent = NULL; | ||
365 | if (cpu_present(cpu)) | ||
366 | parent = &node_devices[cpu_to_node(cpu)]; | ||
367 | #endif | ||
368 | /* | 358 | /* |
369 | * For now, we just see if the system supports making | 359 | * For now, we just see if the system supports making |
370 | * the RTAS calls for CPU hotplug. But, there may be a | 360 | * the RTAS calls for CPU hotplug. But, there may be a |
@@ -376,7 +366,7 @@ static int __init topology_init(void) | |||
376 | c->no_control = 1; | 366 | c->no_control = 1; |
377 | 367 | ||
378 | if (cpu_online(cpu) || (c->no_control == 0)) { | 368 | if (cpu_online(cpu) || (c->no_control == 0)) { |
379 | register_cpu(c, cpu, parent); | 369 | register_cpu(c, cpu); |
380 | 370 | ||
381 | sysdev_create_file(&c->sysdev, &attr_physical_id); | 371 | sysdev_create_file(&c->sysdev, &attr_physical_id); |
382 | } | 372 | } |
diff --git a/arch/ppc/kernel/setup.c b/arch/ppc/kernel/setup.c index 1f79e84ab464..4b4607d89bfa 100644 --- a/arch/ppc/kernel/setup.c +++ b/arch/ppc/kernel/setup.c | |||
@@ -475,7 +475,7 @@ int __init ppc_init(void) | |||
475 | 475 | ||
476 | /* register CPU devices */ | 476 | /* register CPU devices */ |
477 | for_each_possible_cpu(i) | 477 | for_each_possible_cpu(i) |
478 | register_cpu(&cpu_devices[i], i, NULL); | 478 | register_cpu(&cpu_devices[i], i); |
479 | 479 | ||
480 | /* call platform init */ | 480 | /* call platform init */ |
481 | if (ppc_md.init != NULL) { | 481 | if (ppc_md.init != NULL) { |
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c index 343120c9223d..8e03219eea76 100644 --- a/arch/s390/kernel/smp.c +++ b/arch/s390/kernel/smp.c | |||
@@ -869,7 +869,7 @@ static int __init topology_init(void) | |||
869 | int ret; | 869 | int ret; |
870 | 870 | ||
871 | for_each_possible_cpu(cpu) { | 871 | for_each_possible_cpu(cpu) { |
872 | ret = register_cpu(&per_cpu(cpu_devices, cpu), cpu, NULL); | 872 | ret = register_cpu(&per_cpu(cpu_devices, cpu), cpu); |
873 | if (ret) | 873 | if (ret) |
874 | printk(KERN_WARNING "topology_init: register_cpu %d " | 874 | printk(KERN_WARNING "topology_init: register_cpu %d " |
875 | "failed (%d)\n", cpu, ret); | 875 | "failed (%d)\n", cpu, ret); |
diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c index bb229ef030f3..9af22116c9a2 100644 --- a/arch/sh/kernel/setup.c +++ b/arch/sh/kernel/setup.c | |||
@@ -402,7 +402,7 @@ static int __init topology_init(void) | |||
402 | int cpu_id; | 402 | int cpu_id; |
403 | 403 | ||
404 | for_each_possible_cpu(cpu_id) | 404 | for_each_possible_cpu(cpu_id) |
405 | register_cpu(&cpu[cpu_id], cpu_id, NULL); | 405 | register_cpu(&cpu[cpu_id], cpu_id); |
406 | 406 | ||
407 | return 0; | 407 | return 0; |
408 | } | 408 | } |
diff --git a/arch/sh64/kernel/setup.c b/arch/sh64/kernel/setup.c index d2711c9c9d13..da98d8dbcf95 100644 --- a/arch/sh64/kernel/setup.c +++ b/arch/sh64/kernel/setup.c | |||
@@ -309,7 +309,7 @@ static struct cpu cpu[1]; | |||
309 | 309 | ||
310 | static int __init topology_init(void) | 310 | static int __init topology_init(void) |
311 | { | 311 | { |
312 | return register_cpu(cpu, 0, NULL); | 312 | return register_cpu(cpu, 0); |
313 | } | 313 | } |
314 | 314 | ||
315 | subsys_initcall(topology_init); | 315 | subsys_initcall(topology_init); |
diff --git a/arch/sparc64/kernel/setup.c b/arch/sparc64/kernel/setup.c index a6a7d8168346..116d9632002d 100644 --- a/arch/sparc64/kernel/setup.c +++ b/arch/sparc64/kernel/setup.c | |||
@@ -537,7 +537,7 @@ static int __init topology_init(void) | |||
537 | for_each_possible_cpu(i) { | 537 | for_each_possible_cpu(i) { |
538 | struct cpu *p = kzalloc(sizeof(*p), GFP_KERNEL); | 538 | struct cpu *p = kzalloc(sizeof(*p), GFP_KERNEL); |
539 | if (p) { | 539 | if (p) { |
540 | register_cpu(p, i, NULL); | 540 | register_cpu(p, i); |
541 | err = 0; | 541 | err = 0; |
542 | } | 542 | } |
543 | } | 543 | } |