On Wednesday 09 August 2006 11:30, Sheer El-Showk wrote:
> Hi Guys,
> 
> Again, thanks for all the input. Stefan my machine is new.  I bought it less
> than two years ago and it was a very expensive laptop ;->  Its a Sony A190
> (the ones with the giant screens that are completely unportable) and in
> Windows resume is pretty fast (its been a while since i tested it but it was
> < 5 secs I'd say).  I'll check later but I also think windows doesn't
> consume battery nearly as quickly when suspending to ram (this is probably
> the issue Pavel brought up so I'll try and look into it).
> 
> When I wake the machine from a suspend the console comes back up instantly
> telling me that its "Restarting tasks" but then it sits there for about 30
> seconds (I've timed it many times and its pretty consistent) before finally
> going to X.  I've gone through the logs to try and find out where its
> spending the time but the log times don't seem reliable to me because I
> think suspend messages from before and after suspending often get mixed into
> the log.  In any case its not clear to me from the log whether the messages
> are tasks being restarted after X is already up (such as dhcp, etc...) or
> while I still see the console.  I also modified the 'restore_after_sleep'
> function in /usr/lib/powersave/scripts to print out the time before each
> message but it seems like all the things happening in that script happen
> almost instantaneously.  It gets called from restore_after_suspend_to_ram
> which basically doesn't do anything else.
> 
> I don't really know how powersave is setup but I presume if I just call
> s2ram manually from the console that this does not run any scripts or
> anything on resume right?  But when I try s2ram manually it still takes ~30
> seconds to get me back to X windows.  I see the console immediately but it
> just sits there saying 'Restarting tasks' so it seems to me like whatever is
> happening is happening in the kernel.
> 
> Any suggestions as to how I can debug this issue?

Please apply the appended patch and try the following:

(1)
# echo testproc > /sys/power/disk
# echo disk > /sys/power/state

This should freeze all processes, wait for 5 seconds and thaw the processes.

(2)
# echo test > /sys/power/disk
# echo disk > /sys/power/state

This should freeze all processes, shrink memory, suspend all devices, wait
for 5 seconds, resume the devices etc.

Let's see if you can reproduce the delay with any of (1), (2).

Greetings,
Rafael


---
 include/linux/pm.h  |    4 +++-
 kernel/power/disk.c |   37 ++++++++++++++++++++++++++++---------
 2 files changed, 31 insertions(+), 10 deletions(-)

Index: linux-2.6.18-rc3-mm2/include/linux/pm.h
===================================================================
--- linux-2.6.18-rc3-mm2.orig/include/linux/pm.h
+++ linux-2.6.18-rc3-mm2/include/linux/pm.h
@@ -116,7 +116,9 @@ typedef int __bitwise suspend_disk_metho
 #define        PM_DISK_PLATFORM        ((__force suspend_disk_method_t) 2)
 #define        PM_DISK_SHUTDOWN        ((__force suspend_disk_method_t) 3)
 #define        PM_DISK_REBOOT          ((__force suspend_disk_method_t) 4)
-#define        PM_DISK_MAX             ((__force suspend_disk_method_t) 5)
+#define        PM_DISK_TEST            ((__force suspend_disk_method_t) 5)
+#define        PM_DISK_TESTPROC        ((__force suspend_disk_method_t) 6)
+#define        PM_DISK_MAX             ((__force suspend_disk_method_t) 7)
 
 struct pm_ops {
        suspend_disk_method_t pm_disk_mode;
Index: linux-2.6.18-rc3-mm2/kernel/power/disk.c
===================================================================
--- linux-2.6.18-rc3-mm2.orig/kernel/power/disk.c
+++ linux-2.6.18-rc3-mm2/kernel/power/disk.c
@@ -70,7 +70,7 @@ static inline void platform_finish(void)
 
 static int prepare_processes(void)
 {
-       int error;
+       int error = 0;
 
        pm_prepare_console();
 
@@ -83,6 +83,12 @@ static int prepare_processes(void)
                goto thaw;
        }
 
+       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. */
        if (!(error = swsusp_shrink_memory()))
                return 0;
@@ -119,11 +125,19 @@ int pm_suspend_disk(void)
        if (error)
                return error;
 
+       if (pm_disk_mode == PM_DISK_TESTPROC)
+               goto Thaw;
+
        error = device_suspend(PMSG_FREEZE);
        if (error) {
                printk("Some devices failed to suspend\n");
-               unprepare_processes();
-               return error;
+               goto Thaw;
+       }
+
+       if (pm_disk_mode == PM_DISK_TEST) {
+               printk("swsusp debug: Waiting for 5 seconds.\n");
+               mdelay(5000);
+               goto Done;
        }
 
        pr_debug("PM: snapshotting memory.\n");
@@ -139,15 +153,16 @@ int pm_suspend_disk(void)
                        power_down(pm_disk_mode);
                else {
                        swsusp_free();
-                       unprepare_processes();
-                       return error;
+                       goto Thaw;
                }
-       } else
+       } else {
                pr_debug("PM: Image restored successfully.\n");
+       }
 
        swsusp_free();
  Done:
        device_resume();
+ Thaw:
        unprepare_processes();
        return error;
 }
@@ -241,6 +256,8 @@ static const char * const pm_disk_modes[
        [PM_DISK_PLATFORM]      = "platform",
        [PM_DISK_SHUTDOWN]      = "shutdown",
        [PM_DISK_REBOOT]        = "reboot",
+       [PM_DISK_TEST]          = "test",
+       [PM_DISK_TESTPROC]      = "testproc",
 };
 
 /**
@@ -295,17 +312,19 @@ static ssize_t disk_store(struct subsyst
                }
        }
        if (mode) {
-               if (mode == PM_DISK_SHUTDOWN || mode == PM_DISK_REBOOT)
+               if (mode == PM_DISK_SHUTDOWN || mode == PM_DISK_REBOOT ||
+                    mode == PM_DISK_TEST || mode == PM_DISK_TESTPROC) {
                        pm_disk_mode = mode;
-               else {
+               } else {
                        if (pm_ops && pm_ops->enter &&
                            (mode == pm_ops->pm_disk_mode))
                                pm_disk_mode = mode;
                        else
                                error = -EINVAL;
                }
-       } else
+       } else {
                error = -EINVAL;
+       }
 
        pr_debug("PM: suspend-to-disk mode set to '%s'\n",
                 pm_disk_modes[mode]);

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Suspend-devel mailing list
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel

Reply via email to