Skip to contentSkip to conversation

Swsusp weirdness with ACPI

DISCUSSION Joshua Kwan 3 participants 5 messages Sep 13, 2003 – Sep 18, 2003

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

A few things to say about swsusp in 2.6.0-test5-mm1 on my Dell Smartstep laptop.

Here is my /proc/acpi/sleep:
S0 S3 S4 S4bios S5

- 0 doesn't seem to do anything.
- 3 will ONLY 'suspend' my laptop if all my USB devices are disconnected and I have removed my PCMCIA cards.

Furthermore, it won't resume. The fan will spin up, etc., but the LCD will not turn on.
- 4 nearly works. When it's suspending there will be an oops that flies by too quickly to read. It will turn off though, but when I reboot it, my swap partition will have been hosed:

"Unable to find swap-space signature" when trying to swapon

"PM: Reading swsusp image.
swsusp: Resume From partition: hda7, Device: unknown-block(0,0) Resume Machine: Error -6 resuming
PM: Resume from disk failed." when I try to resume.

I have to mkswap it again for stuff to work.
- 4bios behaves the same way as 4.
- 5 doesn't do anything.

So overall swsusp on my laptop is fairly broken. Has anyone gotten it to work on a similar laptop? Any possible fixes?

--
Joshua Kwan

#1 lore raw

Hi!

Quoted 6 lines

A few things to say about swsusp in 2.6.0-test5-mm1 on my Dell Smartstep laptop.

Here is my /proc/acpi/sleep:
S0 S3 S4 S4bios S5

Quoted 6 lines

- 0 doesn't seem to do anything.
- 3 will ONLY 'suspend' my laptop if all my USB devices are disconnected and I have removed my PCMCIA cards.

Furthermore, it won't resume. The fan will spin up, etc., but the LCD will not turn on.

Did it work on -test3? Video resume is a hard task :-(.

Quoted 3 lines

- 4 nearly works. When it's suspending there will be an oops that flies by too quickly to read. It will turn off though, but when I reboot it, my swap partition will have been hosed:

It looks more like WARN_ON(), no?

Quoted 8 lines

"Unable to find swap-space signature" when trying to swapon

"PM: Reading swsusp image.
swsusp: Resume From partition: hda7, Device: unknown-block(0,0) Resume Machine: Error -6 resuming
PM: Resume from disk failed." when I try to resume.

I have to mkswap it again for stuff to work.

Are you passing resume= option?

Quoted 1 line

- 4bios behaves the same way as 4.

Lets care about htat later. swsusp and S3 worked in -test3 [S3 only on some video boards.]

Quoted 1 line

- 5 doesn't do anything.

That's okay.

Quoted 2 lines

So overall swsusp on my laptop is fairly broken. Has anyone gotten it to work on a similar laptop? Any possible fixes?

Try -test5, with just this patch. No usb (Greg has a patch), no pcmcia (Patrick, how are we going to solve those PCMCIA problems?). Use attached program to trigger suspend.

Pavel

kernel/power/main.c +5 -68
@@ -172,31 +172,10 @@
 
 static int pm_suspend_disk(void)
 {
-	int error;
-
 	pr_debug("PM: Attempting to suspend to disk.\n");
 	if (pm_disk_mode == PM_DISK_FIRMWARE)
 		return pm_ops->enter(PM_SUSPEND_DISK);
-
-	if (!have_swsusp)
-		return -EPERM;
-
-	pr_debug("PM: snapshotting memory.\n");
-	in_suspend = 1;
-	if ((error = swsusp_save()))
-		goto Done;
-
-	if (in_suspend) {
-		pr_debug("PM: writing image.\n");
-		error = swsusp_write();
-		if (!error)
-			error = power_down(pm_disk_mode);
-		pr_debug("PM: Power down failed.\n");
-	} else
-		pr_debug("PM: Image restored successfully.\n");
-	swsusp_free();
- Done:
-	return error;
+	return 0;
 }
 
 
@@ -329,59 +308,17 @@
 
 int pm_suspend(u32 state)
 {
+	if ((state == PM_SUSPEND_DISK) && (pm_disk_mode != PM_DISK_FIRMWARE)) {
+		software_suspend();
+		return 0;
+	}
 	if (state > PM_SUSPEND_ON && state < PM_SUSPEND_MAX)
 		return enter_state(state);
 	return -EINVAL;
 }
 
-
-/**
- *	pm_resume - Resume from a saved image.
- *
- *	Called as a late_initcall (so all devices are discovered and 
- *	initialized), we call swsusp to see if we have a saved image or not.
- *	If so, we quiesce devices, the restore the saved image. We will 
- *	return above (in pm_suspend_disk() ) if everything goes well. 
- *	Otherwise, we fail gracefully and return to the normally 
- *	scheduled program.
- *
- */
-
-static int pm_resume(void)
-{
-	int error;
-
-	if (!have_swsusp)
-		return 0;
-
-	pr_debug("PM: Reading swsusp image.\n");
-
-	if ((error = swsusp_read()))
-		goto Done;
-
-	pr_debug("PM: Preparing system for restore.\n");
-
-	if ((error = suspend_prepare(PM_SUSPEND_DISK)))
-		goto Free;
-
-	pr_debug("PM: Restoring saved image.\n");
-	swsusp_restore();
-
-	pr_debug("PM: Restore failed, recovering.n");
-	suspend_finish(PM_SUSPEND_DISK);
- Free:
-	swsusp_free();
- Done:
-	pr_debug("PM: Resume from disk failed.\n");
-	return 0;
-}
-
-late_initcall(pm_resume);
-
-
 decl_subsys(power,NULL,NULL);
 
-
 #define power_attr(_name) \
 static struct subsys_attribute _name##_attr = {	\
 	.attr	= {				\
kernel/power/swsusp.c +322 -109

610 lines not on this page · raw message

include/linux/suspend.h +37 -2
@@ -8,7 +8,11 @@
 #include <linux/notifier.h>
 #include <linux/config.h>
 #include <linux/init.h>
-#include <linux/pm.h>
+
+extern unsigned char software_suspend_enabled;
+
+#define NORESUME	 1
+#define RESUME_SPECIFIED 2
 
 #ifdef CONFIG_SOFTWARE_SUSPEND
 /* page backup entry */
@@ -45,30 +49,61 @@
 /* mm/page_alloc.c */
 extern void drain_local_pages(void);
 
+/* kernel/suspend.c */
+extern void software_suspend(void);
+extern void software_resume(void);
+
+extern int register_suspend_notifier(struct notifier_block *);
+extern int unregister_suspend_notifier(struct notifier_block *);
+
 extern unsigned int nr_copy_pages __nosavedata;
 extern suspend_pagedir_t *pagedir_nosave __nosavedata;
 
+/* Communication between kernel/suspend.c and arch/i386/suspend.c */
+
+extern void do_magic_resume_1(void);
+extern void do_magic_resume_2(void);
+extern void do_magic_suspend_1(void);
+extern void do_magic_suspend_2(void);
+
 /* Communication between acpi and arch/i386/suspend.c */
 
 extern void do_suspend_lowlevel(int resume);
 extern void do_suspend_lowlevel_s4bios(int resume);
 
 #else	/* CONFIG_SOFTWARE_SUSPEND */
-static inline int software_suspend(void)
+static inline void software_suspend(void)
 {
+	printk("Warning: fake suspend called\n");
 	return -EPERM;
 }
+#define software_resume()		do { } while(0)
+#define register_suspend_notifier(a)	do { } while(0)
+#define unregister_suspend_notifier(a)	do { } while(0)
 #endif	/* CONFIG_SOFTWARE_SUSPEND */
 
 
 #ifdef CONFIG_PM
 extern void refrigerator(unsigned long);
+extern int freeze_processes(void);
+extern void thaw_processes(void);
+
+extern int pm_prepare_console(void);
+extern void pm_restore_console(void);
 
 #else
 static inline void refrigerator(unsigned long flag)
 {
 
 }
+static inline int freeze_processes(void)
+{
+	return 0;
+}
+static inline void thaw_processes(void)
+{
+
+}
 #endif	/* CONFIG_PM */
 
 #endif /* _LINUX_SWSUSP_H */
kernel/sys.c +5 -2
@@ -456,8 +456,11 @@
 
 #ifdef CONFIG_SOFTWARE_SUSPEND
 	case LINUX_REBOOT_CMD_SW_SUSPEND:
-		if (!pm_suspend(PM_SUSPEND_DISK))
-			break;
+		if (!software_suspend_enabled) {
+			unlock_kernel();
+			return -EAGAIN;
+		}
+		software_suspend();
 		do_exit(0);
 		break;
 #endif
Signature · 2 lines
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]
#2 lore raw
In reply to Joshua Kwan
Quoted 5 lines

Here is my /proc/acpi/sleep:
S0 S3 S4 S4bios S5

- 0 doesn't seem to do anything.

0 is 'On'. It will not do anything.

Quoted 2 lines

- 3 will ONLY 'suspend' my laptop if all my USB devices are disconnected and I have removed my PCMCIA cards.

Do you physically have to remove the devices or can you simply remove the modules?

Quoted 2 lines

Furthermore, it won't resume. The fan will spin up, etc., but the LCD will not turn on.

Noted. This is a common problem that we're trying to get to the bottom of.

Quoted 4 lines

- 4 nearly works. When it's suspending there will be an oops that flies by too quickly to read. It will turn off though, but when I reboot it, my swap partition will have been hosed:

Quoted 8 lines

"Unable to find swap-space signature" when trying to swapon

"PM: Reading swsusp image.
swsusp: Resume From partition: hda7, Device: unknown-block(0,0) Resume Machine: Error -6 resuming
PM: Resume from disk failed." when I try to resume.

I have to mkswap it again for stuff to work.

Interesting. That backtrace and the cause (whether it's an actual Oops, a BUG() or a WARN_ON()) is important. Is there anyway you could hook up a serial console to capture the output?

Also, if you're willing, I would recommend trying 2.6.0-test5-mm2, which will allow you to try the original swsusp code (via /proc/acpi/sleep) independently of the more recent suspend-to-disk code (via /sys/power/state).

Thanks,

Pat

#3 lore raw
Quoted 4 lines · Patrick Mochel

Also, if you're willing, I would recommend trying 2.6.0-test5-mm2, which will allow you to try the original swsusp code (via /proc/acpi/sleep) independently of the more recent suspend-to-disk code (via /sys/power/state).

With 2.6.0-test5-mm2,

- 4/4bios don't do anything
- 3 will stop tasks... I got a "<6>Strange, ircd not stopped" once, and I removed my wifi card and it was good. (Yes, ircd was listening on it.)

But after all of this hubbub it still won't come back to life. :(

I will try the other stuff later, I'm short of time these days. Thanks for your help so far.

Signature · 1 line
Joshua Kwan
#4 lore raw

Hi!

Quoted 12 lines
Quoted 4 lines

Also, if you're willing, I would recommend trying 2.6.0-test5-mm2, which will allow you to try the original swsusp code (via /proc/acpi/sleep) independently of the more recent suspend-to-disk code (via /sys/power/state).

With 2.6.0-test5-mm2,

- 4/4bios don't do anything
- 3 will stop tasks... I got a "<6>Strange, ircd not stopped" once, and I removed my wifi card and it was good. (Yes, ircd was listening on it.)

Quoted 4 lines

But after all of this hubbub it still won't come back to life. :(

I will try the other stuff later, I'm short of time these days. Thanks for your help so far.

Can you try to do reboot(SW_SUSPEND) syscall? Did it work with -test3?
Pavel

Signature · 2 lines
				Pavel
Written on sharp zaurus, because my Velo1 broke. If you have Velo you don't need...