From 08605acc7e3b7974e309d73ddf39ee9464d95e51 Mon Sep 17 00:00:00 2001 From: Zhang Rui Date: Wed, 27 Mar 2013 03:36:10 +0000 Subject: [PATCH 1/3] PM / sleep: add TEST_PLATFORM support for freeze state Invoke freeze_enter() after suspend_test(TEST_PLATFORM) being invoked. So when setting /sys/power/pm_test to "platform", it can be used to check if freeze state is working well after all devices are suspended and before processors are blocked, Signed-off-by: Zhang Rui Signed-off-by: Rafael J. Wysocki --- kernel/power/suspend.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c index d4feda084a3a..5eb30aab9b99 100644 --- a/kernel/power/suspend.c +++ b/kernel/power/suspend.c @@ -184,6 +184,9 @@ static int suspend_enter(suspend_state_t state, bool *wakeup) goto Platform_wake; } + if (suspend_test(TEST_PLATFORM)) + goto Platform_wake; + /* * PM_SUSPEND_FREEZE equals * frozen processes + suspended devices + idle processors. @@ -195,9 +198,6 @@ static int suspend_enter(suspend_state_t state, bool *wakeup) goto Platform_wake; } - if (suspend_test(TEST_PLATFORM)) - goto Platform_wake; - error = disable_nonboot_cpus(); if (error || suspend_test(TEST_CPUS)) goto Enable_cpus; From c26b78a2d826a89cd689527493a2bea22af46133 Mon Sep 17 00:00:00 2001 From: Zhang Rui Date: Wed, 27 Mar 2013 03:36:11 +0000 Subject: [PATCH 2/3] PM / sleep: invalidate TEST_CPUS and TEST_CORE support for freeze state freeze state is a software suspend state that does not run into low-level platform callbacks which may interact with BIOS. And freeze state does not need to disable the processors. But the current pm_test support misleads users because users can enter freeze state with pm_test set to TEST_CPUS/TEST_CORE, while this pm_test setting never takes actions. So, invalidate TEST_CPUS/TEST_CORE for freeze state in this patch. Then users will get an error instead, when trying to enter freeze state with pm_test mode set to TEST_CPUS/TEST_CORE. Signed-off-by: Zhang Rui Signed-off-by: Rafael J. Wysocki --- kernel/power/suspend.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c index 5eb30aab9b99..bef86d121eb2 100644 --- a/kernel/power/suspend.c +++ b/kernel/power/suspend.c @@ -76,8 +76,20 @@ EXPORT_SYMBOL_GPL(suspend_set_ops); bool valid_state(suspend_state_t state) { - if (state == PM_SUSPEND_FREEZE) - return true; + if (state == PM_SUSPEND_FREEZE) { +#ifdef CONFIG_PM_DEBUG + if (pm_test_level != TEST_NONE && + pm_test_level != TEST_FREEZER && + pm_test_level != TEST_DEVICES && + pm_test_level != TEST_PLATFORM) { + printk(KERN_WARNING "Unsupported pm_test mode for " + "freeze state, please choose " + "none/freezer/devices/platform.\n"); + return false; + } +#endif + return true; + } /* * PM_SUSPEND_STANDBY and PM_SUSPEND_MEMORY states need lowlevel * support and need to be valid to the lowlevel From cd787b345e82f7ea9c29d22c50cca29fadc53d76 Mon Sep 17 00:00:00 2001 From: Nishanth Menon Date: Tue, 26 Mar 2013 18:01:49 +0000 Subject: [PATCH 3/3] PM / OPP: add documentation to RCU head in struct opp commit dde8437 (PM / OPP: RCU reclaim) introduced rcu_head for struct opp. This aids freeing using kfree_rcu. However, we missed adding documentation for the same. This generates kernel doc warning: Warning(drivers/base/power/opp.c:70): No description found for parameter 'head' Add documentation as appropriate. [rjw: Changelog] Signed-off-by: Nishanth Menon Signed-off-by: Rafael J. Wysocki --- drivers/base/power/opp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c index 32ee0fc7ea54..f0077cb8e249 100644 --- a/drivers/base/power/opp.c +++ b/drivers/base/power/opp.c @@ -55,6 +55,7 @@ * @rate: Frequency in hertz * @u_volt: Nominal voltage in microvolts corresponding to this OPP * @dev_opp: points back to the device_opp struct this opp belongs to + * @head: RCU callback head used for deferred freeing * * This structure stores the OPP information for a given device. */