diff options
Diffstat (limited to 'arch/ia64/kernel/smpboot.c')
-rw-r--r-- | arch/ia64/kernel/smpboot.c | 63 |
1 files changed, 4 insertions, 59 deletions
diff --git a/arch/ia64/kernel/smpboot.c b/arch/ia64/kernel/smpboot.c index 796f6a5b966a..1113b8aba07f 100644 --- a/arch/ia64/kernel/smpboot.c +++ b/arch/ia64/kernel/smpboot.c | |||
@@ -75,13 +75,6 @@ | |||
75 | #endif | 75 | #endif |
76 | 76 | ||
77 | /* | 77 | /* |
78 | * Store all idle threads, this can be reused instead of creating | ||
79 | * a new thread. Also avoids complicated thread destroy functionality | ||
80 | * for idle threads. | ||
81 | */ | ||
82 | struct task_struct *idle_thread_array[NR_CPUS]; | ||
83 | |||
84 | /* | ||
85 | * Global array allocated for NR_CPUS at boot time | 78 | * Global array allocated for NR_CPUS at boot time |
86 | */ | 79 | */ |
87 | struct sal_to_os_boot sal_boot_rendez_state[NR_CPUS]; | 80 | struct sal_to_os_boot sal_boot_rendez_state[NR_CPUS]; |
@@ -94,13 +87,7 @@ struct sal_to_os_boot *sal_state_for_booting_cpu = &sal_boot_rendez_state[0]; | |||
94 | 87 | ||
95 | #define set_brendez_area(x) (sal_state_for_booting_cpu = &sal_boot_rendez_state[(x)]); | 88 | #define set_brendez_area(x) (sal_state_for_booting_cpu = &sal_boot_rendez_state[(x)]); |
96 | 89 | ||
97 | #define get_idle_for_cpu(x) (idle_thread_array[(x)]) | ||
98 | #define set_idle_for_cpu(x,p) (idle_thread_array[(x)] = (p)) | ||
99 | |||
100 | #else | 90 | #else |
101 | |||
102 | #define get_idle_for_cpu(x) (NULL) | ||
103 | #define set_idle_for_cpu(x,p) | ||
104 | #define set_brendez_area(x) | 91 | #define set_brendez_area(x) |
105 | #endif | 92 | #endif |
106 | 93 | ||
@@ -480,54 +467,12 @@ struct pt_regs * __cpuinit idle_regs(struct pt_regs *regs) | |||
480 | return NULL; | 467 | return NULL; |
481 | } | 468 | } |
482 | 469 | ||
483 | struct create_idle { | ||
484 | struct work_struct work; | ||
485 | struct task_struct *idle; | ||
486 | struct completion done; | ||
487 | int cpu; | ||
488 | }; | ||
489 | |||
490 | void __cpuinit | ||
491 | do_fork_idle(struct work_struct *work) | ||
492 | { | ||
493 | struct create_idle *c_idle = | ||
494 | container_of(work, struct create_idle, work); | ||
495 | |||
496 | c_idle->idle = fork_idle(c_idle->cpu); | ||
497 | complete(&c_idle->done); | ||
498 | } | ||
499 | |||
500 | static int __cpuinit | 470 | static int __cpuinit |
501 | do_boot_cpu (int sapicid, int cpu) | 471 | do_boot_cpu (int sapicid, int cpu, struct task_struct *idle) |
502 | { | 472 | { |
503 | int timeout; | 473 | int timeout; |
504 | struct create_idle c_idle = { | ||
505 | .work = __WORK_INITIALIZER(c_idle.work, do_fork_idle), | ||
506 | .cpu = cpu, | ||
507 | .done = COMPLETION_INITIALIZER(c_idle.done), | ||
508 | }; | ||
509 | |||
510 | /* | ||
511 | * We can't use kernel_thread since we must avoid to | ||
512 | * reschedule the child. | ||
513 | */ | ||
514 | c_idle.idle = get_idle_for_cpu(cpu); | ||
515 | if (c_idle.idle) { | ||
516 | init_idle(c_idle.idle, cpu); | ||
517 | goto do_rest; | ||
518 | } | ||
519 | |||
520 | schedule_work(&c_idle.work); | ||
521 | wait_for_completion(&c_idle.done); | ||
522 | |||
523 | if (IS_ERR(c_idle.idle)) | ||
524 | panic("failed fork for CPU %d", cpu); | ||
525 | |||
526 | set_idle_for_cpu(cpu, c_idle.idle); | ||
527 | |||
528 | do_rest: | ||
529 | task_for_booting_cpu = c_idle.idle; | ||
530 | 474 | ||
475 | task_for_booting_cpu = idle; | ||
531 | Dprintk("Sending wakeup vector %lu to AP 0x%x/0x%x.\n", ap_wakeup_vector, cpu, sapicid); | 476 | Dprintk("Sending wakeup vector %lu to AP 0x%x/0x%x.\n", ap_wakeup_vector, cpu, sapicid); |
532 | 477 | ||
533 | set_brendez_area(cpu); | 478 | set_brendez_area(cpu); |
@@ -793,7 +738,7 @@ set_cpu_sibling_map(int cpu) | |||
793 | } | 738 | } |
794 | 739 | ||
795 | int __cpuinit | 740 | int __cpuinit |
796 | __cpu_up (unsigned int cpu) | 741 | __cpu_up(unsigned int cpu, struct task_struct *tidle) |
797 | { | 742 | { |
798 | int ret; | 743 | int ret; |
799 | int sapicid; | 744 | int sapicid; |
@@ -811,7 +756,7 @@ __cpu_up (unsigned int cpu) | |||
811 | 756 | ||
812 | per_cpu(cpu_state, cpu) = CPU_UP_PREPARE; | 757 | per_cpu(cpu_state, cpu) = CPU_UP_PREPARE; |
813 | /* Processor goes to start_secondary(), sets online flag */ | 758 | /* Processor goes to start_secondary(), sets online flag */ |
814 | ret = do_boot_cpu(sapicid, cpu); | 759 | ret = do_boot_cpu(sapicid, cpu, tidle); |
815 | if (ret < 0) | 760 | if (ret < 0) |
816 | return ret; | 761 | return ret; |
817 | 762 | ||