From: Andrew Morton <akpm@osdl.org>
To: Pavel Machek <pavel@ucw.cz>
Cc: Nigel Cunningham <ncunningham@linuxmail.org>,
Stefan Seyfried <seife@suse.de>,
linux-kernel@vger.kernel.org, "Rafael J. Wysocki" <rjw@sisk.pl>
Subject: Re: When will the lunacy end? (Was Re: [PATCH] uswsusp: add pmops->{prepare,enter,finish} support (aka "platform mode"))
Date: Wed, 27 Sep 2006 14:08:08 -0700 [thread overview]
Message-ID: <20060927140808.2aece78e.akpm@osdl.org> (raw)
In-Reply-To: <20060927090902.GC24857@elf.ucw.cz>
On Wed, 27 Sep 2006 11:09:02 +0200
Pavel Machek <pavel@ucw.cz> wrote:
> Hi!
>
> > > Is "swapoff -a; echo disk > /sys/power/state" slow for you? If so, we
> > > have something reasonably easy to debug, if not, we'll try something
> > > else...
> >
> > sony:/home/akpm# swapoff -a
> > sony:/home/akpm# time (echo disk > /sys/power/state)
> > echo: write error: no such device
> > (; echo disk > /sys/power/state; ) 0.00s user 0.08s system 1% cpu 5.259 total
> >
> > It took an additional two-odd seconds to bring the X UI back into a serviceable
> > state.
>
> Console switches take long... yes it would be nice to fix X :-).
>
> But we did not reproduce that 12 seconds problem. Can you try patches
> from
>
> http://marc.theaimsgroup.com/?l=linux-acpi&m=115506915023030&q=raw
>
OK, that compiles.
I think we should get this documented and merge it (or something like it) into
mainline. This is one area where it's worth investing in debugging tools.
If you agree, are we happy with it in its present form?
From: "Rafael J. Wysocki" <rjw@sisk.pl>
Add a swsusp debugging mode. This does everything that's needed for a suspend
except for actually suspending. So we can look in the log messages and work
out a) what code is being slow and b) which drivers are misbehaving.
(1)
# echo testproc > /sys/power/disk
# echo disk > /sys/power/state
This should turn off the non-boot CPU, freeze all processes, wait for 5
seconds and then thaw the processes and the CPU.
(2)
# echo test > /sys/power/disk
# echo disk > /sys/power/state
This should turn off the non-boot CPU, freeze all processes, shrink
memory, suspend all devices, wait for 5 seconds, resume the devices etc.
Cc: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---
include/linux/pm.h | 4 +++-
kernel/power/disk.c | 37 ++++++++++++++++++++++++++++---------
2 files changed, 31 insertions(+), 10 deletions(-)
diff -puN include/linux/pm.h~swsusp-debugging include/linux/pm.h
--- a/include/linux/pm.h~swsusp-debugging
+++ a/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;
diff -puN kernel/power/disk.c~swsusp-debugging kernel/power/disk.c
--- a/kernel/power/disk.c~swsusp-debugging
+++ a/kernel/power/disk.c
@@ -72,7 +72,7 @@ static inline void platform_finish(void)
static int prepare_processes(void)
{
- int error;
+ int error = 0;
pm_prepare_console();
@@ -85,6 +85,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;
@@ -121,13 +127,21 @@ int pm_suspend_disk(void)
if (error)
return error;
+ if (pm_disk_mode == PM_DISK_TESTPROC)
+ goto Thaw;
+
suspend_console();
error = device_suspend(PMSG_FREEZE);
if (error) {
resume_console();
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");
@@ -144,16 +158,17 @@ 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();
resume_console();
+ Thaw:
unprepare_processes();
return error;
}
@@ -250,6 +265,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",
};
/**
@@ -304,17 +321,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]);
_
next prev parent reply other threads:[~2006-09-27 21:08 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-25 7:13 [PATCH] uswsusp: add pmops->{prepare,enter,finish} support (aka "platform mode") Stefan Seyfried
2006-09-25 8:12 ` Rafael J. Wysocki
2006-09-25 8:17 ` Pavel Machek
2006-09-25 19:02 ` Rafael J. Wysocki
2006-09-25 21:34 ` When will the lunacy end? (Was Re: [PATCH] uswsusp: add pmops->{prepare,enter,finish} support (aka "platform mode")) Nigel Cunningham
2006-09-25 21:45 ` Andrew Morton
2006-09-25 22:45 ` Pavel Machek
2006-09-25 23:06 ` Andrew Morton
2006-09-25 23:21 ` Pavel Machek
2006-09-26 0:22 ` Andrew Morton
2006-09-26 10:08 ` Stefan Seyfried
2006-09-26 10:24 ` Pavel Machek
2006-09-26 16:46 ` Andrew Morton
2006-09-27 9:09 ` Pavel Machek
2006-09-27 21:08 ` Andrew Morton [this message]
2006-09-27 21:13 ` Rafael J. Wysocki
2006-09-27 21:34 ` Pavel Machek
2006-09-27 22:58 ` Andrew Morton
2006-09-27 23:18 ` Pavel Machek
2006-09-26 19:46 ` Rafael J. Wysocki
2006-09-26 16:45 ` Bryan O'Sullivan
2006-09-26 17:44 ` Alan Cox
2006-09-26 17:29 ` Bryan O'Sullivan
2006-09-27 9:09 ` Pavel Machek
2006-09-26 19:56 ` Rafael J. Wysocki
2006-09-26 20:14 ` Adrian Bunk
2006-09-26 20:35 ` Rafael J. Wysocki
2006-09-26 21:38 ` Nigel Cunningham
2006-09-26 22:31 ` Adrian Bunk
2006-09-26 22:51 ` Rafael J. Wysocki
2006-09-26 23:05 ` Nigel Cunningham
2006-09-26 23:31 ` Rafael J. Wysocki
2006-09-26 23:39 ` Adrian Bunk
2006-09-27 0:16 ` Andrew Morton
2006-09-27 5:12 ` Rafael J. Wysocki
2006-09-27 5:39 ` Nigel Cunningham
2006-09-27 6:00 ` Andrew Morton
2006-09-27 7:47 ` Rafael J. Wysocki
2006-09-27 8:58 ` Pavel Machek
2006-09-27 9:02 ` Pavel Machek
2006-09-27 23:21 ` Adrian Bunk
2006-09-28 10:59 ` Rafael J. Wysocki
2006-09-26 23:43 ` Nigel Cunningham
2006-09-25 22:34 ` Pavel Machek
2006-09-26 10:12 ` Stefan Seyfried
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060927140808.2aece78e.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ncunningham@linuxmail.org \
--cc=pavel@ucw.cz \
--cc=rjw@sisk.pl \
--cc=seife@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox