Skip to contentSkip to conversation

2.6.21 suspend-to-disk regression

DISCUSSION Marcus Better 4 participants 14 messages Apr 29, 2007 – May 3, 2007

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hi,

suspend-to-disk isn't working well anymore on my Thinkpad R60 with Intel Core 2 Duo and kernel 2.6.21 (x86_64). It's a Debian system with uswsusp 0.6~cvs20070202-1, and I'm using s2disk. I believe it was quite stable around 2.6.20.

It does succeed sometimes, but often it fails at suspend. Several times it hung at "snapshotting system" with the sleep LED blinking. Once it just rebooted at that point. Sometimes it suspends correctly but the image is not recognized at boot.

I don't know if this is similar to any of the previously listed regressions, it's a bit daunting to wade through all the suspend-related threads...

Marcus

#1 lore raw

Hi,

Quoted 7 lines · Marcus Better

Hi,

suspend-to-disk isn't working well anymore on my Thinkpad R60 with Intel Core 2 Duo and kernel 2.6.21 (x86_64). It's a Debian system with uswsusp 0.6~cvs20070202-1, and I'm using s2disk. I believe it was quite stable around 2.6.20.

Quoted 7 lines

It does succeed sometimes, but often it fails at suspend. Several times it hung at "snapshotting system" with the sleep LED blinking. Once it just rebooted at that point. Sometimes it suspends correctly but the image is not recognized at boot.

I don't know if this is similar to any of the previously listed regressions, it's a bit daunting to wade through all the suspend-related threads...

We have some suspend regressions on Thinkpads reported, but I think they are different to what you describe.

Can you please apply the appended patch and see if that helps?

Rafael

---
 kernel/power/disk.c |    4 ++--
 kernel/power/user.c |    8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)
kernel/power/disk.c +2 -2
Index: linux-2.6.21-rc7/kernel/power/disk.c
===================================================================
@@ -170,9 +170,9 @@ int pm_suspend_disk(void)
 
 	if (in_suspend) {
 		enable_nonboot_cpus();
-		platform_finish();
 		device_resume();
 		resume_console();
+		platform_finish();
 		pr_debug("PM: writing image.\n");
 		error = swsusp_write();
 		if (!error)
@@ -189,9 +189,9 @@ int pm_suspend_disk(void)
  Enable_cpus:
 	enable_nonboot_cpus();
  Resume_devices:
-	platform_finish();
 	device_resume();
 	resume_console();
+	platform_finish();
  Thaw:
 	unprepare_processes();
  Finish:
kernel/power/user.c +4 -4
Index: linux-2.6.21-rc7/kernel/power/user.c
===================================================================
@@ -170,11 +170,11 @@ static inline int snapshot_suspend(int p
 	}
 	enable_nonboot_cpus();
  Resume_devices:
+	device_resume();
+	resume_console();
 	if (platform_suspend)
 		platform_finish();
 
-	device_resume();
-	resume_console();
  Finish:
 	mutex_unlock(&pm_mutex);
 	return error;
@@ -202,11 +202,11 @@ static inline int snapshot_restore(int p
 
 	enable_nonboot_cpus();
  Resume_devices:
+	device_resume();
+	resume_console();
 	if (platform_suspend)
 		platform_finish();
 
-	device_resume();
-	resume_console();
  Finish:
 	pm_restore_console();
 	mutex_unlock(&pm_mutex);
#2 lore raw
Quoted 1 line · Rafael J. Wysocki

Can you please apply the appended patch and see if that helps?

Only tried once so far, but it powered off while writing out the image, towards the end. When booting it of course didn't resume, and said the partitions were not cleanly shut down.

I think I had similar behaviour once before, so it may not be related to the patch. I should probably try more to see if the patch had any effect.

Marcus

#4 lore raw
In reply to Rafael J. Wysocki
Quoted 1 line · Rafael J. Wysocki

Can you please apply the appended patch and see if that helps?

A second attempt also succeeded, so I think it's an improvement at least.

Marcus

#5 lore raw
Quoted 4 lines · Marcus Better
Quoted 1 line · Rafael J. Wysocki

Can you please apply the appended patch and see if that helps?

A second attempt also succeeded, so I think it's an improvement at least.

OK, so please run with it applied for a while to make sure it helps.

Ugh, we seem to have a problem with the code ordering in which platform_finish() goes before device_resume(), at least in the hibernation (aka s2disk) case.

This is the second report confirming that the change of this ordering has fixed the a suspend problem, but the change of this ordering is intrusive, so I was afraid to do it before 2.6.21. Can we try to change it now?

Rafael

#6 lore raw
Quoted 7 lines · Rafael J. Wysocki

Ugh, we seem to have a problem with the code ordering in which platform_finish() goes before device_resume(), at least in the hibernation (aka s2disk) case.

This is the second report confirming that the change of this ordering has fixed the a suspend problem, but the change of this ordering is intrusive, so I was afraid to do it before 2.6.21. Can we try to change it now?

I don't care about that ordering at all; ACPI is the only user of hibernation_ops (which are still part of pm_ops now.)

johannes

#7 lore raw
In reply to Rafael J. Wysocki

Hi!

Quoted 10 lines
Quoted 4 lines
Quoted 1 line · Rafael J. Wysocki

Can you please apply the appended patch and see if that helps?

A second attempt also succeeded, so I think it's an improvement at least.

OK, so please run with it applied for a while to make sure it helps.

Ugh, we seem to have a problem with the code ordering in which platform_finish() goes before device_resume(), at least in the hibernation (aka s2disk) case.

Was not platform_finish before device_resume requirement for MSI interrupts working?

Quoted 3 lines

This is the second report confirming that the change of this ordering has fixed the a suspend problem, but the change of this ordering is intrusive, so I was afraid to do it before 2.6.21. Can we try to change it now?

I guess so.
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#8 lore raw
In reply to Rafael J. Wysocki
Quoted 1 line · Rafael J. Wysocki

OK, so please run with it applied for a while to make sure it helps.

I have tested some more, and it seems to work. There was only the one reboot during writing that happened on my first attempt, but it hasn't happened since then.

Thanks,

Marcus

#9 lore raw
Quoted 6 lines · Marcus Better
Quoted 1 line · Rafael J. Wysocki

OK, so please run with it applied for a while to make sure it helps.

I have tested some more, and it seems to work. There was only the one reboot during writing that happened on my first attempt, but it hasn't happened since then.

Could you please test the appended patch instead of the previous one?

Rafael

---
 kernel/power/disk.c |    4 +++-
 kernel/power/user.c |   15 +++------------
 2 files changed, 6 insertions(+), 13 deletions(-)
kernel/power/disk.c +3 -1
Index: linux-2.6.21/kernel/power/disk.c
===================================================================
@@ -215,7 +215,9 @@ int hibernate(void)
  Enable_cpus:
 	enable_nonboot_cpus();
  Resume_devices:
-	platform_finish();
+	if (error)
+		platform_finish();
+
 	device_resume();
 	resume_console();
  Thaw:
kernel/power/user.c +3 -12
Index: linux-2.6.21/kernel/power/user.c
===================================================================
@@ -169,7 +169,7 @@ static inline int snapshot_suspend(int p
 	}
 	enable_nonboot_cpus();
  Resume_devices:
-	if (platform_suspend)
+	if (platform_suspend && (!in_suspend || error))
 		platform_finish();
 
 	device_resume();
@@ -179,17 +179,12 @@ static inline int snapshot_suspend(int p
 	return error;
 }
 
-static inline int snapshot_restore(int platform_suspend)
+static inline int snapshot_restore(void)
 {
 	int error;
 
 	mutex_lock(&pm_mutex);
 	pm_prepare_console();
-	if (platform_suspend) {
-		error = platform_prepare();
-		if (error)
-			goto Finish;
-	}
 	suspend_console();
 	error = device_suspend(PMSG_PRETHAW);
 	if (error)
@@ -201,12 +196,8 @@ static inline int snapshot_restore(int p
 
 	enable_nonboot_cpus();
  Resume_devices:
-	if (platform_suspend)
-		platform_finish();
-
 	device_resume();
 	resume_console();
- Finish:
 	pm_restore_console();
 	mutex_unlock(&pm_mutex);
 	return error;
@@ -272,7 +263,7 @@ static int snapshot_ioctl(struct inode *
 			error = -EPERM;
 			break;
 		}
-		error = snapshot_restore(data->platform_suspend);
+		error = snapshot_restore();
 		break;
 
 	case SNAPSHOT_FREE:
#10 lore raw
Quoted 1 line · Rafael J. Wysocki

Could you please test the appended patch instead of the previous one?

It doesn't work. The suspend LED flashed for a while but the screen was blank and didn't show any messages. It powered down after a while, without writing anything to disk.

Marcus

#11 lore raw
Quoted 6 lines · Marcus Better
Quoted 1 line · Rafael J. Wysocki

Could you please test the appended patch instead of the previous one?

It doesn't work. The suspend LED flashed for a while but the screen was blank and didn't show any messages. It powered down after a while, without writing anything to disk.

Hmm, perhaps we should do something more, like the following:

 drivers/acpi/hardware/hwsleep.c |   22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)
drivers/acpi/hardware/hwsleep.c +16 -6
Index: linux-2.6.21/drivers/acpi/hardware/hwsleep.c
===================================================================
@@ -193,18 +193,13 @@ acpi_status acpi_enter_sleep_state_prep(
 	arg.type = ACPI_TYPE_INTEGER;
 	arg.integer.value = sleep_state;
 
-	/* Run the _PTS and _GTS methods */
+	/* Run the _PTS method */
 
 	status = acpi_evaluate_object(NULL, METHOD_NAME__PTS, &arg_list, NULL);
 	if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
 		return_ACPI_STATUS(status);
 	}
 
-	status = acpi_evaluate_object(NULL, METHOD_NAME__GTS, &arg_list, NULL);
-	if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
-		return_ACPI_STATUS(status);
-	}
-
 	/* Setup the argument to _SST */
 
 	switch (sleep_state) {
@@ -266,6 +261,8 @@ acpi_status asmlinkage acpi_enter_sleep_
 	u32 PM1Bcontrol;
 	struct acpi_bit_register_info *sleep_type_reg_info;
 	struct acpi_bit_register_info *sleep_enable_reg_info;
+	struct acpi_object_list arg_list;
+	union acpi_object arg;
 	u32 in_value;
 	acpi_status status;
 
@@ -312,6 +309,19 @@ acpi_status asmlinkage acpi_enter_sleep_
 		return_ACPI_STATUS(status);
 	}
 
+	/* Execute the _GTS method */
+
+	arg.type = ACPI_TYPE_INTEGER;
+	arg.integer.value = sleep_state;
+
+	arg_list.count = 1;
+	arg_list.pointer = &arg;
+
+	status = acpi_evaluate_object(NULL, METHOD_NAME__GTS, &arg_list, NULL);
+	if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
+		return_ACPI_STATUS(status);
+	}
+
 	/* Get current value of PM1A control */
 
 	status = acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK,
#12 lore raw
Quoted 1 line · Rafael J. Wysocki

Hmm, perhaps we should do something more, like the following:

No, almost same thing. Screen goes blank, but then there is disk activity before poweroff. (That makes me a bit unsure as to whether there was disk activity with the previous patch, I might have missed it...) At the next boot it doesn't resume, just reboots from scratch.

Marcus

#13 lore raw
Quoted 7 lines · Marcus Better
Quoted 1 line · Rafael J. Wysocki

Hmm, perhaps we should do something more, like the following:

No, almost same thing. Screen goes blank, but then there is disk activity before poweroff. (That makes me a bit unsure as to whether there was disk activity with the previous patch, I might have missed it...) At the next boot it doesn't resume, just reboots from scratch.

Well, I wish I had your machine here!

If I may ask you to try some more patches, I'd like to check what exactly makes it work when the code ordering is changed.

Could you please apply the appended patch and see what happens?

Rafael

---
 drivers/acpi/hardware/hwsleep.c |   60 ----------------------------------------
 kernel/power/disk.c             |    4 +-
 kernel/power/user.c             |    8 ++---
 3 files changed, 6 insertions(+), 66 deletions(-)
kernel/power/disk.c +2 -2
Index: linux-2.6.21-rc7/kernel/power/disk.c
===================================================================
@@ -170,9 +170,9 @@ int pm_suspend_disk(void)
 
 	if (in_suspend) {
 		enable_nonboot_cpus();
-		platform_finish();
 		device_resume();
 		resume_console();
+		platform_finish();
 		pr_debug("PM: writing image.\n");
 		error = swsusp_write();
 		if (!error)
@@ -189,9 +189,9 @@ int pm_suspend_disk(void)
  Enable_cpus:
 	enable_nonboot_cpus();
  Resume_devices:
-	platform_finish();
 	device_resume();
 	resume_console();
+	platform_finish();
  Thaw:
 	unprepare_processes();
  Finish:
kernel/power/user.c +4 -4
Index: linux-2.6.21-rc7/kernel/power/user.c
===================================================================
@@ -170,11 +170,11 @@ static inline int snapshot_suspend(int p
 	}
 	enable_nonboot_cpus();
  Resume_devices:
+	device_resume();
+	resume_console();
 	if (platform_suspend)
 		platform_finish();
 
-	device_resume();
-	resume_console();
  Finish:
 	mutex_unlock(&pm_mutex);
 	return error;
@@ -202,11 +202,11 @@ static inline int snapshot_restore(int p
 
 	enable_nonboot_cpus();
  Resume_devices:
+	device_resume();
+	resume_console();
 	if (platform_suspend)
 		platform_finish();
 
-	device_resume();
-	resume_console();
  Finish:
 	pm_restore_console();
 	mutex_unlock(&pm_mutex);
drivers/acpi/hardware/hwsleep.c +0 -60

72 lines not on this page · raw message