diff mbox

cpufreq: intel_pstate: Fix processing for turbo activation ratio

Message ID 1461380039-13804-1-git-send-email-srinivas.pandruvada@linux.intel.com (mailing list archive)
State Accepted, archived
Delegated to: Rafael Wysocki
Headers show

Commit Message

srinivas pandruvada April 23, 2016, 2:53 a.m. UTC
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(+)

Comments

Rafael J. Wysocki April 25, 2016, 1:48 p.m. UTC | #1
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);
> --
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
srinivas pandruvada April 25, 2016, 4:28 p.m. UTC | #2
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);
> > --
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Rafael J. Wysocki April 25, 2016, 9:44 p.m. UTC | #3
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.
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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);