Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/smp: add generic_set_cpu_up() to set cpu_state as CPU_UP_PREPARE

In the case of cpu hotplug, the cpu_state should be set to CPU_UP_PREPARE
when kicking cpu. Otherwise, the cpu_state is always CPU_DEAD after
calling generic_set_cpu_dead(), which makes the delay in generic_cpu_die()
not happen.

Signed-off-by: Zhao Chenhui <chenhui.zhao@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>

authored by

Zhao Chenhui and committed by
Kumar Gala
ae5cab47 15f34eb1

+12 -1
+1
arch/powerpc/include/asm/smp.h
··· 65 65 void generic_cpu_die(unsigned int cpu); 66 66 void generic_mach_cpu_die(void); 67 67 void generic_set_cpu_dead(unsigned int cpu); 68 + void generic_set_cpu_up(unsigned int cpu); 68 69 int generic_check_cpu_restart(unsigned int cpu); 69 70 #endif 70 71
+11 -1
arch/powerpc/kernel/smp.c
··· 102 102 * Ok it's not there, so it might be soft-unplugged, let's 103 103 * try to bring it back 104 104 */ 105 - per_cpu(cpu_state, nr) = CPU_UP_PREPARE; 105 + generic_set_cpu_up(nr); 106 106 smp_wmb(); 107 107 smp_send_reschedule(nr); 108 108 #endif /* CONFIG_HOTPLUG_CPU */ ··· 411 411 void generic_set_cpu_dead(unsigned int cpu) 412 412 { 413 413 per_cpu(cpu_state, cpu) = CPU_DEAD; 414 + } 415 + 416 + /* 417 + * The cpu_state should be set to CPU_UP_PREPARE in kick_cpu(), otherwise 418 + * the cpu_state is always CPU_DEAD after calling generic_set_cpu_dead(), 419 + * which makes the delay in generic_cpu_die() not happen. 420 + */ 421 + void generic_set_cpu_up(unsigned int cpu) 422 + { 423 + per_cpu(cpu_state, cpu) = CPU_UP_PREPARE; 414 424 } 415 425 416 426 int generic_check_cpu_restart(unsigned int cpu)