Commit da7f51c1 authored by Heiko Carstens's avatar Heiko Carstens Committed by Martin Schwidefsky

[S390] smp/idle: call init_idle() before starting a new cpu

Call init_idle() which (re-)initializes the idle task structure before
it gets used on a new cpu.
That way we can also get rid of the odd preempt_enable_no_resched()
call we have in the cpu offline path within cpu_idle(). That call
prevented preempt count imbalances between cpu hotplug operations.
Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent f230886b
...@@ -20,7 +20,6 @@ extern void machine_power_off_smp(void); ...@@ -20,7 +20,6 @@ extern void machine_power_off_smp(void);
extern int __cpu_disable (void); extern int __cpu_disable (void);
extern void __cpu_die (unsigned int cpu); extern void __cpu_die (unsigned int cpu);
extern void cpu_die (void) __attribute__ ((noreturn));
extern int __cpu_up (unsigned int cpu); extern int __cpu_up (unsigned int cpu);
extern struct mutex smp_cpu_state_mutex; extern struct mutex smp_cpu_state_mutex;
...@@ -71,8 +70,10 @@ static inline void smp_switch_to_ipl_cpu(void (*func)(void *), void *data) ...@@ -71,8 +70,10 @@ static inline void smp_switch_to_ipl_cpu(void (*func)(void *), void *data)
#ifdef CONFIG_HOTPLUG_CPU #ifdef CONFIG_HOTPLUG_CPU
extern int smp_rescan_cpus(void); extern int smp_rescan_cpus(void);
extern void __noreturn cpu_die(void);
#else #else
static inline int smp_rescan_cpus(void) { return 0; } static inline int smp_rescan_cpus(void) { return 0; }
static inline void cpu_die(void) { }
#endif #endif
#endif /* __ASM_SMP_H */ #endif /* __ASM_SMP_H */
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
#include <asm/irq.h> #include <asm/irq.h>
#include <asm/timer.h> #include <asm/timer.h>
#include <asm/nmi.h> #include <asm/nmi.h>
#include <asm/smp.h>
#include "entry.h" #include "entry.h"
asmlinkage void ret_from_fork(void) asm ("ret_from_fork"); asmlinkage void ret_from_fork(void) asm ("ret_from_fork");
...@@ -76,13 +77,8 @@ unsigned long thread_saved_pc(struct task_struct *tsk) ...@@ -76,13 +77,8 @@ unsigned long thread_saved_pc(struct task_struct *tsk)
*/ */
static void default_idle(void) static void default_idle(void)
{ {
/* CPU is going idle. */ if (cpu_is_offline(smp_processor_id()))
#ifdef CONFIG_HOTPLUG_CPU
if (cpu_is_offline(smp_processor_id())) {
preempt_enable_no_resched();
cpu_die(); cpu_die();
}
#endif
local_irq_disable(); local_irq_disable();
if (need_resched()) { if (need_resched()) {
local_irq_enable(); local_irq_enable();
......
...@@ -575,6 +575,7 @@ int __cpuinit __cpu_up(unsigned int cpu) ...@@ -575,6 +575,7 @@ int __cpuinit __cpu_up(unsigned int cpu)
idle = c_idle.idle; idle = c_idle.idle;
current_set[cpu] = c_idle.idle; current_set[cpu] = c_idle.idle;
} }
init_idle(idle, cpu);
if (smp_alloc_lowcore(cpu)) if (smp_alloc_lowcore(cpu))
return -ENOMEM; return -ENOMEM;
do { do {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment