aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2012-04-20 09:05:52 -0400
committerThomas Gleixner <tglx@linutronix.de>2012-04-26 06:06:11 -0400
commite80e7813cd772cf30597024b371e73df9736de8d (patch)
tree8d9fd073b47120099cd34cc585082b7836f36fe2
parent3b0132ce4fff68b30abdfcb74cffc283af711076 (diff)
s390: Use generic idle thread allocation
Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Rusty Russell <rusty@rustcorp.com.au> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com> Acked-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Link: http://lkml.kernel.org/r/20120420124557.652574928@linutronix.de
-rw-r--r--arch/s390/Kconfig1
-rw-r--r--arch/s390/kernel/smp.c33
2 files changed, 3 insertions, 31 deletions
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 9015060919a0..15cab3ee44e8 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -122,6 +122,7 @@ config S390
122 select ARCH_INLINE_WRITE_UNLOCK_BH 122 select ARCH_INLINE_WRITE_UNLOCK_BH
123 select ARCH_INLINE_WRITE_UNLOCK_IRQ 123 select ARCH_INLINE_WRITE_UNLOCK_IRQ
124 select ARCH_INLINE_WRITE_UNLOCK_IRQRESTORE 124 select ARCH_INLINE_WRITE_UNLOCK_IRQRESTORE
125 select GENERIC_SMP_IDLE_THREAD
125 126
126config SCHED_OMIT_FRAME_POINTER 127config SCHED_OMIT_FRAME_POINTER
127 def_bool y 128 def_bool y
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index fc827aa8f9ca..992b7b93a574 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -85,7 +85,6 @@ enum {
85 85
86struct pcpu { 86struct pcpu {
87 struct cpu cpu; 87 struct cpu cpu;
88 struct task_struct *idle; /* idle process for the cpu */
89 struct _lowcore *lowcore; /* lowcore page(s) for the cpu */ 88 struct _lowcore *lowcore; /* lowcore page(s) for the cpu */
90 unsigned long async_stack; /* async stack for the cpu */ 89 unsigned long async_stack; /* async stack for the cpu */
91 unsigned long panic_stack; /* panic stack for the cpu */ 90 unsigned long panic_stack; /* panic stack for the cpu */
@@ -721,26 +720,9 @@ static void __cpuinit smp_start_secondary(void *cpuvoid)
721 cpu_idle(); 720 cpu_idle();
722} 721}
723 722
724struct create_idle {
725 struct work_struct work;
726 struct task_struct *idle;
727 struct completion done;
728 int cpu;
729};
730
731static void __cpuinit smp_fork_idle(struct work_struct *work)
732{
733 struct create_idle *c_idle;
734
735 c_idle = container_of(work, struct create_idle, work);
736 c_idle->idle = fork_idle(c_idle->cpu);
737 complete(&c_idle->done);
738}
739
740/* Upping and downing of CPUs */ 723/* Upping and downing of CPUs */
741int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle) 724int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle)
742{ 725{
743 struct create_idle c_idle;
744 struct pcpu *pcpu; 726 struct pcpu *pcpu;
745 int rc; 727 int rc;
746 728
@@ -750,22 +732,12 @@ int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle)
750 if (pcpu_sigp_retry(pcpu, sigp_initial_cpu_reset, 0) != 732 if (pcpu_sigp_retry(pcpu, sigp_initial_cpu_reset, 0) !=
751 sigp_order_code_accepted) 733 sigp_order_code_accepted)
752 return -EIO; 734 return -EIO;
753 if (!pcpu->idle) { 735
754 c_idle.done = COMPLETION_INITIALIZER_ONSTACK(c_idle.done);
755 INIT_WORK_ONSTACK(&c_idle.work, smp_fork_idle);
756 c_idle.cpu = cpu;
757 schedule_work(&c_idle.work);
758 wait_for_completion(&c_idle.done);
759 if (IS_ERR(c_idle.idle))
760 return PTR_ERR(c_idle.idle);
761 pcpu->idle = c_idle.idle;
762 }
763 init_idle(pcpu->idle, cpu);
764 rc = pcpu_alloc_lowcore(pcpu, cpu); 736 rc = pcpu_alloc_lowcore(pcpu, cpu);
765 if (rc) 737 if (rc)
766 return rc; 738 return rc;
767 pcpu_prepare_secondary(pcpu, cpu); 739 pcpu_prepare_secondary(pcpu, cpu);
768 pcpu_attach_task(pcpu, pcpu->idle); 740 pcpu_attach_task(pcpu, tidle);
769 pcpu_start_fn(pcpu, smp_start_secondary, NULL); 741 pcpu_start_fn(pcpu, smp_start_secondary, NULL);
770 while (!cpu_online(cpu)) 742 while (!cpu_online(cpu))
771 cpu_relax(); 743 cpu_relax();
@@ -852,7 +824,6 @@ void __init smp_prepare_boot_cpu(void)
852 struct pcpu *pcpu = pcpu_devices; 824 struct pcpu *pcpu = pcpu_devices;
853 825
854 boot_cpu_address = stap(); 826 boot_cpu_address = stap();
855 pcpu->idle = current;
856 pcpu->state = CPU_STATE_CONFIGURED; 827 pcpu->state = CPU_STATE_CONFIGURED;
857 pcpu->address = boot_cpu_address; 828 pcpu->address = boot_cpu_address;
858 pcpu->lowcore = (struct _lowcore *)(unsigned long) store_prefix(); 829 pcpu->lowcore = (struct _lowcore *)(unsigned long) store_prefix();