Hi,
The following patches add a new testing facility for suspend and hibernation.
The first patch adds the possibility to test the suspend (STD) core code
without actually suspending, which is useful for tracking problems with drivers
etc.The second one modifies the hibernation core so that it can use the same
facility (it's a bit more powerful than the existing hibernation test modes,
since they really can't test the ACPI global methods).The third one modified documentation in accordance with the two previous ones.
Comments welcome.
Greetings,
Rafael--
"Premature optimization is the root of all evil." - Donald Knuth-
From: Rafael J. Wysocki <rjw@sisk.pl>
Update the suspend/hibernation debugging and testing documentation to describe
the newly introduced testing facilities.Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
Documentation/power/basic-pm-debugging.txt | 188 ++++++++++++++++++++---------
Documentation/power/drivers-testing.txt | 28 ++--
2 files changed, 149 insertions(+), 67 deletions(-)Index: linux-2.6/Documentation/power/drivers-testing.txt
===================================================================
--- linux-2.6.orig/Documentation/power/drivers-testing.txt
+++ linux-2.6/Documentation/power/drivers-testing.txt
@@ -6,9 +6,9 @@ Testing suspend and resume support in de
Unfortunately, to effectively test the support for the system-wide suspend and
resume transitions in a driver, it is necessary to suspend and resume a fully
functional system with this driver loaded. Moreover, that should be done
-several times, preferably several times in a row, and separately for the suspend
-to disk (STD) and the suspend to RAM (STR) transitions, because each of these
-cases involves different ordering of operations and different interactions with
+several times, preferably several times in a row, and separately for hibernation
+(aka suspend to disk or STD) and suspend to RAM (STR), because each of these
+cases involves slightly different operations and different interactions with
the machine's BIOS.Of course, for this purpose the test system has to be known to suspend and
@@ -22,20 +22,24 @@ for more information about the debugging
Once you have resolved the suspend/resume-related problems with your test system
without the new driver, you are ready to test it:-a) Build the driver as a module, load it and try the STD in the test mode (see:
-Documents/power/basic-pm-debugging.txt, 1a)).
+a) Build the driver as a module, load it and try the test modes of hibernation
+(see: Documents/power/basic-pm-debugging.txt, 1)).-b) Load the driver and attempt...
From: Rafael J. Wysocki <rjw@sisk.pl>
Make it possible to test the hibernation core code with the help of the
/sys/power/pm_test_level attribute introduced for suspend testing in the
previous patch.Writing a number (1-5) to this file causes the hibernation code to work in one
of the test modes defined as follows:5 - test the freezing of processes
4 - test the freezing of processes and suspending of devices
3 - test the freezing of processes, suspending of devices and platform global
control methods(*)
2 - test the freezing of processes, suspending of devices, platform global
control methods(*) and the disabling of nonboot CPUs
1 - test the freezing of processes, suspending of devices, platform global
control methods(*), the disabling of nonboot CPUs and suspending of
platform/system devices(*) - the platform global control methods are only available on ACPI systems
and are only tested if the hibernation mode is set to "platform"Then, if a hibernation is started by normal means, the hibernation core will
perform its normal operations up to the point indicated by the test level.
Next, it will wait for 5 seconds and carry out the resume operations needed to
transition the system back to the fully functional state.Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
kernel/power/disk.c | 70 ++++++++++++++++++++++++++++++++++++++++-----------
kernel/power/power.h | 2 +
2 files changed, 57 insertions(+), 15 deletions(-)Index: linux-2.6/kernel/power/disk.c
===================================================================
--- linux-2.6.orig/kernel/power/disk.c
+++ linux-2.6/kernel/power/disk.c
@@ -70,6 +70,35 @@ void hibernation_set_ops(struct platform
mutex_unlock(&pm_mutex);
}+#ifdef CONFIG_PM_DEBUG
+static void hibernation_debug_sleep(void)
+{
+ printk(KERN_INFO "hibernation debug: Waiting for 5 seconds.\n");
+ mdelay(5000);
+}
+
+static int hibernation_testmode(int mode)
+{
+ if (hibernation_mode == mod...
From: Rafael J. Wysocki <rjw@sisk.pl>
Introduce /sys/power/pm_test_level attribute allowing one to test the suspend
core code. Namely, writing a number (1-5) to this file causes the suspend code
to work in one of the test modes defined as follows:5 - test the freezing of processes
4 - test the freezing of processes and suspending of devices
3 - test the freezing of processes, suspending of devices and platform global
control methods
2 - test the freezing of processes, suspending of devices, platform global
control methods and the disabling of nonboot CPUs
1 - test the freezing of processes, suspending of devices, platform global
control methods, the disabling of nonboot CPUs and suspending of
platform/system devicesThen, if a suspend is started by normal means, the suspend core will perform
its normal operations up to the point indicated by the test level. Next, it
will wait for 5 seconds and carry out the resume operations needed to transition
the system back to the fully functional state.Writing 0 to /sys/power/pm_test_level turns the testing off. The current test
level may be read from /sys/power/pm_test_level .Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
kernel/power/main.c | 75 ++++++++++++++++++++++++++++++++++++++++++++-------
kernel/power/power.h | 10 ++++++
2 files changed, 76 insertions(+), 9 deletions(-)Index: linux-2.6/kernel/power/main.c
===================================================================
--- linux-2.6.orig/kernel/power/main.c
+++ linux-2.6/kernel/power/main.c
@@ -28,6 +28,46 @@ BLOCKING_NOTIFIER_HEAD(pm_chain_head);DEFINE_MUTEX(pm_mutex);
+#ifdef CONFIG_PM_DEBUG
+int pm_test_level = TEST_NONE;
+
+static int suspend_test(int level)
+{
+ if (pm_test_level == level) {
+ printk(KERN_INFO "suspend debug: Waiting for 5 seconds.\n");
+ mdelay(5000);
+ return 1;
+ }
+ return 0;
+}
+
+static ssize_t pm_test_level_show(struct kset *kset, char *buf)
+{
+ return sprintf(buf, "%d\...
ACK on whole series, but... should we also remove the old debugging
infrastructure? (Or did I just miss it?)
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
-
Hi,
Well, I don't want to remove it just yet, but it's going to be deprecated.
Also, after Johannes' remark I thought it wouldn't be a good idea to export the
bare test levels to the user. For this reason I reworked the patches to use
strings instead of numbers for the test setting (the attribute is now called
"pm_test" and is used in a similar way to "disk").I'll post the reworked series as soon as I update the changelogs and docs.
Greetings,
Rafael
-
Without reading the code, I assume that this enum controls those levels.
I think a comment that it is user-space visible API and should not be
reordered would be warranted.johannes
Yes, you are right. I'll add the comment.
Thanks,
Rafael
-
| Greg KH | [GIT PATCH] driver core patches against 2.6.24 |
| Andi Kleen | [PATCH x86] [0/16] Various i386/x86-64 changes |
| Vladislav Bolkhovitin | Re: Integration of SCST in the mainstream Linux kernel |
| Tarkan Erimer | Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3 |
git: | |
| Gerrit Renker | [PATCH 0/37] dccp: Feature negotiation - last call for comments |
| Jarek Poplawski | Re: [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| Natalie Protasevich | [BUG] New Kernel Bugs |
| Arjan van de Ven | Re: [GIT]: Networking |
