From 74c5b661764e86c02847140fd8b17ef0da50aded Mon Sep 17 00:00:00 2001 From: Frank Pan Date: Fri, 4 Mar 2011 12:02:41 +0800 Subject: [PATCH] Resume devices when suspend is failed Recent pvops kernel does not call dpm_resume_end when dpm_suspend_start is failed. This makes some device remain suspended after the unsuccessful call of do_suspend from xenbus. In my test, a PV-on-HVM guest printed the following message after suspend request through xenbus, and then stucked due to disk access. [41577.764748] sd 0:0:0:0: [sda] Stopping disk [41577.765273] PM: Device input2 failed to suspend: error -22 [41577.765275] xen suspend: dpm_suspend_start -22 The following patch fixes this by calling dpm_suspend_start after the failure of dpm_resume_end. --- linux-2.6-xen/drivers/xen/manage.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/linux-2.6-xen/drivers/xen/manage.c b/linux-2.6-xen/drivers/xen/manage.c index 5078704..3eec337 100644 --- a/linux-2.6-xen/drivers/xen/manage.c +++ b/linux-2.6-xen/drivers/xen/manage.c @@ -120,6 +120,7 @@ static void do_suspend(void) err = dpm_suspend_start(PMSG_SUSPEND); if (err) { + dpm_resume_end(PMSG_RESUME); printk(KERN_ERR "xen suspend: dpm_suspend_start %d\n", err); goto out_thaw; } -- 1.7.0.4