[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH] shutdown.c - halt_action
It's not always desirable for a system to halt. The hypervisor has a number of places where it does request a halt, and this might be useful for debugging, but not always in a production environment. Add a hypervisor command line parameter, halt_action, which allows the overriding of any halt requests. The parameter takes the form of halt_action=halt, halt_action=reboot or halt_action=reboot:20 for halting, rebooting after a default 10 seconds, or rebooting after a specified number of seconds. The default is halt_action=halt and preserves existing behavior. Signed-off-by: Ben Thomas (ben@xxxxxxxxxxxxxxx) -- ------------------------------------------------------------------------ Ben Thomas Virtual Iron Software bthomas@xxxxxxxxxxxxxxx Tower 1, Floor 2 978-849-1214 900 Chelmsford Street Lowell, MA 01851 # It's not always desirable for a system to halt. The hypervisor has a # number of places where it does request a halt, and this might be useful # for debugging, but not always in a production environment. Add a # hypervisor command line parameter, halt_action, which allows the # overriding of any halt requests. The parameter takes the form of # halt_action=halt, halt_action=reboot or halt_action=reboot:20 # for halting, rebooting after a default 10 seconds, or rebooting after # a specified number of seconds. The default preserves is halt_action=halt # and preserves existing behavior. # # Signed-off-by: Ben Thomas (ben@xxxxxxxxxxxxxxx) Index: xen-unstable.hg/xen/arch/x86/shutdown.c =================================================================== --- xen-unstable.hg.orig/xen/arch/x86/shutdown.c 2006-10-26 10:56:41.000000000 -0400 +++ xen-unstable.hg/xen/arch/x86/shutdown.c 2006-10-30 11:17:59.000000000 -0500 @@ -29,6 +29,29 @@ static long no_idt[2]; static int reboot_mode; +void machine_restart(char * __unused); + +enum {HALT_ACTION_HALT, HALT_ACTION_REBOOT}; +static int halt_action = HALT_ACTION_HALT; +static long halt_action_wait = 10; + +static void __init halt_action_set(char *str) +{ + if (strcmp(str, "halt") == 0) + halt_action = HALT_ACTION_HALT; + else if (strncmp(str, "reboot", strlen("reboot")) == 0) + { + halt_action = HALT_ACTION_REBOOT; + str += strlen("reboot"); + if (*str == ':') + halt_action_wait = simple_strtol(++str, NULL, 10); + else + halt_action_wait = 10; + } else + printk("halt_action '%s' not recognized", str); +} +custom_param("halt_action", halt_action_set); + static inline void kb_wait(void) { int i; @@ -48,6 +71,19 @@ { watchdog_disable(); console_start_sync(); + if (halt_action != HALT_ACTION_HALT) + { + printk("%s - reboot requested\n", __FUNCTION__); + halt_action = HALT_ACTION_HALT; // We may end up back here - don't loop + if (halt_action_wait > 0) + { + printk("%s - delay %ld seconds before reboot...\n", __FUNCTION__, halt_action_wait); + mdelay(halt_action_wait * 1000); + } + printk("%s - rebooting...\n", __FUNCTION__); + machine_restart(0); + // We shouldn't get back here, but if we do just halt + } smp_call_function(__machine_halt, NULL, 1, 0); __machine_halt(NULL); } _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |