Commit 52a616fb authored by Andi Kleen's avatar Andi Kleen Committed by Linus Torvalds

[PATCH] x86_64: Add reboot=force

Add reboot=force

reboot=force doesn't wait for any other CPUs on reboot.  This is useful when
you really need a system to reboot on its own.
Signed-off-by: default avatarAndi Kleen <ak@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 3acf2ad9
...@@ -26,12 +26,14 @@ static enum { ...@@ -26,12 +26,14 @@ static enum {
BOOT_KBD = 'k' BOOT_KBD = 'k'
} reboot_type = BOOT_KBD; } reboot_type = BOOT_KBD;
static int reboot_mode = 0; static int reboot_mode = 0;
int reboot_force;
/* reboot=t[riple] | k[bd] [, [w]arm | [c]old] /* reboot=t[riple] | k[bd] [, [w]arm | [c]old]
warm Don't set the cold reboot flag warm Don't set the cold reboot flag
cold Set the cold reboot flag cold Set the cold reboot flag
triple Force a triple fault (init) triple Force a triple fault (init)
kbd Use the keyboard controller. cold reset (default) kbd Use the keyboard controller. cold reset (default)
force Avoid anything that could hang.
*/ */
static int __init reboot_setup(char *str) static int __init reboot_setup(char *str)
{ {
...@@ -50,6 +52,9 @@ static int __init reboot_setup(char *str) ...@@ -50,6 +52,9 @@ static int __init reboot_setup(char *str)
case 'k': case 'k':
reboot_type = *str; reboot_type = *str;
break; break;
case 'f':
reboot_force = 1;
break;
} }
if((str = strchr(str,',')) != NULL) if((str = strchr(str,',')) != NULL)
str++; str++;
...@@ -67,6 +72,9 @@ static void smp_halt(void) ...@@ -67,6 +72,9 @@ static void smp_halt(void)
int cpuid = safe_smp_processor_id(); int cpuid = safe_smp_processor_id();
static int first_entry = 1; static int first_entry = 1;
if (reboot_force)
return;
if (first_entry) { if (first_entry) {
first_entry = 0; first_entry = 0;
smp_call_function((void *)machine_restart, NULL, 1, 0); smp_call_function((void *)machine_restart, NULL, 1, 0);
...@@ -99,19 +107,20 @@ void machine_restart(char * __unused) ...@@ -99,19 +107,20 @@ void machine_restart(char * __unused)
{ {
int i; int i;
printk("machine restart\n");
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
smp_halt(); smp_halt();
#endif #endif
if (!reboot_force) {
local_irq_disable(); local_irq_disable();
#ifndef CONFIG_SMP #ifndef CONFIG_SMP
disable_local_APIC(); disable_local_APIC();
#endif #endif
disable_IO_APIC(); disable_IO_APIC();
local_irq_enable(); local_irq_enable();
}
/* Tell the BIOS if we want cold or warm reboot */ /* Tell the BIOS if we want cold or warm reboot */
*((unsigned short *)__va(0x472)) = reboot_mode; *((unsigned short *)__va(0x472)) = reboot_mode;
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <asm/pgalloc.h> #include <asm/pgalloc.h>
#include <asm/tlbflush.h> #include <asm/tlbflush.h>
#include <asm/mach_apic.h> #include <asm/mach_apic.h>
#include <asm/proto.h>
/* /*
* Smarter SMP flushing macros. * Smarter SMP flushing macros.
...@@ -361,6 +362,8 @@ static void smp_really_stop_cpu(void *dummy) ...@@ -361,6 +362,8 @@ static void smp_really_stop_cpu(void *dummy)
void smp_send_stop(void) void smp_send_stop(void)
{ {
int nolock = 0; int nolock = 0;
if (reboot_force)
return;
/* Don't deadlock on the call lock in panic */ /* Don't deadlock on the call lock in panic */
if (!spin_trylock(&call_lock)) { if (!spin_trylock(&call_lock)) {
/* ignore locking because we have paniced anyways */ /* ignore locking because we have paniced anyways */
......
...@@ -108,6 +108,8 @@ extern int iommu_aperture_allowed; ...@@ -108,6 +108,8 @@ extern int iommu_aperture_allowed;
extern int fix_aperture; extern int fix_aperture;
extern int force_iommu; extern int force_iommu;
extern int reboot_force;
extern void smp_local_timer_interrupt(struct pt_regs * regs); extern void smp_local_timer_interrupt(struct pt_regs * regs);
long do_arch_prctl(struct task_struct *task, int code, unsigned long addr); long do_arch_prctl(struct task_struct *task, int code, unsigned long addr);
......
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