WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH] xen: use freeze/restore/thaw PM events for suspe

To: Shriram Rajagopalan <rshriram@xxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] xen: use freeze/restore/thaw PM events for suspend/resume/chkpt
From: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
Date: Wed, 16 Feb 2011 11:43:53 +0000
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Wed, 16 Feb 2011 03:46:21 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1297839080-17533-1-git-send-email-rshriram@xxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Organization: Citrix Systems, Inc.
References: <1297839080-17533-1-git-send-email-rshriram@xxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Wed, 2011-02-16 at 06:51 +0000, Shriram Rajagopalan wrote:
> 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);

With this patch I get

[   18.902808] PM: Device pcspkr failed to freeze: error -22
[   18.902835] xen suspend: dpm_suspend_start -22

apparently due to a lack of CONFIG_HIBERNATE which is a prerequisite for
using the freeze methods (see pm_ops function).

As I mentioned earlier I think some of the CONFIG_PM_SLEEP tests in
drivers/xen/manage.c need to be adjusted for the new suspend scheme (and
I suspect they are a little wrong for the old one too).

Since CONFIG_HIBERNATE is a "suspend to disk" option I think this needs
running past the core pm guys to determine the correct approach, it
might be to make PMSG_FREEZE support enabled by some some less specific
configuration option.

Enabling CONFIG_HIBERNATE does seem to be sufficient to make this work
though.

Ian.


> 
> Signed-off-by: Shriram Rajagopalan <rshriram@xxxxxxxxx>
> ---
>  drivers/xen/manage.c                       |   12 ++++++------
>  drivers/xen/xenbus/xenbus_probe.c          |    2 +-
>  drivers/xen/xenbus/xenbus_probe_frontend.c |    8 +++++---
>  3 files changed, 12 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c
> index db8c4c4..3f76dcf 100644
> --- a/drivers/xen/manage.c
> +++ b/drivers/xen/manage.c
> @@ -63,7 +63,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);
> @@ -114,16 +114,16 @@ 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;
>       }
>  
> -     printk(KERN_DEBUG "suspending xenstore...\n");
> +     /* 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;
> @@ -134,7 +134,7 @@ static void do_suspend(void)
>       else
>               err = stop_machine(xen_suspend, &cancelled, cpumask_of(0));
>  
> -     dpm_resume_noirq(PMSG_RESUME);
> +     dpm_resume_noirq(cancelled ? PMSG_THAW : PMSG_RESTORE);
>  
>       if (err) {
>               printk(KERN_ERR "failed to start xen_suspend: %d\n", err);
> @@ -148,7 +148,7 @@ out_resume:
>       } else
>               xs_suspend_cancel();
>  
> -     dpm_resume_end(PMSG_RESUME);
> +     dpm_resume_end(cancelled ? PMSG_THAW : PMSG_RESTORE);
>  
>       /* Make sure timer events get retriggered on all CPUs */
>       clock_was_set();
> diff --git a/drivers/xen/xenbus/xenbus_probe.c 
> b/drivers/xen/xenbus/xenbus_probe.c
> index 7397695..471ca48 100644
> --- a/drivers/xen/xenbus/xenbus_probe.c
> +++ b/drivers/xen/xenbus/xenbus_probe.c
> @@ -645,7 +645,7 @@ EXPORT_SYMBOL_GPL(xenbus_dev_resume);
>  int xenbus_dev_cancel(struct device *dev)
>  {
>       /* Do nothing */
> -     DPRINTK("cancel");
> +     /* DPRINTK("cancel"); */
>       return 0;
>  }
>  EXPORT_SYMBOL_GPL(xenbus_dev_cancel);
> diff --git a/drivers/xen/xenbus/xenbus_probe_frontend.c 
> b/drivers/xen/xenbus/xenbus_probe_frontend.c
> index 9ad8868..d6e5f0d 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 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 = {



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel