linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cpufreq: intel_pstate: Fix setting max_perf_pct in performance policy
@ 2014-10-15 23:16 Pali Rohár
  2014-10-16  8:17 ` Viresh Kumar
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Pali Rohár @ 2014-10-15 23:16 UTC (permalink / raw)
  To: Rafael J. Wysocki, Viresh Kumar; +Cc: linux-pm, linux-kernel, pali.rohar

Code which changes policy to powersave changes also max_policy_pct based on
max_freq. Code which change max_perf_pct has upper limit base on value
max_policy_pct. When policy is changing from powersave back to performance
then max_policy_pct is not changed. Which means that changing max_perf_pct is
not possible to high values if max_freq was too low in powersave policy.

Test case:

$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
800000
$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
3300000
$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
performance
$ cat /sys/devices/system/cpu/intel_pstate/max_perf_pct
100

$ echo powersave > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
$ echo 800000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
$ echo 20 > /sys/devices/system/cpu/intel_pstate/max_perf_pct

$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
powersave
$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
800000
$ cat /sys/devices/system/cpu/intel_pstate/max_perf_pct
20

$ echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
$ echo 3300000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
$ echo 100 > /sys/devices/system/cpu/intel_pstate/max_perf_pct

$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
performance
$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
3300000
$ cat /sys/devices/system/cpu/intel_pstate/max_perf_pct
24

And now intel_pstate driver allows to set maximal value for max_perf_pct based
on max_policy_pct which is 24 for previous powersave max_freq 800000.

This patch will set default value for max_policy_pct when setting policy to
performance so it will allow to set also max value for max_perf_pct.

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
Cc: stable@vger.kernel.org
---
 drivers/cpufreq/intel_pstate.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 0668b38..7547ab5 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -714,6 +714,7 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy)
 	if (policy->policy == CPUFREQ_POLICY_PERFORMANCE) {
 		limits.min_perf_pct = 100;
 		limits.min_perf = int_tofp(1);
+		limits.max_policy_pct = 100;
 		limits.max_perf_pct = 100;
 		limits.max_perf = int_tofp(1);
 		limits.no_turbo = limits.turbo_disabled;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] cpufreq: intel_pstate: Fix setting max_perf_pct in performance policy
  2014-10-15 23:16 [PATCH] cpufreq: intel_pstate: Fix setting max_perf_pct in performance policy Pali Rohár
@ 2014-10-16  8:17 ` Viresh Kumar
  2014-10-16  8:50 ` Rafael J. Wysocki
  2014-10-16 15:05 ` Dirk Brandewie
  2 siblings, 0 replies; 5+ messages in thread
From: Viresh Kumar @ 2014-10-16  8:17 UTC (permalink / raw)
  To: Pali Rohár, Dirk Brandewie
  Cc: Rafael J. Wysocki, linux-pm@vger.kernel.org,
	Linux Kernel Mailing List

Cc'ing Dirk.

On 16 October 2014 04:46, Pali Rohár <pali.rohar@gmail.com> wrote:
> Code which changes policy to powersave changes also max_policy_pct based on
> max_freq. Code which change max_perf_pct has upper limit base on value
> max_policy_pct. When policy is changing from powersave back to performance
> then max_policy_pct is not changed. Which means that changing max_perf_pct is
> not possible to high values if max_freq was too low in powersave policy.
>
> Test case:
>
> $ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
> 800000
> $ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
> 3300000
> $ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
> performance
> $ cat /sys/devices/system/cpu/intel_pstate/max_perf_pct
> 100
>
> $ echo powersave > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
> $ echo 800000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
> $ echo 20 > /sys/devices/system/cpu/intel_pstate/max_perf_pct
>
> $ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
> powersave
> $ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
> 800000
> $ cat /sys/devices/system/cpu/intel_pstate/max_perf_pct
> 20
>
> $ echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
> $ echo 3300000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
> $ echo 100 > /sys/devices/system/cpu/intel_pstate/max_perf_pct
>
> $ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
> performance
> $ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
> 3300000
> $ cat /sys/devices/system/cpu/intel_pstate/max_perf_pct
> 24
>
> And now intel_pstate driver allows to set maximal value for max_perf_pct based
> on max_policy_pct which is 24 for previous powersave max_freq 800000.
>
> This patch will set default value for max_policy_pct when setting policy to
> performance so it will allow to set also max value for max_perf_pct.
>
> Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
> Cc: stable@vger.kernel.org
> ---
>  drivers/cpufreq/intel_pstate.c |    1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
> index 0668b38..7547ab5 100644
> --- a/drivers/cpufreq/intel_pstate.c
> +++ b/drivers/cpufreq/intel_pstate.c
> @@ -714,6 +714,7 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy)
>         if (policy->policy == CPUFREQ_POLICY_PERFORMANCE) {
>                 limits.min_perf_pct = 100;
>                 limits.min_perf = int_tofp(1);
> +               limits.max_policy_pct = 100;
>                 limits.max_perf_pct = 100;
>                 limits.max_perf = int_tofp(1);
>                 limits.no_turbo = limits.turbo_disabled;
> --
> 1.7.9.5
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] cpufreq: intel_pstate: Fix setting max_perf_pct in performance policy
  2014-10-15 23:16 [PATCH] cpufreq: intel_pstate: Fix setting max_perf_pct in performance policy Pali Rohár
  2014-10-16  8:17 ` Viresh Kumar
@ 2014-10-16  8:50 ` Rafael J. Wysocki
  2014-10-16 15:05 ` Dirk Brandewie
  2 siblings, 0 replies; 5+ messages in thread
From: Rafael J. Wysocki @ 2014-10-16  8:50 UTC (permalink / raw)
  To: Pali Rohár, 'Dirk Brandewie'
  Cc: Viresh Kumar, linux-pm, linux-kernel, 'Dirk Brandewie'

On Thursday, October 16, 2014 01:16:51 AM Pali Rohár wrote:
> Code which changes policy to powersave changes also max_policy_pct based on
> max_freq. Code which change max_perf_pct has upper limit base on value
> max_policy_pct. When policy is changing from powersave back to performance
> then max_policy_pct is not changed. Which means that changing max_perf_pct is
> not possible to high values if max_freq was too low in powersave policy.

Dirk, what do you think?

> Test case:
> 
> $ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
> 800000
> $ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
> 3300000
> $ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
> performance
> $ cat /sys/devices/system/cpu/intel_pstate/max_perf_pct
> 100
> 
> $ echo powersave > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
> $ echo 800000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
> $ echo 20 > /sys/devices/system/cpu/intel_pstate/max_perf_pct
> 
> $ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
> powersave
> $ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
> 800000
> $ cat /sys/devices/system/cpu/intel_pstate/max_perf_pct
> 20
> 
> $ echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
> $ echo 3300000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
> $ echo 100 > /sys/devices/system/cpu/intel_pstate/max_perf_pct
> 
> $ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
> performance
> $ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
> 3300000
> $ cat /sys/devices/system/cpu/intel_pstate/max_perf_pct
> 24
> 
> And now intel_pstate driver allows to set maximal value for max_perf_pct based
> on max_policy_pct which is 24 for previous powersave max_freq 800000.
> 
> This patch will set default value for max_policy_pct when setting policy to
> performance so it will allow to set also max value for max_perf_pct.
> 
> Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
> Cc: stable@vger.kernel.org
> ---
>  drivers/cpufreq/intel_pstate.c |    1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
> index 0668b38..7547ab5 100644
> --- a/drivers/cpufreq/intel_pstate.c
> +++ b/drivers/cpufreq/intel_pstate.c
> @@ -714,6 +714,7 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy)
>  	if (policy->policy == CPUFREQ_POLICY_PERFORMANCE) {
>  		limits.min_perf_pct = 100;
>  		limits.min_perf = int_tofp(1);
> +		limits.max_policy_pct = 100;
>  		limits.max_perf_pct = 100;
>  		limits.max_perf = int_tofp(1);
>  		limits.no_turbo = limits.turbo_disabled;
> 

-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] cpufreq: intel_pstate: Fix setting max_perf_pct in performance policy
  2014-10-15 23:16 [PATCH] cpufreq: intel_pstate: Fix setting max_perf_pct in performance policy Pali Rohár
  2014-10-16  8:17 ` Viresh Kumar
  2014-10-16  8:50 ` Rafael J. Wysocki
@ 2014-10-16 15:05 ` Dirk Brandewie
  2014-10-21 13:30   ` Rafael J. Wysocki
  2 siblings, 1 reply; 5+ messages in thread
From: Dirk Brandewie @ 2014-10-16 15:05 UTC (permalink / raw)
  To: Pali Rohár, Rafael J. Wysocki, Viresh Kumar
  Cc: dirk.brandewie, linux-pm, linux-kernel

On 10/15/2014 04:16 PM, Pali Rohár wrote:
> Code which changes policy to powersave changes also max_policy_pct based on
> max_freq. Code which change max_perf_pct has upper limit base on value
> max_policy_pct. When policy is changing from powersave back to performance
> then max_policy_pct is not changed. Which means that changing max_perf_pct is
> not possible to high values if max_freq was too low in powersave policy.
>
> Test case:
>
> $ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
> 800000
> $ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
> 3300000
> $ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
> performance
> $ cat /sys/devices/system/cpu/intel_pstate/max_perf_pct
> 100
>
> $ echo powersave > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
> $ echo 800000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
> $ echo 20 > /sys/devices/system/cpu/intel_pstate/max_perf_pct
>
> $ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
> powersave
> $ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
> 800000
> $ cat /sys/devices/system/cpu/intel_pstate/max_perf_pct
> 20
>
> $ echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
> $ echo 3300000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
> $ echo 100 > /sys/devices/system/cpu/intel_pstate/max_perf_pct
>
> $ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
> performance
> $ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
> 3300000
> $ cat /sys/devices/system/cpu/intel_pstate/max_perf_pct
> 24
>
> And now intel_pstate driver allows to set maximal value for max_perf_pct based
> on max_policy_pct which is 24 for previous powersave max_freq 800000.
>
> This patch will set default value for max_policy_pct when setting policy to
> performance so it will allow to set also max value for max_perf_pct.
>
> Signed-off-by: Pali Rohár <pali.rohar@gmail.com>

Acked-by: Dirk Brandewie <dirk.j.brandewie@intel.com>

> Cc: stable@vger.kernel.org
> ---
>   drivers/cpufreq/intel_pstate.c |    1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
> index 0668b38..7547ab5 100644
> --- a/drivers/cpufreq/intel_pstate.c
> +++ b/drivers/cpufreq/intel_pstate.c
> @@ -714,6 +714,7 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy)
>   	if (policy->policy == CPUFREQ_POLICY_PERFORMANCE) {
>   		limits.min_perf_pct = 100;
>   		limits.min_perf = int_tofp(1);
> +		limits.max_policy_pct = 100;
>   		limits.max_perf_pct = 100;
>   		limits.max_perf = int_tofp(1);
>   		limits.no_turbo = limits.turbo_disabled;
>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] cpufreq: intel_pstate: Fix setting max_perf_pct in performance policy
  2014-10-16 15:05 ` Dirk Brandewie
@ 2014-10-21 13:30   ` Rafael J. Wysocki
  0 siblings, 0 replies; 5+ messages in thread
From: Rafael J. Wysocki @ 2014-10-21 13:30 UTC (permalink / raw)
  To: Dirk Brandewie; +Cc: Pali Rohár, Viresh Kumar, linux-pm, linux-kernel

On Thursday, October 16, 2014 08:05:44 AM Dirk Brandewie wrote:
> On 10/15/2014 04:16 PM, Pali Rohár wrote:
> > Code which changes policy to powersave changes also max_policy_pct based on
> > max_freq. Code which change max_perf_pct has upper limit base on value
> > max_policy_pct. When policy is changing from powersave back to performance
> > then max_policy_pct is not changed. Which means that changing max_perf_pct is
> > not possible to high values if max_freq was too low in powersave policy.
> >
> > Test case:
> >
> > $ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
> > 800000
> > $ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
> > 3300000
> > $ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
> > performance
> > $ cat /sys/devices/system/cpu/intel_pstate/max_perf_pct
> > 100
> >
> > $ echo powersave > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
> > $ echo 800000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
> > $ echo 20 > /sys/devices/system/cpu/intel_pstate/max_perf_pct
> >
> > $ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
> > powersave
> > $ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
> > 800000
> > $ cat /sys/devices/system/cpu/intel_pstate/max_perf_pct
> > 20
> >
> > $ echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
> > $ echo 3300000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
> > $ echo 100 > /sys/devices/system/cpu/intel_pstate/max_perf_pct
> >
> > $ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
> > performance
> > $ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
> > 3300000
> > $ cat /sys/devices/system/cpu/intel_pstate/max_perf_pct
> > 24
> >
> > And now intel_pstate driver allows to set maximal value for max_perf_pct based
> > on max_policy_pct which is 24 for previous powersave max_freq 800000.
> >
> > This patch will set default value for max_policy_pct when setting policy to
> > performance so it will allow to set also max value for max_perf_pct.
> >
> > Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
> 
> Acked-by: Dirk Brandewie <dirk.j.brandewie@intel.com>

Applied, thanks!

-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-10-21 13:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-15 23:16 [PATCH] cpufreq: intel_pstate: Fix setting max_perf_pct in performance policy Pali Rohár
2014-10-16  8:17 ` Viresh Kumar
2014-10-16  8:50 ` Rafael J. Wysocki
2014-10-16 15:05 ` Dirk Brandewie
2014-10-21 13:30   ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).