From patchwork Wed Feb 23 07:03:54 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shriram Rajagopalan X-Patchwork-Id: 583491 Received: from smtp1.linux-foundation.org (smtp1.linux-foundation.org [140.211.169.13]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p1N75rUZ011327 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Wed, 23 Feb 2011 07:06:14 GMT Received: from daredevil.linux-foundation.org (localhost [127.0.0.1]) by smtp1.linux-foundation.org (8.14.2/8.13.5/Debian-3ubuntu1.1) with ESMTP id p1N74IQA024117; Tue, 22 Feb 2011 23:04:18 -0800 Received: from athos.nss.cs.ubc.ca ([198.162.52.240]) by smtp1.linux-foundation.org (8.14.2/8.13.5/Debian-3ubuntu1.1) with ESMTP id p1N74FV4024106 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 22 Feb 2011 23:04:17 -0800 Received: from athos.nss.cs.ubc.ca (localhost [127.0.0.1]) by athos.nss.cs.ubc.ca (8.14.3/8.14.3/Debian-9.1ubuntu1) with ESMTP id p1N74CRS010899; Tue, 22 Feb 2011 23:04:12 -0800 Received: (from root@localhost) by athos.nss.cs.ubc.ca (8.14.3/8.14.3/Submit) id p1N74AvE010896; Tue, 22 Feb 2011 23:04:10 -0800 From: Shriram Rajagopalan To: xen-devel@lists.xensource.com Date: Tue, 22 Feb 2011 23:03:54 -0800 Message-Id: <1298444634-10865-1-git-send-email-rshriram@cs.ubc.ca> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1298157158-5421-1-git-send-email-rshriram@cs.ubc.ca> References: <1298157158-5421-1-git-send-email-rshriram@cs.ubc.ca> Received-SPF: pass (localhost is always allowed.) X-Spam-Status: No, hits=-3.538 required=5 tests=AWL, BAYES_00, OSDL_HEADER_SUBJECT_BRACKETED, RDNS_NONE X-Spam-Checker-Version: SpamAssassin 3.2.4-osdl_revision__1.47__ X-MIMEDefang-Filter: lf$Revision: 1.188 $ X-Scanned-By: MIMEDefang 2.63 on 140.211.169.21 Cc: Shriram Rajagopalan , linux-pm@lists.linux-foundation.org, Iam Campbell Subject: [linux-pm] [PATCH v2 2/3] xen: use freeze/restore/thaw PM events for suspend/resume/chkpt X-BeenThere: linux-pm@lists.linux-foundation.org X-Mailman-Version: 2.1.9 Precedence: list List-Id: Linux power management List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-pm-bounces@lists.linux-foundation.org Errors-To: linux-pm-bounces@lists.linux-foundation.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Wed, 23 Feb 2011 07:06:14 +0000 (UTC) diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c index c255ed4..c24d0e7 100644 --- a/drivers/xen/manage.c +++ b/drivers/xen/manage.c @@ -61,7 +61,7 @@ static void xen_post_suspend(int cancelled) xen_mm_unpin_all(); } -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_XEN_SAVE_RESTORE static int xen_suspend(void *data) { struct suspend_info *si = data; @@ -69,7 +69,7 @@ static int xen_suspend(void *data) BUG_ON(!irqs_disabled()); - err = sysdev_suspend(PMSG_SUSPEND); + err = sysdev_suspend(PMSG_FREEZE); if (err) { printk(KERN_ERR "xen_suspend: sysdev_suspend failed: %d\n", err); @@ -118,7 +118,7 @@ static void do_suspend(void) } #endif - err = dpm_suspend_start(PMSG_SUSPEND); + err = dpm_suspend_start(PMSG_FREEZE); if (err) { printk(KERN_ERR "xen suspend: dpm_suspend_start %d\n", err); goto out_thaw; @@ -127,7 +127,7 @@ static void do_suspend(void) printk(KERN_DEBUG "suspending xenstore...\n"); xs_suspend(); - err = dpm_suspend_noirq(PMSG_SUSPEND); + err = dpm_suspend_noirq(PMSG_FREEZE); if (err) { printk(KERN_ERR "dpm_suspend_noirq failed: %d\n", err); goto out_resume; @@ -147,7 +147,7 @@ static void do_suspend(void) err = stop_machine(xen_suspend, &si, cpumask_of(0)); - dpm_resume_noirq(PMSG_RESUME); + dpm_resume_noirq(si.cancelled ? PMSG_THAW : PMSG_RESTORE); if (err) { printk(KERN_ERR "failed to start xen_suspend: %d\n", err); @@ -161,7 +161,7 @@ out_resume: } else xs_suspend_cancel(); - dpm_resume_end(PMSG_RESUME); + dpm_resume_end(si.cancelled ? PMSG_THAW : PMSG_RESTORE); /* Make sure timer events get retriggered on all CPUs */ clock_was_set(); @@ -173,7 +173,7 @@ out: #endif shutting_down = SHUTDOWN_INVALID; } -#endif /* CONFIG_PM_SLEEP */ +#endif /* CONFIG_XEN_SAVE_RESTORE */ struct shutdown_handler { const char *command; @@ -202,7 +202,7 @@ static void shutdown_handler(struct xenbus_watch *watch, { "poweroff", do_poweroff }, { "halt", do_poweroff }, { "reboot", do_reboot }, -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_XEN_SAVE_RESTORE { "suspend", do_suspend }, #endif {NULL, NULL}, diff --git a/drivers/xen/xenbus/xenbus_probe_frontend.c b/drivers/xen/xenbus/xenbus_probe_frontend.c index ea83999..b6a2690 100644 --- a/drivers/xen/xenbus/xenbus_probe_frontend.c +++ b/drivers/xen/xenbus/xenbus_probe_frontend.c @@ -86,9 +86,11 @@ static struct device_attribute xenbus_frontend_dev_attrs[] = { }; static const struct dev_pm_ops xenbus_pm_ops = { - .suspend = xenbus_dev_suspend, - .resume = xenbus_dev_resume, - .thaw = xenbus_dev_cancel, + .suspend = xenbus_dev_suspend, + .resume = xenbus_dev_resume, + .freeze = xenbus_dev_suspend, + .thaw = xenbus_dev_cancel, + .restore = xenbus_dev_resume, }; static struct xen_bus_type xenbus_frontend = {