All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cpufreq: intel_pstate: Fix processing for turbo activation ratio
@ 2016-04-23  2:53 Srinivas Pandruvada
  2016-04-25 13:48 ` Rafael J. Wysocki
  0 siblings, 1 reply; 4+ messages in thread
From: Srinivas Pandruvada @ 2016-04-23  2:53 UTC (permalink / raw)
  To: rjw; +Cc: linux-pm, Srinivas Pandruvada

When the config TDP level is not nominal (level = 0), the MSR values for
reading level 1 and level 2 ratios contain power in low 14 bits and actual
ratio bits are at bits [23:16]. The current processing for level 1 and
level 2 is wrong as there is no shift done to get actual ratio.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
---
 drivers/cpufreq/intel_pstate.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 1b2767d..03f94c2 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -813,6 +813,10 @@ static int core_get_max_pstate(void)
 			if (err)
 				goto skip_tar;
 
+			/* For level 1 and 2, bits[23:16] contains ratio */
+			if (tdp_ctrl)
+				tdp_ratio >>= 16;
+			tdp_ratio &= 0xff; /* ratios are only 8 bits long */
 			if (tdp_ratio - 1 == tar) {
 				max_pstate = tar;
 				pr_debug("max_pstate=TAC %x\n", max_pstate);
-- 
2.5.0


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

* Re: [PATCH] cpufreq: intel_pstate: Fix processing for turbo activation ratio
  2016-04-23  2:53 [PATCH] cpufreq: intel_pstate: Fix processing for turbo activation ratio Srinivas Pandruvada
@ 2016-04-25 13:48 ` Rafael J. Wysocki
  2016-04-25 16:28   ` Srinivas Pandruvada
  0 siblings, 1 reply; 4+ messages in thread
From: Rafael J. Wysocki @ 2016-04-25 13:48 UTC (permalink / raw)
  To: Srinivas Pandruvada; +Cc: Rafael J. Wysocki, linux-pm

On Sat, Apr 23, 2016 at 4:53 AM, Srinivas Pandruvada
<srinivas.pandruvada@linux.intel.com> wrote:
> When the config TDP level is not nominal (level = 0), the MSR values for
> reading level 1 and level 2 ratios contain power in low 14 bits and actual
> ratio bits are at bits [23:16]. The current processing for level 1 and
> level 2 is wrong as there is no shift done to get actual ratio.
>
> Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>

Since this is a fix, do we need it in v4.6?

Do we want it in -stable too and in what -stable if so?


> ---
>  drivers/cpufreq/intel_pstate.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
> index 1b2767d..03f94c2 100644
> --- a/drivers/cpufreq/intel_pstate.c
> +++ b/drivers/cpufreq/intel_pstate.c
> @@ -813,6 +813,10 @@ static int core_get_max_pstate(void)
>                         if (err)
>                                 goto skip_tar;
>
> +                       /* For level 1 and 2, bits[23:16] contains ratio */
> +                       if (tdp_ctrl)
> +                               tdp_ratio >>= 16;
> +                       tdp_ratio &= 0xff; /* ratios are only 8 bits long */
>                         if (tdp_ratio - 1 == tar) {
>                                 max_pstate = tar;
>                                 pr_debug("max_pstate=TAC %x\n", max_pstate);
> --

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

* Re: [PATCH] cpufreq: intel_pstate: Fix processing for turbo activation ratio
  2016-04-25 13:48 ` Rafael J. Wysocki
@ 2016-04-25 16:28   ` Srinivas Pandruvada
  2016-04-25 21:44     ` Rafael J. Wysocki
  0 siblings, 1 reply; 4+ messages in thread
From: Srinivas Pandruvada @ 2016-04-25 16:28 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: Rafael J. Wysocki, linux-pm

On Mon, 2016-04-25 at 15:48 +0200, Rafael J. Wysocki wrote:
> On Sat, Apr 23, 2016 at 4:53 AM, Srinivas Pandruvada
> <srinivas.pandruvada@linux.intel.com> wrote:
> > 
> > When the config TDP level is not nominal (level = 0), the MSR
> > values for
> > reading level 1 and level 2 ratios contain power in low 14 bits and
> > actual
> > ratio bits are at bits [23:16]. The current processing for level 1
> > and
> > level 2 is wrong as there is no shift done to get actual ratio.
> > 
> > Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel
> > .com>
> Since this is a fix, do we need it in v4.6?
> 
This impact the display of turbo_pct in Intel P-state sysfs. So if not
too late, I prefer for v4.6.
 
> Do we want it in -stable too and in what -stable if so?
4.4 onward.
> 

Thanks,
Srinivas

> 
> > 
> > ---
> >  drivers/cpufreq/intel_pstate.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> > 
> > diff --git a/drivers/cpufreq/intel_pstate.c
> > b/drivers/cpufreq/intel_pstate.c
> > index 1b2767d..03f94c2 100644
> > --- a/drivers/cpufreq/intel_pstate.c
> > +++ b/drivers/cpufreq/intel_pstate.c
> > @@ -813,6 +813,10 @@ static int core_get_max_pstate(void)
> >                         if (err)
> >                                 goto skip_tar;
> > 
> > +                       /* For level 1 and 2, bits[23:16] contains
> > ratio */
> > +                       if (tdp_ctrl)
> > +                               tdp_ratio >>= 16;
> > +                       tdp_ratio &= 0xff; /* ratios are only 8
> > bits long */
> >                         if (tdp_ratio - 1 == tar) {
> >                                 max_pstate = tar;
> >                                 pr_debug("max_pstate=TAC %x\n",
> > max_pstate);
> > --

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

* Re: [PATCH] cpufreq: intel_pstate: Fix processing for turbo activation ratio
  2016-04-25 16:28   ` Srinivas Pandruvada
@ 2016-04-25 21:44     ` Rafael J. Wysocki
  0 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2016-04-25 21:44 UTC (permalink / raw)
  To: Srinivas Pandruvada; +Cc: Rafael J. Wysocki, Rafael J. Wysocki, linux-pm

On Mon, Apr 25, 2016 at 6:28 PM, Srinivas Pandruvada
<srinivas.pandruvada@linux.intel.com> wrote:
> On Mon, 2016-04-25 at 15:48 +0200, Rafael J. Wysocki wrote:
>> On Sat, Apr 23, 2016 at 4:53 AM, Srinivas Pandruvada
>> <srinivas.pandruvada@linux.intel.com> wrote:
>> >
>> > When the config TDP level is not nominal (level = 0), the MSR
>> > values for
>> > reading level 1 and level 2 ratios contain power in low 14 bits and
>> > actual
>> > ratio bits are at bits [23:16]. The current processing for level 1
>> > and
>> > level 2 is wrong as there is no shift done to get actual ratio.
>> >
>> > Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel
>> > .com>
>> Since this is a fix, do we need it in v4.6?
>>
> This impact the display of turbo_pct in Intel P-state sysfs. So if not
> too late, I prefer for v4.6.
>
>> Do we want it in -stable too and in what -stable if so?
> 4.4 onward.

OK

I also added a Fixes: tag to the commit.

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

end of thread, other threads:[~2016-04-25 21:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-23  2:53 [PATCH] cpufreq: intel_pstate: Fix processing for turbo activation ratio Srinivas Pandruvada
2016-04-25 13:48 ` Rafael J. Wysocki
2016-04-25 16:28   ` Srinivas Pandruvada
2016-04-25 21:44     ` Rafael J. Wysocki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.