Skip to content

Commit

Permalink
kexec: migrate to reboot cpu
Browse files Browse the repository at this point in the history
Commit 1b3a5d0 ("reboot: move arch/x86 reboot= handling to generic
kernel") moved reboot= handling to generic code.  In the process it also
removed the code in native_machine_shutdown() which are moving reboot
process to reboot_cpu/cpu0.

I guess that thought must have been that all reboot paths are calling
migrate_to_reboot_cpu(), so we don't need this special handling.  But
kexec reboot path (kernel_kexec()) is not calling
migrate_to_reboot_cpu() so above change broke kexec.  Now reboot can
happen on non-boot cpu and when INIT is sent in second kerneo to bring
up BP, it brings down the machine.

So start calling migrate_to_reboot_cpu() in kexec reboot path to avoid
this problem.

Bisected by WANG Chao.

Reported-by: Matthew Whitehead <[email protected]>
Reported-by: Dave Young <[email protected]>
Signed-off-by: Vivek Goyal <[email protected]>
Tested-by: Baoquan He <[email protected]>
Tested-by: WANG Chao <[email protected]>
Acked-by: H. Peter Anvin <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
rhvgoyal authored and torvalds committed Dec 19, 2013
1 parent b0031f2 commit c97102b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions include/linux/reboot.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ extern int unregister_reboot_notifier(struct notifier_block *);
* Architecture-specific implementations of sys_reboot commands.
*/

extern void migrate_to_reboot_cpu(void);
extern void machine_restart(char *cmd);
extern void machine_halt(void);
extern void machine_power_off(void);
Expand Down
1 change: 1 addition & 0 deletions kernel/kexec.c
Original file line number Diff line number Diff line change
Expand Up @@ -1680,6 +1680,7 @@ int kernel_kexec(void)
{
kexec_in_progress = true;
kernel_restart_prepare(NULL);
migrate_to_reboot_cpu();
printk(KERN_EMERG "Starting new kernel\n");
machine_shutdown();
}
Expand Down
2 changes: 1 addition & 1 deletion kernel/reboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ int unregister_reboot_notifier(struct notifier_block *nb)
}
EXPORT_SYMBOL(unregister_reboot_notifier);

static void migrate_to_reboot_cpu(void)
void migrate_to_reboot_cpu(void)
{
/* The boot cpu is always logical cpu 0 */
int cpu = reboot_cpu;
Expand Down

0 comments on commit c97102b

Please sign in to comment.