login
Header Space

 
 

Re: Linux 2.6.21-rc6

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Adrian Bunk <bunk@...>, Linux Kernel Mailing List <linux-kernel@...>, <pavel@...>, <linux-pm@...>, Rafael J. Wysocki <rjw@...>
Date: Saturday, April 14, 2007 - 8:24 am

Tobias Diedrich wrote:

Doesn't apply cleanly against -rc6, but fixes the problem when
reverted from -rc1.

Index: linux-2.6.21-rc1/kernel/power/disk.c
===================================================================
--- linux-2.6.21-rc1.orig/kernel/power/disk.c	2007-04-14 14:16:59.000000000 +0200
+++ linux-2.6.21-rc1/kernel/power/disk.c	2007-04-14 14:17:03.000000000 +0200
@@ -87,24 +87,52 @@
 	}
 }
 
-static void unprepare_processes(void)
-{
-	thaw_processes();
-	pm_restore_console();
-}
-
 static int prepare_processes(void)
 {
 	int error = 0;
 
 	pm_prepare_console();
+
+	error = disable_nonboot_cpus();
+	if (error)
+		goto enable_cpus;
+
 	if (freeze_processes()) {
 		error = -EBUSY;
-		unprepare_processes();
+		goto thaw;
 	}
+
+	if (pm_disk_mode == PM_DISK_TESTPROC) {
+		printk("swsusp debug: Waiting for 5 seconds.\n");
+		mdelay(5000);
+		goto thaw;
+	}
+
+	error = platform_prepare();
+	if (error)
+		goto thaw;
+
+	/* Free memory before shutting down devices. */
+	if (!(error = swsusp_shrink_memory()))
+		return 0;
+
+	platform_finish();
+ thaw:
+	thaw_processes();
+ enable_cpus:
+	enable_nonboot_cpus();
+	pm_restore_console();
 	return error;
 }
 
+static void unprepare_processes(void)
+{
+	platform_finish();
+	thaw_processes();
+	enable_nonboot_cpus();
+	pm_restore_console();
+}
+
 /**
  *	pm_suspend_disk - The granpappy of hibernation power management.
  *
@@ -122,45 +150,29 @@
 	if (error)
 		return error;
 
-	if (pm_disk_mode == PM_DISK_TESTPROC) {
-		printk("swsusp debug: Waiting for 5 seconds.\n");
-		mdelay(5000);
-		goto Thaw;
-	}
-	/* Free memory before shutting down devices. */
-	error = swsusp_shrink_memory();
-	if (error)
-		goto Thaw;
-
-	error = platform_prepare();
-	if (error)
-		goto Thaw;
+	if (pm_disk_mode == PM_DISK_TESTPROC)
+		return 0;
 
 	suspend_console();
 	error = device_suspend(PMSG_FREEZE);
 	if (error) {
-		printk(KERN_ERR "PM: Some devices failed to suspend\n");
-		goto Resume_devices;
+		resume_console();
+		printk("Some devices failed to suspend\n");
+		goto Thaw;
 	}
-	error = disable_nonboot_cpus();
-	if (error)
-		goto Enable_cpus;
 
 	if (pm_disk_mode == PM_DISK_TEST) {
 		printk("swsusp debug: Waiting for 5 seconds.\n");
 		mdelay(5000);
-		goto Enable_cpus;
+		goto Done;
 	}
 
 	pr_debug("PM: snapshotting memory.\n");
 	in_suspend = 1;
-	error = swsusp_suspend();
-	if (error)
-		goto Enable_cpus;
+	if ((error = swsusp_suspend()))
+		goto Done;
 
 	if (in_suspend) {
-		enable_nonboot_cpus();
-		platform_finish();
 		device_resume();
 		resume_console();
 		pr_debug("PM: writing image.\n");
@@ -176,10 +188,7 @@
 	}
 
 	swsusp_free();
- Enable_cpus:
-	enable_nonboot_cpus();
- Resume_devices:
-	platform_finish();
+ Done:
 	device_resume();
 	resume_console();
  Thaw:
@@ -228,28 +237,19 @@
 
 	pr_debug("PM: Checking swsusp image.\n");
 
-	error = swsusp_check();
-	if (error)
+	if ((error = swsusp_check()))
 		goto Done;
 
 	pr_debug("PM: Preparing processes for restore.\n");
 
-	error = prepare_processes();
-	if (error) {
+	if ((error = prepare_processes())) {
 		swsusp_close();
 		goto Done;
 	}
 
-	error = platform_prepare();
-	if (error) {
-		swsusp_free();
-		goto Thaw;
-	}
-
 	pr_debug("PM: Reading swsusp image.\n");
 
-	error = swsusp_read();
-	if (error) {
+	if ((error = swsusp_read())) {
 		swsusp_free();
 		goto Thaw;
 	}
@@ -257,22 +257,21 @@
 	pr_debug("PM: Preparing devices for restore.\n");
 
 	suspend_console();
-	error = device_suspend(PMSG_PRETHAW);
-	if (error)
-		goto Free;
+	if ((error = device_suspend(PMSG_PRETHAW))) {
+		resume_console();
+		printk("Some devices failed to suspend\n");
+		swsusp_free();
+		goto Thaw;
+	}
 
-	error = disable_nonboot_cpus();
-	if (!error)
-		swsusp_resume();
+	mb();
 
-	enable_nonboot_cpus();
- Free:
-	swsusp_free();
-	platform_finish();
+	pr_debug("PM: Restoring saved image.\n");
+	swsusp_resume();
+	pr_debug("PM: Restore failed, recovering.n");
 	device_resume();
 	resume_console();
  Thaw:
-	printk(KERN_ERR "PM: Restore failed, recovering.\n");
 	unprepare_processes();
  Done:
 	/* For success case, the suspend path will release the lock */

-- 
Tobias						PGP: http://9ac7e0bc.uguu.de
このメールは十割再利用されたビットで作られています。
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Linux 2.6.21-rc6, Linus Torvalds, (Thu Apr 5, 10:50 pm)
[2/3] 2.6.21-rc6: known regressions, Adrian Bunk, (Fri Apr 13, 8:38 pm)
[3/3] 2.6.21-rc6: known regressions, Adrian Bunk, (Fri Apr 13, 8:38 pm)
Re: [3/3] 2.6.21-rc6: known regressions, Jeff Chua, (Sun Apr 15, 1:15 pm)
Re: [3/3] 2.6.21-rc6: known regressions, Dave Jones, (Sat Apr 14, 3:40 am)
Re: [3/3] 2.6.21-rc6: known regressions, Tobias Doerffel, (Sat Apr 14, 3:24 am)
Re: [3/3] 2.6.21-rc6: known regressions, Antonino A. Daplas, (Fri Apr 13, 9:57 pm)
Re: [3/3] 2.6.21-rc6: known regressions, Marcus Better, (Sun Apr 15, 12:26 pm)
Re: [3/3] 2.6.21-rc6: known regressions, Antonino A. Daplas, (Sun Apr 15, 7:08 pm)
Re: [3/3] 2.6.21-rc6: known regressions, Marcus Better, (Mon Apr 16, 2:23 am)
Re: [3/3] 2.6.21-rc6: known regressions, Antonino A. Daplas, (Mon Apr 16, 2:45 am)
Re: [3/3] 2.6.21-rc6: known regressions, Marcus Better, (Tue Apr 17, 4:17 am)
Re: [3/3] 2.6.21-rc6: known regressions, Pavel Machek, (Tue Apr 24, 11:33 am)
Re: [3/3] 2.6.21-rc6: known regressions, Antonino A. Daplas, (Tue Apr 17, 5:27 am)
Re: [3/3] 2.6.21-rc6: known regressions, Marcus Better, (Tue Apr 17, 7:54 am)
[1/3] 2.6.21-rc6: known regressions, Adrian Bunk, (Fri Apr 13, 8:36 pm)
Re: Linux 2.6.21-rc6, Tobias Diedrich, (Fri Apr 13, 5:29 pm)
Re: Linux 2.6.21-rc6, Adrian Bunk, (Fri Apr 13, 7:50 pm)
Re: Linux 2.6.21-rc6, Tobias Diedrich, (Sat Apr 14, 8:09 am)
Re: Linux 2.6.21-rc6, Tobias Diedrich, (Sat Apr 14, 8:24 am)
Re: Linux 2.6.21-rc6, Tobias Diedrich, (Sat Apr 14, 8:31 am)
Re: Linux 2.6.21-rc6, Adrian Bunk, (Sat Apr 14, 9:00 am)
Re: Linux 2.6.21-rc6, Rafael J. Wysocki, (Sat Apr 14, 2:28 pm)
Re: Linux 2.6.21-rc6, Tobias Diedrich, (Sat Apr 14, 3:56 pm)
Re: Linux 2.6.21-rc6, Rafael J. Wysocki, (Sat Apr 14, 4:23 pm)
Re: Linux 2.6.21-rc6, Tobias Diedrich, (Sat Apr 14, 5:35 pm)
Re: Linux 2.6.21-rc6, Rafael J. Wysocki, (Sat Apr 14, 5:58 pm)
Re: Linux 2.6.21-rc6, Tobias Diedrich, (Sun Apr 15, 3:38 am)
Re: Linux 2.6.21-rc6, Tobias Diedrich, (Sun Apr 15, 4:02 am)
Re: Linux 2.6.21-rc6, Rafael J. Wysocki, (Sun Apr 15, 7:16 am)
Re: [linux-pm] Linux 2.6.21-rc6, David Brownell, (Sun Apr 15, 11:14 am)
Re: [linux-pm] Linux 2.6.21-rc6, Rafael J. Wysocki, (Sun Apr 15, 12:37 pm)
Re: [linux-pm] Linux 2.6.21-rc6, Tobias Diedrich, (Sun Apr 15, 3:40 pm)
Re: [linux-pm] Linux 2.6.21-rc6, Rafael J. Wysocki, (Sun Apr 15, 3:54 pm)
Re: [linux-pm] Linux 2.6.21-rc6, Tobias Diedrich, (Wed Apr 25, 1:14 pm)
Re: [linux-pm] Linux 2.6.21-rc6, Rafael J. Wysocki, (Wed Apr 25, 3:36 pm)
Re: [linux-pm] Linux 2.6.21-rc6, Tobias Diedrich, (Wed Apr 25, 4:09 pm)
Re: [linux-pm] Linux 2.6.21-rc6, David Brownell, (Sun Apr 15, 1:53 pm)
Re: Linux 2.6.21-rc6, Dmitry Torokhov, (Sun Apr 15, 10:19 am)
Re: Linux 2.6.21-rc6, Rafael J. Wysocki, (Sun Apr 15, 11:52 am)
Re: Linux 2.6.21-rc6, Tobias Diedrich, (Sun Apr 15, 2:50 pm)
Re: Linux 2.6.21-rc6, Rafael J. Wysocki, (Sun Apr 15, 3:37 pm)
Re: Linux 2.6.21-rc6, Adrian Bunk, (Sat Apr 14, 4:25 pm)
Re: Linux 2.6.21-rc6, Rafael J. Wysocki, (Sat Apr 14, 4:38 pm)
Re: Linux 2.6.21-rc6, Tobias Diedrich, (Sat Apr 14, 4:16 am)
Re: Linux 2.6.21-rc6, Adrian Bunk, (Sat Apr 14, 8:26 am)
Re: Linux 2.6.21-rc6, Rafael J. Wysocki, (Sat Apr 14, 5:05 am)
Re: Linux 2.6.21-rc6, Tobias Diedrich, (Sat Apr 14, 6:32 am)
Re: Linux 2.6.21-rc6, Tobias Diedrich, (Sat Apr 14, 2:50 am)
Re: Linux 2.6.21-rc6, Mattia Dongili, (Thu Apr 12, 11:14 am)
Re: Linux 2.6.21-rc6, Maxim Levitsky, (Thu Apr 12, 2:26 pm)
Re: Linux 2.6.21-rc6, Mattia Dongili, (Fri Apr 13, 4:52 am)
Re: Linux 2.6.21-rc6, Mattia Dongili, (Thu Apr 12, 1:02 pm)
Re: Linux 2.6.21-rc6, Jeff Chua, (Tue Apr 10, 10:35 am)
Re: Linux 2.6.21-rc6, Linus Torvalds, (Tue Apr 10, 11:35 am)
Re: Linux 2.6.21-rc6, Jeff Chua, (Thu Apr 12, 12:16 am)
Re: Linux 2.6.21-rc6, Andrew Morton, (Sun Apr 8, 7:09 pm)
Re: Linux 2.6.21-rc6, Dmitry Torokhov, (Mon Apr 9, 11:32 pm)
Re: Linux 2.6.21-rc6, Jeff Garzik, (Sun Apr 8, 8:59 pm)
Re: Linux 2.6.21-rc6, Chris Wedgwood, (Tue Apr 10, 3:57 am)
Re: Linux 2.6.21-rc6, Ingo Molnar, (Wed Apr 11, 3:38 am)
Re: Linux 2.6.21-rc6, Greg KH, (Sun Apr 8, 8:42 pm)
Re: Linux 2.6.21-rc6, Gene Heskett, (Sat Apr 7, 4:58 pm)
Re: Linux 2.6.21-rc6, Randy Dunlap, (Sat Apr 7, 2:37 pm)
Re: Linux 2.6.21-rc6, Linus Torvalds, (Sat Apr 7, 2:46 pm)
Re: Linux 2.6.21-rc6, Linus Torvalds, (Sat Apr 7, 2:51 pm)
Re: Linux 2.6.21-rc6, Randy Dunlap, (Sat Apr 7, 2:50 pm)
Re: Linux 2.6.21-rc6, Michal Piotrowski, (Sat Apr 7, 4:48 am)
Re: Linux 2.6.21-rc6 - regressions update, Soeren Sonnenburg, (Fri Apr 6, 6:44 pm)
Re: Linux 2.6.21-rc6 - regressions update, Linus Torvalds, (Fri Apr 6, 7:04 pm)
Re: Linux 2.6.21-rc6 - regressions update, Soeren Sonnenburg, (Sun Apr 8, 11:57 am)
[patch] high-res timers: UP resume fix, Ingo Molnar, (Sat Apr 7, 4:12 am)
[patch] high-res timers: resume fix, Ingo Molnar, (Sat Apr 7, 5:49 am)
Re: [patch] high-res timers: resume fix, Rafael J. Wysocki, (Sat Apr 7, 6:02 am)
[patch, take #3] high-res timers: resume fix, Ingo Molnar, (Sat Apr 7, 6:05 am)
Re: [patch, take #3] high-res timers: resume fix, Soeren Sonnenburg, (Sat Apr 7, 6:45 am)
Re: [patch] high-res timers: UP resume fix, Thomas Gleixner, (Sat Apr 7, 4:51 am)
Re: [patch] high-res timers: UP resume fix, Ingo Molnar, (Sat Apr 7, 4:25 am)
Re: [patch] high-res timers: UP resume fix, Thomas Gleixner, (Sat Apr 7, 4:48 am)
Re: [patch] high-res timers: UP resume fix, Rafael J. Wysocki, (Sat Apr 7, 5:48 am)
Re: [patch] high-res timers: UP resume fix, Pavel Machek, (Wed Apr 11, 10:00 am)
Re: [patch] high-res timers: UP resume fix, Ingo Molnar, (Sat Apr 7, 5:47 am)
Re: [patch] high-res timers: UP resume fix, Rafael J. Wysocki, (Sat Apr 7, 5:53 am)
Re: [patch] high-res timers: UP resume fix, Thomas Gleixner, (Sat Apr 7, 5:51 am)
Re: [patch] high-res timers: UP resume fix, Ingo Molnar, (Sat Apr 7, 4:50 am)
tg3: unable to handle null pointer dereference [Re: Linux 2...., Nishanth Aravamudan, (Fri Apr 6, 5:40 pm)
Re: tg3: unable to handle null pointer dereference, David Miller, (Fri Apr 6, 8:36 pm)
Re: tg3: unable to handle null pointer dereference, Nishanth Aravamudan, (Fri Apr 6, 9:53 pm)
speck-geostationary