aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/xen/manage.c
diff options
context:
space:
mode:
authorShriram Rajagopalan <rshriram@cs.ubc.ca>2011-02-22 17:59:06 -0500
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2011-03-16 13:42:56 -0400
commitb3e96c0c756211e805c6941d4a6e5f6e1995cb6b (patch)
tree1e11a95ae6d234f98e20f40dcc89cf28df229ca4 /drivers/xen/manage.c
parentc7853aea57d8e850b0979e7bdcbcabdcbbdd9e37 (diff)
xen: use freeze/restore/thaw PM events for suspend/resume/chkpt
Use PM_FREEZE, PM_THAW and PM_RESTORE power events for suspend/resume/checkpoint functionality, instead of PM_SUSPEND and PM_RESUME. Use of these pm events fixes the Xen Guest hangup when taking checkpoints. When a suspend event is cancelled (while taking checkpoints once/continuously), we use PM_THAW instead of PM_RESUME. PM_RESTORE is used when suspend is not cancelled. See Documentation/power/devices.txt and linux/pm.h for more info about freeze, thaw and restore. The sequence of pm events in a suspend-resume scenario is shown below. dpm_suspend_start(PMSG_FREEZE); dpm_suspend_noirq(PMSG_FREEZE); sysdev_suspend(PMSG_FREEZE); cancelled = suspend_hypercall() sysdev_resume(); dpm_resume_noirq(cancelled ? PMSG_THAW : PMSG_RESTORE); dpm_resume_end(cancelled ? PMSG_THAW : PMSG_RESTORE); Acked-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Shriram Rajagopalan <rshriram@cs.ubc.ca> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'drivers/xen/manage.c')
-rw-r--r--drivers/xen/manage.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c
index ebb292859b59..95143dd6904d 100644
--- a/drivers/xen/manage.c
+++ b/drivers/xen/manage.c
@@ -61,7 +61,7 @@ static void xen_post_suspend(int cancelled)
61 xen_mm_unpin_all(); 61 xen_mm_unpin_all();
62} 62}
63 63
64#ifdef CONFIG_PM_SLEEP 64#ifdef CONFIG_HIBERNATION
65static int xen_suspend(void *data) 65static int xen_suspend(void *data)
66{ 66{
67 struct suspend_info *si = data; 67 struct suspend_info *si = data;
@@ -69,7 +69,7 @@ static int xen_suspend(void *data)
69 69
70 BUG_ON(!irqs_disabled()); 70 BUG_ON(!irqs_disabled());
71 71
72 err = sysdev_suspend(PMSG_SUSPEND); 72 err = sysdev_suspend(PMSG_FREEZE);
73 if (err) { 73 if (err) {
74 printk(KERN_ERR "xen_suspend: sysdev_suspend failed: %d\n", 74 printk(KERN_ERR "xen_suspend: sysdev_suspend failed: %d\n",
75 err); 75 err);
@@ -118,7 +118,7 @@ static void do_suspend(void)
118 } 118 }
119#endif 119#endif
120 120
121 err = dpm_suspend_start(PMSG_SUSPEND); 121 err = dpm_suspend_start(PMSG_FREEZE);
122 if (err) { 122 if (err) {
123 printk(KERN_ERR "xen suspend: dpm_suspend_start %d\n", err); 123 printk(KERN_ERR "xen suspend: dpm_suspend_start %d\n", err);
124 goto out_thaw; 124 goto out_thaw;
@@ -127,7 +127,7 @@ static void do_suspend(void)
127 printk(KERN_DEBUG "suspending xenstore...\n"); 127 printk(KERN_DEBUG "suspending xenstore...\n");
128 xs_suspend(); 128 xs_suspend();
129 129
130 err = dpm_suspend_noirq(PMSG_SUSPEND); 130 err = dpm_suspend_noirq(PMSG_FREEZE);
131 if (err) { 131 if (err) {
132 printk(KERN_ERR "dpm_suspend_noirq failed: %d\n", err); 132 printk(KERN_ERR "dpm_suspend_noirq failed: %d\n", err);
133 goto out_resume; 133 goto out_resume;
@@ -147,7 +147,7 @@ static void do_suspend(void)
147 147
148 err = stop_machine(xen_suspend, &si, cpumask_of(0)); 148 err = stop_machine(xen_suspend, &si, cpumask_of(0));
149 149
150 dpm_resume_noirq(PMSG_RESUME); 150 dpm_resume_noirq(si.cancelled ? PMSG_THAW : PMSG_RESTORE);
151 151
152 if (err) { 152 if (err) {
153 printk(KERN_ERR "failed to start xen_suspend: %d\n", err); 153 printk(KERN_ERR "failed to start xen_suspend: %d\n", err);
@@ -161,7 +161,7 @@ out_resume:
161 } else 161 } else
162 xs_suspend_cancel(); 162 xs_suspend_cancel();
163 163
164 dpm_resume_end(PMSG_RESUME); 164 dpm_resume_end(si.cancelled ? PMSG_THAW : PMSG_RESTORE);
165 165
166 /* Make sure timer events get retriggered on all CPUs */ 166 /* Make sure timer events get retriggered on all CPUs */
167 clock_was_set(); 167 clock_was_set();
@@ -173,7 +173,7 @@ out:
173#endif 173#endif
174 shutting_down = SHUTDOWN_INVALID; 174 shutting_down = SHUTDOWN_INVALID;
175} 175}
176#endif /* CONFIG_PM_SLEEP */ 176#endif /* CONFIG_HIBERNATION */
177 177
178struct shutdown_handler { 178struct shutdown_handler {
179 const char *command; 179 const char *command;
@@ -202,7 +202,7 @@ static void shutdown_handler(struct xenbus_watch *watch,
202 { "poweroff", do_poweroff }, 202 { "poweroff", do_poweroff },
203 { "halt", do_poweroff }, 203 { "halt", do_poweroff },
204 { "reboot", do_reboot }, 204 { "reboot", do_reboot },
205#ifdef CONFIG_PM_SLEEP 205#ifdef CONFIG_HIBERNATION
206 { "suspend", do_suspend }, 206 { "suspend", do_suspend },
207#endif 207#endif
208 {NULL, NULL}, 208 {NULL, NULL},