[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] Clean up recent changes to reboot code. This fixes PV save/restore.
# HG changeset patch # User kfraser@xxxxxxxxxxxxxxxxxxxxx # Node ID 6ad98bc30cb4b8e2b59e91e0bf4fbf7099609bc4 # Parent ada9ee6ce078f3af3f85cc7486f48851bb9ff28c Clean up recent changes to reboot code. This fixes PV save/restore. Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx> --- linux-2.6-xen-sparse/include/xen/reboot.h | 19 ------ linux-2.6-xen-sparse/drivers/xen/core/machine_reboot.c | 19 ------ linux-2.6-xen-sparse/drivers/xen/core/reboot.c | 51 +++++++++++++---- tools/python/xen/xend/image.py | 2 4 files changed, 43 insertions(+), 48 deletions(-) diff -r ada9ee6ce078 -r 6ad98bc30cb4 linux-2.6-xen-sparse/drivers/xen/core/machine_reboot.c --- a/linux-2.6-xen-sparse/drivers/xen/core/machine_reboot.c Tue Oct 31 15:04:05 2006 +0000 +++ b/linux-2.6-xen-sparse/drivers/xen/core/machine_reboot.c Tue Oct 31 15:54:03 2006 +0000 @@ -18,7 +18,6 @@ #include <xen/gnttab.h> #include <xen/xencons.h> #include <xen/cpu_hotplug.h> -#include <xen/reboot.h> #if defined(__i386__) || defined(__x86_64__) @@ -125,7 +124,7 @@ static void post_suspend(void) #endif -int __do_suspend(void *ignore) +int __xen_suspend(void) { int err; @@ -164,8 +163,6 @@ int __do_suspend(void *ignore) */ HYPERVISOR_suspend(virt_to_mfn(xen_start_info)); - shutting_down = SHUTDOWN_INVALID; - post_suspend(); gnttab_resume(); @@ -186,17 +183,3 @@ int __do_suspend(void *ignore) return err; } - -int kthread_create_on_cpu(int (*f)(void *arg), - void *arg, - const char *name, - int cpu) -{ - struct task_struct *p; - p = kthread_create(f, arg, name); - if (IS_ERR(p)) - return PTR_ERR(p); - kthread_bind(p, cpu); - wake_up_process(p); - return 0; -} diff -r ada9ee6ce078 -r 6ad98bc30cb4 linux-2.6-xen-sparse/drivers/xen/core/reboot.c --- a/linux-2.6-xen-sparse/drivers/xen/core/reboot.c Tue Oct 31 15:04:05 2006 +0000 +++ b/linux-2.6-xen-sparse/drivers/xen/core/reboot.c Tue Oct 31 15:54:03 2006 +0000 @@ -8,12 +8,30 @@ #include <asm/hypervisor.h> #include <xen/xenbus.h> #include <linux/kthread.h> -#include <xen/reboot.h> MODULE_LICENSE("Dual BSD/GPL"); + +#define SHUTDOWN_INVALID -1 +#define SHUTDOWN_POWEROFF 0 +#define SHUTDOWN_SUSPEND 2 +/* Code 3 is SHUTDOWN_CRASH, which we don't use because the domain can only + * report a crash, not be instructed to crash! + * HALT is the same as POWEROFF, as far as we're concerned. The tools use + * the distinction when we return the reason code to them. + */ +#define SHUTDOWN_HALT 4 + +/* Ignore multiple shutdown requests. */ +static int shutting_down = SHUTDOWN_INVALID; static void __shutdown_handler(void *unused); static DECLARE_WORK(shutdown_work, __shutdown_handler, NULL); + +#ifdef CONFIG_XEN +int __xen_suspend(void); +#else +#define __xen_suspend() 0 +#endif static int shutdown_process(void *__unused) { @@ -41,21 +59,36 @@ static int shutdown_process(void *__unus return 0; } +static int xen_suspend(void *__unused) +{ + __xen_suspend(); + shutting_down = SHUTDOWN_INVALID; + return 0; +} + +static int kthread_create_on_cpu(int (*f)(void *arg), + void *arg, + const char *name, + int cpu) +{ + struct task_struct *p; + p = kthread_create(f, arg, name); + if (IS_ERR(p)) + return PTR_ERR(p); + kthread_bind(p, cpu); + wake_up_process(p); + return 0; +} static void __shutdown_handler(void *unused) { int err; -#ifdef CONFIG_XEN if (shutting_down != SHUTDOWN_SUSPEND) err = kernel_thread(shutdown_process, NULL, CLONE_FS | CLONE_FILES); else - err = kthread_create_on_cpu(__do_suspend, NULL, "suspend", 0); -#else /* !CONFIG_XEN */ - err = kernel_thread(shutdown_process, NULL, - CLONE_FS | CLONE_FILES); -#endif /* !CONFIG_XEN */ + err = kthread_create_on_cpu(xen_suspend, NULL, "suspend", 0); if (err < 0) { printk(KERN_WARNING "Error creating shutdown process (%d): " @@ -71,8 +104,6 @@ static void shutdown_handler(struct xenb struct xenbus_transaction xbt; int err; - int cad_pid = 1; - if (shutting_down != SHUTDOWN_INVALID) return; @@ -98,7 +129,7 @@ static void shutdown_handler(struct xenb if (strcmp(str, "poweroff") == 0) shutting_down = SHUTDOWN_POWEROFF; else if (strcmp(str, "reboot") == 0) - kill_proc(cad_pid, SIGINT, 1); + kill_proc(1, SIGINT, 1); /* interrupt init */ else if (strcmp(str, "suspend") == 0) shutting_down = SHUTDOWN_SUSPEND; else if (strcmp(str, "halt") == 0) diff -r ada9ee6ce078 -r 6ad98bc30cb4 tools/python/xen/xend/image.py --- a/tools/python/xen/xend/image.py Tue Oct 31 15:04:05 2006 +0000 +++ b/tools/python/xen/xend/image.py Tue Oct 31 15:54:03 2006 +0000 @@ -462,7 +462,7 @@ class HVMImageHandler(ImageHandler): def register_reboot_feature_watch(self): """ add xen store watch on control/feature-reboot """ - self.rebootModuleWatch = xswatch(self.vm.dompath + "/control/feature-reboot", \ + self.rebootFeatureWatch = xswatch(self.vm.dompath + "/control/feature-reboot", \ self.hvm_reboot_feature) log.debug("hvm reboot feature watch registered") diff -r ada9ee6ce078 -r 6ad98bc30cb4 linux-2.6-xen-sparse/include/xen/reboot.h --- a/linux-2.6-xen-sparse/include/xen/reboot.h Tue Oct 31 15:04:05 2006 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,19 +0,0 @@ -#define SHUTDOWN_INVALID -1 -#define SHUTDOWN_POWEROFF 0 -#define SHUTDOWN_SUSPEND 2 -/* Code 3 is SHUTDOWN_CRASH, which we don't use because the domain can only - * report a crash, not be instructed to crash! - * HALT is the same as POWEROFF, as far as we're concerned. The tools use - * the distinction when we return the reason code to them. - */ -#define SHUTDOWN_HALT 4 - -/****************************************************************************** - * Stop/pickle callback handling. - */ - -/* Ignore multiple shutdown requests. */ -static int shutting_down = SHUTDOWN_INVALID; - -int kthread_create_on_cpu(int (*f)(void *), void *, const char *, int); -int __do_suspend(void *); _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |