PM: fix pm_test support for freeze state
Subsystems (2)
PATCH 1/1 PM: fix pm_test support for freeze state
Quoted 1 line
From
d6e5d4f4e8b9a8af79fa50d8e13b14c89d8a9264Mon Sep 17 00:00:00 2001
From: Zhang Rui <[email protected]>
Date: Wed, 6 Mar 2013 21:22:21 +0800
Subject: [PATCH] PM: fix pm_test 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. Thus we should disable TEST_CPUS and TEST_CORE mode when running pm_test for freeze state.
Fix the problem so that users will get a warning message and fail to enter freeze state, when pm_test mode is set to TEST_CPUS/TEST_CORE.
Plus, change the code so that freeze_enter() is invoked after suspend_test(TEST_PLATFORM) being invoked, then pm_test can be used to check if freeze state is working well after all devices are suspended and before processors are blocked.
--- kernel/power/suspend.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
kernel/power/suspend.c +10 -2
@@ -76,8 +76,16 @@ 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 ) { +if (pm_test_level ==TEST_NONE || + pm_test_level ==TEST_FREEZER || + pm_test_level ==TEST_DEVICES || + pm_test_level ==TEST_PLATFORM ) +return true; +printk (KERN_WARNING "Unsupported pm_test mode for freeze state," +" please choose none/freezer/devices/platform.\n" ); +return false; + }/* * PM_SUSPEND_STANDBY and PM_SUSPEND_MEMORY states need lowlevel * support and need to be valid to the lowlevel
@@ -184,6 +192,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 +206,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;
Signature · 1 line
1.7.9.5
Quoted 11 lines · Zhang Rui
From
d6e5d4f4e8b9a8af79fa50d8e13b14c89d8a9264Mon Sep 17 00:00:00 2001
From: Zhang Rui <[email protected]>
Date: Wed, 6 Mar 2013 21:22:21 +0800
Subject: [PATCH] PM: fixpm_testsupport for freeze statefreeze 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. Thus we should disable
TEST_CPUSandTEST_COREmode when runningpm_testfor freeze state.
Quoted 7 lines
Fix the problem so that users will get a warning message and fail to enter freeze state, when
pm_testmode is set to TEST_CPUS/TEST_CORE.Plus, change the code so that
freeze_enter()is invoked aftersuspend_test(TEST_PLATFORM)being invoked, thenpm_testcan be used to check if freeze state is working well after all devices are suspended and before processors are blocked.
Can you please do one change per patch? The second change is not related to the first one and I don't think it is correct event.
Thanks,
Rafael
Quoted 51 lines
Signed-off-by Zhang Rui <[email protected]>--- kernel/power/suspend.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)kernel/power/suspend.c +13
-2@@ -76,8 +76,16 @@ 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 ) { +if (pm_test_level ==TEST_NONE || + pm_test_level ==TEST_FREEZER || + pm_test_level ==TEST_DEVICES || + pm_test_level ==TEST_PLATFORM ) +return true; +printk (KERN_WARNING "Unsupported pm_test mode for freeze state," +" please choose none/freezer/devices/platform.\n" ); +return false; + }/* * PM_SUSPEND_STANDBY and PM_SUSPEND_MEMORY states need lowlevel * support and need to be valid to the lowlevel @@ -184,6 +192,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 kernel/power/suspend.c +0
-3* frozen processes + suspended devices + idle processors. @@ -195,9 +206,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;
Signature · 2 lines
I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.
Quoted 15 lines · Rafael J. Wysocki
Quoted 14 lines · Zhang Rui
From
d6e5d4f4e8b9a8af79fa50d8e13b14c89d8a9264Mon Sep 17 00:00:00 2001
From: Zhang Rui <[email protected]>
Date: Wed, 6 Mar 2013 21:22:21 +0800
Subject: [PATCH] PM: fixpm_testsupport for freeze statefreeze 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. Thus we should disable
TEST_CPUSandTEST_COREmode when runningpm_testfor freeze state.Fix the problem so that users will get a warning message and fail to enter freeze state, when
pm_testmode is set to TEST_CPUS/TEST_CORE.
Quoted 6 lines
Quoted 4 lines
Plus, change the code so that
freeze_enter()is invoked aftersuspend_test(TEST_PLATFORM)being invoked, thenpm_testcan be used to check if freeze state is working well after all devices are suspended and before processors are blocked.Can you please do one change per patch?
okay. will do that.
Quoted 2 lines
The second change is not related
to the first one
right.
Quoted 2 lines
and I don't think it is correct event.
hmmm,
do you mean two changes in one patch is wrong or do you mean the code for the second change is wrong?
thanks,
rui
Quoted 55 lines
Thanks,
RafaelQuoted 51 lines
Signed-off-by Zhang Rui <[email protected]>--- kernel/power/suspend.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)kernel/power/suspend.c +13
-2@@ -76,8 +76,16 @@ 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 ) { +if (pm_test_level ==TEST_NONE || + pm_test_level ==TEST_FREEZER || + pm_test_level ==TEST_DEVICES || + pm_test_level ==TEST_PLATFORM ) +return true; +printk (KERN_WARNING "Unsupported pm_test mode for freeze state," +" please choose none/freezer/devices/platform.\n" ); +return false; + }/* * PM_SUSPEND_STANDBY and PM_SUSPEND_MEMORY states need lowlevel * support and need to be valid to the lowlevel @@ -184,6 +192,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 kernel/power/suspend.c +0
-3* frozen processes + suspended devices + idle processors. @@ -195,9 +206,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;
Quoted 28 lines · Zhang Rui
Quoted 15 lines · Rafael J. Wysocki
Quoted 14 lines · Zhang Rui
From
d6e5d4f4e8b9a8af79fa50d8e13b14c89d8a9264Mon Sep 17 00:00:00 2001
From: Zhang Rui <[email protected]>
Date: Wed, 6 Mar 2013 21:22:21 +0800
Subject: [PATCH] PM: fixpm_testsupport for freeze statefreeze 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. Thus we should disable
TEST_CPUSandTEST_COREmode when runningpm_testfor freeze state.Fix the problem so that users will get a warning message and fail to enter freeze state, when
pm_testmode is set to TEST_CPUS/TEST_CORE.Quoted 6 lines
Quoted 4 lines
Plus, change the code so that
freeze_enter()is invoked aftersuspend_test(TEST_PLATFORM)being invoked, thenpm_testcan be used to check if freeze state is working well after all devices are suspended and before processors are blocked.Can you please do one change per patch?
okay. will do that.
Quoted 2 lines
The second change is not related
to the first one
Quoted 7 lines
right.
Quoted 2 lines
and I don't think it is correct event.
hmmm,
do you mean two changes in one patch is wrong or do you mean the code for the second change is wrong?
I thought that the second change code wasn't correct, but I seem to have confused things.
Please split it off, though.
Thanks,
Rafael
Quoted 53 lines
Quoted 51 lines
Quoted 51 lines
Signed-off-by Zhang Rui <[email protected]>--- kernel/power/suspend.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)kernel/power/suspend.c +13
-2@@ -76,8 +76,16 @@ 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 ) { +if (pm_test_level ==TEST_NONE || + pm_test_level ==TEST_FREEZER || + pm_test_level ==TEST_DEVICES || + pm_test_level ==TEST_PLATFORM ) +return true; +printk (KERN_WARNING "Unsupported pm_test mode for freeze state," +" please choose none/freezer/devices/platform.\n" ); +return false; + }/* * PM_SUSPEND_STANDBY and PM_SUSPEND_MEMORY states need lowlevel * support and need to be valid to the lowlevel @@ -184,6 +192,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 kernel/power/suspend.c +0
-3* frozen processes + suspended devices + idle processors. @@ -195,9 +206,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;
Signature · 2 lines
I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.