Cpufreq: Keep cpufreq sysfs nodes across S2RAM/S2DISK when using intel_pstate driver.
PATCH 1/1 Cpufreq: Keep cpufreq sysfs nodes across S2RAM/S2DISK when using intel_pstate driver.
Cpufreq core introduces cpufreq_suspended flag to let cpufreq sysfs nodes across S2RAM/S2DISK. But the flag is only set in the cpufreq_suspend() for cpufreq drivers which have target or target_index callback. This skips intel_pstate driver. This patch is to set the flag before checking target or target_index callback.
--- drivers/cpufreq/cpufreq.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/cpufreq/cpufreq.c +4 -4
@@ -1656,6 +1656,8 @@ void cpufreq_suspend(void)if (!cpufreq_driver)return ; + cpufreq_suspended = true; +if (!has_target ())return ;
@@ -1670,8 +1672,6 @@ void cpufreq_suspend(void)pr_err ("%s: Failed to suspend driver: %p\n" , __func__, policy); } - - cpufreq_suspended = true; }/**
@@ -1687,13 +1687,13 @@ void cpufreq_resume(void)if (!cpufreq_driver)return ; + cpufreq_suspended = false; +if (!has_target ())return ;pr_debug ("%s: Resuming Governors\n" , __func__); - cpufreq_suspended = false; -list_for_each_entry (policy, &cpufreq_policy_list, policy_list) {if (cpufreq_driver->resume && cpufreq_driver->resume (policy)) pr_err("%s: Failed to resume driver: %p\n", __func__,
Signature · 1 line
1.8.4.rc0.1.g8f6a3e5.dirty
Quoted 7 lines · Lan Tianyu
Cpufreq core introduces
cpufreq_suspendedflag to let cpufreq sysfs nodes across S2RAM/S2DISK. But the flag is only set in thecpufreq_suspend()for cpufreq drivers which have target ortarget_indexcallback. This skipsintel_pstatedriver. This patch is to set the flag before checking target ortarget_indexcallback.Signed-off-by Lan Tianyu <[email protected]>
Viresh, Dirk, this looks like a fix that should go into 3.17, so I'm queuing it up accordingly. Please let me know if that's not correct.
Quoted 43 lines
--- drivers/cpufreq/cpufreq.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/cpufreq/cpufreq.c +4
-4@@ -1656,6 +1656,8 @@ void cpufreq_suspend(void)if (!cpufreq_driver)return ; + cpufreq_suspended = true; +if (!has_target ())return ;@@ -1670,8 +1672,6 @@ void cpufreq_suspend(void)pr_err ("%s: Failed to suspend driver: %p\n" , __func__, policy); } - - cpufreq_suspended = true; }/** @@ -1687,13 +1687,13 @@ void cpufreq_resume(void)if (!cpufreq_driver)return ; + cpufreq_suspended = false; +if (!has_target ())return ;pr_debug ("%s: Resuming Governors\n" , __func__); - cpufreq_suspended = false; -list_for_each_entry (policy, &cpufreq_policy_list, policy_list) {if (cpufreq_driver->resume && cpufreq_driver->resume (policy)) pr_err("%s: Failed to resume driver: %p\n", __func__,
Signature · 2 lines
I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.
Viresh Kumar
maintainerSorry for being late on this. Was away for a week for Linaro Connect followed by a week of vacations :(
Quoted 5 lines · Lan Tianyu
Cpufreq core introduces
cpufreq_suspendedflag to let cpufreq sysfs nodes across S2RAM/S2DISK. But the flag is only set in thecpufreq_suspend()for cpufreq drivers which have target ortarget_indexcallback. This skipsintel_pstatedriver. This patch is to set the flag before checking target ortarget_indexcallback.
Oh yes, this looks to be the right thing to do..
Quoted 19 lines
Signed-off-by Lan Tianyu <[email protected]>--- drivers/cpufreq/cpufreq.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/cpufreq/cpufreq.c +2
-0@@ -1656,6 +1656,8 @@ void cpufreq_suspend(void)if (!cpufreq_driver)return ; + cpufreq_suspended = true; +if (!has_target ())return ;
drivers/cpufreq/cpufreq.c void cpufreq_suspend(void) · line 1674
Quoted 5 lines
drivers/cpufreq/cpufreq.c +0
-2@@ -1670,8 +1672,6 @@ void cpufreq_suspend(void)pr_err ("%s: Failed to suspend driver: %p\n" , __func__, policy); } - - cpufreq_suspended = true;
But this change is buggy.. Because you are updating 'cpufreq_suspended' before actually stopping the governor, any calls to __cpufreq_governor() will be converted to NO-operations because of this in __cpufreq_governor():
/* Don't start any governor operations if we are entering suspend */ if (cpufreq_suspended)
return 0;
And so the governor's will never stop :(
So you need to keep the above line where it was :)
Quoted 41 lines · Viresh Kumar
Sorry for being late on this. Was away for a week for Linaro Connect followed by a week of vacations :(
Quoted 5 lines · Lan Tianyu
Cpufreq core introduces
cpufreq_suspendedflag to let cpufreq sysfs nodes across S2RAM/S2DISK. But the flag is only set in thecpufreq_suspend()for cpufreq drivers which have target ortarget_indexcallback. This skipsintel_pstatedriver. This patch is to set the flag before checking target ortarget_indexcallback.Oh yes, this looks to be the right thing to do..
Quoted 19 lines
Signed-off-by Lan Tianyu <[email protected]>--- drivers/cpufreq/cpufreq.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/cpufreq/cpufreq.c +2
-0@@ -1656,6 +1656,8 @@ void cpufreq_suspend(void)if (!cpufreq_driver)return ; + cpufreq_suspended = true; +if (!has_target ())return ;drivers/cpufreq/cpufreq.c void cpufreq_suspend(void) · line 1674
Quoted 5 lines
drivers/cpufreq/cpufreq.c +0
-2@@ -1670,8 +1672,6 @@ void cpufreq_suspend(void)pr_err ("%s: Failed to suspend driver: %p\n" , __func__, policy); } - - cpufreq_suspended = true;But this change is buggy.. Because you are updating '
cpufreq_suspended' before actually stopping the governor, any calls to__cpufreq_governor()will be converted to NO-operations because of this in__cpufreq_governor():
Quoted 7 lines
/* Don't start any governor operations if we are entering suspend */ if (
cpufreq_suspended)return 0;And so the governor's will never stop :(
So you need to keep the above line where it was :)
OK, so please send a fix for that against the Linus' tree.
Signature · 2 lines
I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.
Sorry later response and just back from vacation.
Quoted 4 lines · Viresh Kumar
But this change is buggy.. Because you are updating '
cpufreq_suspended' before actually stopping the governor, any calls to__cpufreq_governor()will be converted to NO-operations because of this in__cpufreq_governor():
Quoted 8 lines
/* Don't start any governor operations if we are entering suspend */ if (
cpufreq_suspended)return 0;And so the governor's will never stop :(
So you need to keep the above line where it was :)
Yes, you are right. Thanks for fixing it.
Signature · 2 lines
Best regards Tianyu Lan