[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] [XEN] Clean up shutdown handling and ignore opt_noreboot if dom0
# HG changeset patch # User kaf24@xxxxxxxxxxxxxxxxxxxx # Node ID 16aa4b417c6b97c9378b4b44df57fc3bd3b1d2be # Parent 353404fe850c40569d04972ccc8929dc9948b9d8 [XEN] Clean up shutdown handling and ignore opt_noreboot if dom0 shuts down cleanly. The option is intended only to retain information on the local console in case of a crash. Based on a patch from Muli Ben-Yehuda <muli@xxxxxxxxxx> Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx> --- xen/include/xen/reboot.h | 8 ---- xen/arch/ia64/linux-xen/setup.c | 2 - xen/arch/powerpc/domain.c | 2 - xen/arch/x86/genapic/es7000plat.c | 1 xen/arch/x86/shutdown.c | 17 ++------- xen/arch/x86/traps.c | 2 - xen/arch/x86/x86_32/traps.c | 2 - xen/arch/x86/x86_64/traps.c | 2 - xen/common/Makefile | 1 xen/common/domain.c | 27 +-------------- xen/common/keyhandler.c | 2 - xen/common/shutdown.c | 66 ++++++++++++++++++++++++++++++++++++++ xen/drivers/char/console.c | 19 ++++++++-- xen/drivers/char/serial.c | 1 xen/include/xen/shutdown.h | 13 +++++++ 15 files changed, 107 insertions(+), 58 deletions(-) diff -r 353404fe850c -r 16aa4b417c6b xen/arch/ia64/linux-xen/setup.c --- a/xen/arch/ia64/linux-xen/setup.c Mon Aug 07 11:59:31 2006 +0100 +++ b/xen/arch/ia64/linux-xen/setup.c Mon Aug 07 15:35:06 2006 +0100 @@ -31,7 +31,7 @@ #include <linux/console.h> #include <linux/delay.h> #include <linux/kernel.h> -#include <linux/reboot.h> +#include <linux/shutdown.h> #include <linux/sched.h> #include <linux/seq_file.h> #include <linux/string.h> diff -r 353404fe850c -r 16aa4b417c6b xen/arch/powerpc/domain.c --- a/xen/arch/powerpc/domain.c Mon Aug 07 11:59:31 2006 +0100 +++ b/xen/arch/powerpc/domain.c Mon Aug 07 15:35:06 2006 +0100 @@ -26,7 +26,7 @@ #include <xen/serial.h> #include <xen/domain.h> #include <xen/console.h> -#include <xen/reboot.h> +#include <xen/shutdown.h> #include <asm/htab.h> #include <asm/current.h> #include <asm/hcalls.h> diff -r 353404fe850c -r 16aa4b417c6b xen/arch/x86/genapic/es7000plat.c --- a/xen/arch/x86/genapic/es7000plat.c Mon Aug 07 11:59:31 2006 +0100 +++ b/xen/arch/x86/genapic/es7000plat.c Mon Aug 07 15:35:06 2006 +0100 @@ -31,7 +31,6 @@ #include <xen/string.h> #include <xen/spinlock.h> #include <xen/errno.h> -#include <xen/reboot.h> #include <xen/init.h> #include <xen/acpi.h> #include <asm/io.h> diff -r 353404fe850c -r 16aa4b417c6b xen/arch/x86/shutdown.c --- a/xen/arch/x86/shutdown.c Mon Aug 07 11:59:31 2006 +0100 +++ b/xen/arch/x86/shutdown.c Mon Aug 07 15:35:06 2006 +0100 @@ -11,19 +11,16 @@ #include <xen/smp.h> #include <xen/delay.h> #include <xen/dmi.h> +#include <xen/irq.h> +#include <xen/console.h> +#include <xen/shutdown.h> +#include <asm/msr.h> #include <asm/regs.h> #include <asm/mc146818rtc.h> #include <asm/system.h> #include <asm/io.h> #include <asm/processor.h> #include <asm/mpspec.h> -#include <xen/irq.h> -#include <xen/console.h> -#include <asm/msr.h> - -/* opt_noreboot: If true, machine will need manual reset on error. */ -static int opt_noreboot = 0; -boolean_param("noreboot", opt_noreboot); /* reboot_str: comma-separated list of reboot options. */ static char __initdata reboot_str[10] = ""; @@ -204,12 +201,6 @@ void machine_restart(char * __unused) { int i; - if ( opt_noreboot ) - { - printk("Reboot disabled on cmdline: require manual reset\n"); - machine_halt(); - } - watchdog_disable(); console_start_sync(); diff -r 353404fe850c -r 16aa4b417c6b xen/arch/x86/traps.c --- a/xen/arch/x86/traps.c Mon Aug 07 11:59:31 2006 +0100 +++ b/xen/arch/x86/traps.c Mon Aug 07 15:35:06 2006 +0100 @@ -32,7 +32,7 @@ #include <xen/errno.h> #include <xen/mm.h> #include <xen/console.h> -#include <xen/reboot.h> +#include <xen/shutdown.h> #include <asm/regs.h> #include <xen/delay.h> #include <xen/event.h> diff -r 353404fe850c -r 16aa4b417c6b xen/arch/x86/x86_32/traps.c --- a/xen/arch/x86/x86_32/traps.c Mon Aug 07 11:59:31 2006 +0100 +++ b/xen/arch/x86/x86_32/traps.c Mon Aug 07 15:35:06 2006 +0100 @@ -9,7 +9,7 @@ #include <xen/mm.h> #include <xen/irq.h> #include <xen/symbols.h> -#include <xen/reboot.h> +#include <xen/shutdown.h> #include <xen/nmi.h> #include <asm/current.h> #include <asm/flushtlb.h> diff -r 353404fe850c -r 16aa4b417c6b xen/arch/x86/x86_64/traps.c --- a/xen/arch/x86/x86_64/traps.c Mon Aug 07 11:59:31 2006 +0100 +++ b/xen/arch/x86/x86_64/traps.c Mon Aug 07 15:35:06 2006 +0100 @@ -10,7 +10,7 @@ #include <xen/symbols.h> #include <xen/console.h> #include <xen/sched.h> -#include <xen/reboot.h> +#include <xen/shutdown.h> #include <xen/nmi.h> #include <asm/current.h> #include <asm/flushtlb.h> diff -r 353404fe850c -r 16aa4b417c6b xen/common/Makefile --- a/xen/common/Makefile Mon Aug 07 11:59:31 2006 +0100 +++ b/xen/common/Makefile Mon Aug 07 15:35:06 2006 +0100 @@ -16,6 +16,7 @@ obj-y += sched_credit.o obj-y += sched_credit.o obj-y += sched_sedf.o obj-y += schedule.o +obj-y += shutdown.o obj-y += softirq.o obj-y += string.o obj-y += symbols.o diff -r 353404fe850c -r 16aa4b417c6b xen/common/domain.c --- a/xen/common/domain.c Mon Aug 07 11:59:31 2006 +0100 +++ b/xen/common/domain.c Mon Aug 07 15:35:06 2006 +0100 @@ -20,6 +20,7 @@ #include <xen/guest_access.h> #include <xen/hypercall.h> #include <xen/delay.h> +#include <xen/shutdown.h> #include <asm/debugger.h> #include <public/dom0_ops.h> #include <public/sched.h> @@ -282,36 +283,12 @@ static __init int domain_shutdown_finali } __initcall(domain_shutdown_finaliser_init); - void domain_shutdown(struct domain *d, u8 reason) { struct vcpu *v; if ( d->domain_id == 0 ) - { - extern void machine_restart(char *); - extern void machine_halt(void); - - debugger_trap_immediate(); - - if ( reason == SHUTDOWN_poweroff ) - { - printk("Domain 0 halted: halting machine.\n"); - machine_halt(); - } - else if ( reason == SHUTDOWN_crash ) - { - printk("Domain 0 crashed: rebooting machine in 5 seconds.\n"); - watchdog_disable(); - mdelay(5000); - machine_restart(0); - } - else - { - printk("Domain 0 shutdown: rebooting machine.\n"); - machine_restart(0); - } - } + dom0_shutdown(reason); /* Mark the domain as shutting down. */ d->shutdown_code = reason; diff -r 353404fe850c -r 16aa4b417c6b xen/common/keyhandler.c --- a/xen/common/keyhandler.c Mon Aug 07 11:59:31 2006 +0100 +++ b/xen/common/keyhandler.c Mon Aug 07 15:35:06 2006 +0100 @@ -4,7 +4,7 @@ #include <asm/regs.h> #include <xen/keyhandler.h> -#include <xen/reboot.h> +#include <xen/shutdown.h> #include <xen/event.h> #include <xen/console.h> #include <xen/serial.h> diff -r 353404fe850c -r 16aa4b417c6b xen/drivers/char/console.c --- a/xen/drivers/char/console.c Mon Aug 07 11:59:31 2006 +0100 +++ b/xen/drivers/char/console.c Mon Aug 07 15:35:06 2006 +0100 @@ -21,6 +21,7 @@ #include <xen/mm.h> #include <xen/delay.h> #include <xen/guest_access.h> +#include <xen/shutdown.h> #include <asm/current.h> #include <asm/debugger.h> #include <asm/io.h> @@ -730,14 +731,24 @@ void panic(const char *fmt, ...) printk("Panic on CPU %d:\n", smp_processor_id()); printk(buf); printk("****************************************\n\n"); - printk("Reboot in five seconds...\n"); + if ( opt_noreboot ) + printk("Manual reset required ('noreboot' specified)\n"); + else + printk("Reboot in five seconds...\n"); spin_unlock_irqrestore(&lock, flags); debugger_trap_immediate(); - watchdog_disable(); - mdelay(5000); - machine_restart(0); + if ( opt_noreboot ) + { + machine_halt(); + } + else + { + watchdog_disable(); + mdelay(5000); + machine_restart(NULL); + } } void __bug(char *file, int line) diff -r 353404fe850c -r 16aa4b417c6b xen/drivers/char/serial.c --- a/xen/drivers/char/serial.c Mon Aug 07 11:59:31 2006 +0100 +++ b/xen/drivers/char/serial.c Mon Aug 07 15:35:06 2006 +0100 @@ -11,7 +11,6 @@ #include <xen/init.h> #include <xen/irq.h> #include <xen/keyhandler.h> -#include <xen/reboot.h> #include <xen/sched.h> #include <xen/serial.h> diff -r 353404fe850c -r 16aa4b417c6b xen/common/shutdown.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xen/common/shutdown.c Mon Aug 07 15:35:06 2006 +0100 @@ -0,0 +1,66 @@ +#include <xen/config.h> +#include <xen/init.h> +#include <xen/lib.h> +#include <xen/sched.h> +#include <xen/domain.h> +#include <xen/delay.h> +#include <xen/shutdown.h> +#include <asm/debugger.h> +#include <public/sched.h> + +/* opt_noreboot: If true, machine will need manual reset on error. */ +int opt_noreboot; +boolean_param("noreboot", opt_noreboot); + +static void maybe_reboot(void) +{ + if ( opt_noreboot ) + { + printk("'noreboot' set - not rebooting.\n"); + machine_halt(); + } + else + { + printk("rebooting machine in 5 seconds.\n"); + watchdog_disable(); + mdelay(5000); + machine_restart(NULL); + } +} + +void dom0_shutdown(u8 reason) +{ + debugger_trap_immediate(); + + switch ( reason ) + { + case SHUTDOWN_poweroff: + { + printk("Domain 0 halted: halting machine.\n"); + machine_halt(); + break; /* not reached */ + } + + case SHUTDOWN_crash: + { + printk("Domain 0 crashed: "); + maybe_reboot(); + break; /* not reached */ + } + + case SHUTDOWN_reboot: + { + printk("Domain 0 shutdown: rebooting machine.\n"); + machine_restart(NULL); + break; /* not reached */ + } + + default: + { + printk("Domain 0 shutdown (unknown reason %u): ", reason); + maybe_reboot(); + break; /* not reached */ + } + } +} + diff -r 353404fe850c -r 16aa4b417c6b xen/include/xen/shutdown.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xen/include/xen/shutdown.h Mon Aug 07 15:35:06 2006 +0100 @@ -0,0 +1,13 @@ +#ifndef __XEN_SHUTDOWN_H__ +#define __XEN_SHUTDOWN_H__ + +/* opt_noreboot: If true, machine will need manual reset on error. */ +extern int opt_noreboot; + +void dom0_shutdown(u8 reason); + +void machine_restart(char *cmd); +void machine_halt(void); +void machine_power_off(void); + +#endif /* __XEN_SHUTDOWN_H__ */ diff -r 353404fe850c -r 16aa4b417c6b xen/include/xen/reboot.h --- a/xen/include/xen/reboot.h Mon Aug 07 11:59:31 2006 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -#ifndef _LINUX_REBOOT_H -#define _LINUX_REBOOT_H - -extern void machine_restart(char *cmd); -extern void machine_halt(void); -extern void machine_power_off(void); - -#endif /* _LINUX_REBOOT_H */ _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |