Skip to contentSkip to conversation

SKL intel_pstate update MSR values when changing governors

PATCH In review Alexandra Yates 4 participants 8 messages Nov 18, 2015 – Nov 24, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 SKL intel_pstate update MSR values when changing governors

When changing from powersave to performance governors Intel_pstate fails to update the MSR values that reflect the max_perf_pct to 100%. For instance in SKL reading rdmsr 0x774:

Governor MSR max_perf_pct
========= ======== ============
Powersave 80002808 100%
Powersave 80002008 80%
Performance 80002028 [error] 100%
Performance 80002828 [expected] 100%

The line label [error] shows the culprit. At this point the MSR should reflect the max_perf_pct that is 100%, that corresponds to MSR 80002828 as shown on the next line of the example. Which is the maximum performance for the Performance governor. Instead it holds back the MSR value previously set by the Powersave, in this case 80002028.

This patch allows the system to print the correct MSR value 80002828 that corresponds to the 100% max_perf_pct when changing from powersave to performance governors.

For more information on the MSR values for SKL please visit ISDM under Managing HWP.

---
 drivers/cpufreq/intel_pstate.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/cpufreq/intel_pstate.c +2 -0
index 2e31d09..0eeb7da 100644
@@ -1242,6 +1242,8 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy)
 	    policy->max >= policy->cpuinfo.max_freq) {
 		pr_debug("intel_pstate: set performance\n");
 		limits = &performance_limits;
+		if (hwp_active)
+			intel_pstate_hwp_set();
 		return 0;
 	}
 
Signature · 1 line
1.9.1
maintainer Acked-by on v3 1/1
#1 lore raw
Quoted 18 lines · Alexandra Yates

When changing from powersave to performance governors Intel_pstate fails to update the MSR values that reflect the max_perf_pct to 100%. For instance in SKL reading rdmsr 0x774:

Governor MSR max_perf_pct
========= ======== ============
Powersave 80002808 100%
Powersave 80002008 80%
Performance 80002028 [error] 100%
Performance 80002828 [expected] 100%

The line label [error] shows the culprit. At this point the MSR should reflect the max_perf_pct that is 100%, that corresponds to MSR 80002828 as shown on the next line of the example. Which is the maximum performance for the Performance governor. Instead it holds back the MSR value previously set by the Powersave, in this case 80002028.

Quoted 8 lines

This patch allows the system to print the correct MSR value 80002828 that corresponds to the 100% max_perf_pct when changing from powersave to performance governors.

For more information on the MSR values for SKL please visit ISDM under Managing HWP.

Quoted 18 lines
---
  drivers/cpufreq/intel_pstate.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/cpufreq/intel_pstate.c +2 -0
index 2e31d09..0eeb7da 100644
@@ -1242,6 +1242,8 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy)
  	    policy->max >= policy->cpuinfo.max_freq) {
  		pr_debug("intel_pstate: set performance\n");
  		limits = &performance_limits;
+		if (hwp_active)
+			intel_pstate_hwp_set();
  		return 0;
  	}
 
#2 lore raw

Hi,

Quoted 22 lines · Srinivas Pandruvada
Quoted 19 lines · Alexandra Yates

When changing from powersave to performance governors Intel_pstate fails to update the MSR values that reflect the max_perf_pct to 100%. For instance in SKL reading rdmsr 0x774:

Governor        MSR                     max_perf_pct
=========       ========                ============
Powersave       80002808                100%
Powersave       80002008                80%
Performance     80002028 [error]        100%
Performance     80002828 [expected]     100%

The line label [error] shows the culprit. At this point the MSR should reflect the max_perf_pct that is 100%, that corresponds to MSR 80002828 as shown on the next line of the example. Which is the maximum performance for the Performance governor. Instead it holds back the MSR value previously set by the Powersave, in this case 80002028.

Quoted 3 lines
Quoted 3 lines

This patch allows the system to print the correct MSR value 80002828 that corresponds to the 100% max_perf_pct when changing from powersave to performance governors.

Is this only about what is printed or does it mean that the driver actually uses an incorrect MSR value?

Quoted 11 lines
Quoted 4 lines

For more information on the MSR values for SKL please visit ISDM under Managing HWP.

Quoted 5 lines
---
  drivers/cpufreq/intel_pstate.c | 2 ++
  1 file changed, 2 insertions(+)
Quoted 12 lines

drivers/cpufreq/intel_pstate.c static int intel_pstate_set_policy(struct · line 1247

Quoted 12 lines
drivers/cpufreq/intel_pstate.c +2 -0
index 2e31d09..0eeb7da 100644
@@ -1242,6 +1242,8 @@ static int intel_pstate_set_policy(struct
 cpufreq_policy *policy)
            policy->max >= policy->cpuinfo.max_freq) {
                pr_debug("intel_pstate: set performance\n");
                limits = &performance_limits;
+               if (hwp_active)
+                       intel_pstate_hwp_set();

Honestly, I'm not really sure how this is matching the changelog.

What it does is to ensure that the correct limits are used when in the HWP mode too as far as I can say. Is my understanding correct here?

Quoted 5 lines

drivers/cpufreq/intel_pstate.c static int intel_pstate_set_policy(struct cpufreq_policy *policy) · line 1248

Quoted 4 lines
drivers/cpufreq/intel_pstate.c +0 -0
                return 0;
        }

--

Thanks,
Rafael

#3 lore raw
Quoted 26 lines · Rafael J. Wysocki

Hi,

Quoted 22 lines · Srinivas Pandruvada
Quoted 19 lines · Alexandra Yates

When changing from powersave to performance governors Intel_pstate fails to update the MSR values that reflect the max_perf_pct to 100%. For instance in SKL reading rdmsr 0x774:

Governor        MSR                     max_perf_pct
=========       ========                ============
Powersave       80002808                100%
Powersave       80002008                80%
Performance     80002028 [error]        100%
Performance     80002828 [expected]     100%

The line label [error] shows the culprit. At this point the MSR should reflect the max_perf_pct that is 100%, that corresponds to MSR 80002828 as shown on the next line of the example. Which is the maximum performance for the Performance governor. Instead it holds back the MSR value previously set by the Powersave, in this case 80002028.

Quoted 6 lines
Quoted 3 lines
Quoted 3 lines

This patch allows the system to print the correct MSR value 80002828 that corresponds to the 100% max_perf_pct when changing from powersave to performance governors.

Is this only about what is printed or does it mean that the driver actually uses an incorrect MSR value?

Driver was not configuring correct value in HWP MSR, which sets min and max limits, so the HWP is not using correct limits. In HWP case driver doesn't do anything other than setting this MSR.
When she means print correct MSR, is that when changing the mode from powersave to peformance, when she prints MSRs (rdmsr 0x774), this doesn't have correct max limit.

Quoted 27 lines
Quoted 12 lines
Quoted 5 lines

For more information on the MSR values for SKL please visit ISDM under Managing HWP.

Quoted 5 lines
---
  drivers/cpufreq/intel_pstate.c | 2 ++
  1 file changed, 2 insertions(+)
Quoted 12 lines

drivers/cpufreq/intel_pstate.c static int intel_pstate_set_policy(struct · line 1247

Quoted 12 lines
drivers/cpufreq/intel_pstate.c +2 -0
index 2e31d09..0eeb7da 100644
@@ -1242,6 +1242,8 @@ static int intel_pstate_set_policy(struct
 cpufreq_policy *policy)
            policy->max >= policy->cpuinfo.max_freq) {
                pr_debug("intel_pstate: set performance\n");
                limits = &performance_limits;
+               if (hwp_active)
+                       intel_pstate_hwp_set();

Honestly, I'm not really sure how this is matching the changelog.

Quoted 2 lines

What it does is to ensure that the correct limits are used when in the HWP mode too as far as I can say. Is my understanding correct here?

Yes.

Quoted 13 lines
Quoted 6 lines

drivers/cpufreq/intel_pstate.c static int intel_pstate_set_policy(struct cpufreq_policy *policy) · line 1248

Quoted 5 lines
drivers/cpufreq/intel_pstate.c +0 -0
                return 0;
        }

--

Thanks,
Rafael
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw
Quoted 6 lines · Srinivas Pandruvada
Quoted 5 lines · Rafael J. Wysocki

Hi,

Quoted 1 line · Srinivas Pandruvada

[cut]

Quoted 27 lines
Quoted 27 lines
Quoted 12 lines
Quoted 5 lines

For more information on the MSR values for SKL please visit ISDM under Managing HWP.

Quoted 5 lines
---
  drivers/cpufreq/intel_pstate.c | 2 ++
  1 file changed, 2 insertions(+)
Quoted 12 lines

drivers/cpufreq/intel_pstate.c static int intel_pstate_set_policy(struct · line 1247

Quoted 12 lines
drivers/cpufreq/intel_pstate.c +2 -0
index 2e31d09..0eeb7da 100644
@@ -1242,6 +1242,8 @@ static int intel_pstate_set_policy(struct
 cpufreq_policy *policy)
            policy->max >= policy->cpuinfo.max_freq) {
                pr_debug("intel_pstate: set performance\n");
                limits = &performance_limits;
+               if (hwp_active)
+                       intel_pstate_hwp_set();

Honestly, I'm not really sure how this is matching the changelog.

Quoted 3 lines
Quoted 2 lines

What it does is to ensure that the correct limits are used when in the HWP mode too as far as I can say. Is my understanding correct here?

Yes.

OK

But if we make the "performance" limits take effect here, it will effectively make HWP use min = max = 100%, right? Is that what we want to happen here?

Thanks,
Rafael

#5 lore raw
Quoted 44 lines · Rafael J. Wysocki
Quoted 6 lines · Srinivas Pandruvada
Quoted 5 lines · Rafael J. Wysocki

Hi,

Quoted 1 line · Srinivas Pandruvada

[cut]

Quoted 34 lines
Quoted 34 lines
Quoted 14 lines
Quoted 6 lines

For more information on the MSR values for SKL please visit ISDM under Managing HWP.

Signed-off-by: Alexandra Yates <
[email protected]>

Acked-by: Srinivas Pandruvada <
[email protected]>

Quoted 5 lines
---
  drivers/cpufreq/intel_pstate.c | 2 ++
  1 file changed, 2 insertions(+)
Quoted 13 lines

drivers/cpufreq/intel_pstate.c static int intel_pstate_set_policy(struct cpufreq_policy *policy) · line 1246

Quoted 13 lines
drivers/cpufreq/intel_pstate.c +0 -0
index 2e31d09..0eeb7da 100644
@@ -1242,6 +1242,8 @@ static int

intel_pstate_set_policy(struct
cpufreq_policy *policy)

            policy->max >= policy->cpuinfo.max_freq) {
                pr_debug("intel_pstate: set performance\n");
                limits = &performance_limits;
drivers/cpufreq/intel_pstate.c +2 -0
+               if (hwp_active)
+                       intel_pstate_hwp_set();

Honestly, I'm not really sure how this is matching the changelog.

What it does is to ensure that the correct limits are used when in the
HWP mode too as far as I can say. Is my understanding correct here?

Quoted 8 lines
Quoted 1 line

Yes.

OK

But if we make the "performance" limits take effect here, it will effectively
make HWP use min = max = 100%, right? Is that what we want to happen here?

Yes. intel_pstate_hwp_set() uses limits->min_perf_pct and limits ->max_perf_pct to set HWP limits. Here these will be set to 100%.

Thanks,
Srinivas

Quoted 4 lines

Thanks,
Rafael

#6 lore raw
Quoted 47 lines · Srinivas Pandruvada
Quoted 46 lines · Rafael J. Wysocki
Quoted 6 lines · Srinivas Pandruvada
Quoted 5 lines · Rafael J. Wysocki

Hi,

Quoted 1 line · Srinivas Pandruvada

[cut]

Quoted 35 lines
Quoted 30 lines
Quoted 14 lines
Quoted 6 lines

For more information on the MSR values for SKL please visit ISDM under Managing HWP.

Signed-off-by: Alexandra Yates <
[email protected]>

Acked-by: Srinivas Pandruvada <
[email protected]>

Quoted 5 lines
---
  drivers/cpufreq/intel_pstate.c | 2 ++
  1 file changed, 2 insertions(+)
Quoted 13 lines

drivers/cpufreq/intel_pstate.c static int intel_pstate_set_policy(struct cpufreq_policy *policy) · line 1246

Quoted 13 lines
drivers/cpufreq/intel_pstate.c +0 -0
index 2e31d09..0eeb7da 100644
@@ -1242,6 +1242,8 @@ static int

intel_pstate_set_policy(struct
cpufreq_policy *policy)

            policy->max >= policy->cpuinfo.max_freq) {
                pr_debug("intel_pstate: set performance\n");
                limits = &performance_limits;
drivers/cpufreq/intel_pstate.c +2 -0
+               if (hwp_active)
+                       intel_pstate_hwp_set();

Honestly, I'm not really sure how this is matching the changelog.

Quoted 4 lines

What it does is to ensure that the correct limits are used when in the
HWP mode too as far as I can say. Is my understanding correct here?

Yes.

Quoted 8 lines
Quoted 6 lines

OK

But if we make the "performance" limits take effect here, it will effectively
make HWP use min = max = 100%, right? Is that what we want to happen here?

Yes. intel_pstate_hwp_set() uses limits->min_perf_pct and limits ->max_perf_pct to set HWP limits. Here these will be set to 100%.

OK, so that's the intended behavior of "performance" in the HWP case, right?

I'll apply this patch, but I'm going to write a new changelog for it, then.

Thanks,
Rafael

#7 lore raw
Quoted 61 lines · Rafael J. Wysocki
Quoted 60 lines · Srinivas Pandruvada
Quoted 59 lines · Rafael J. Wysocki
Quoted 6 lines · Srinivas Pandruvada
Quoted 5 lines · Rafael J. Wysocki

Hi,

Quoted 1 line · Srinivas Pandruvada

[cut]

Quoted 33 lines
Quoted 33 lines
Quoted 15 lines
Quoted 7 lines

For more information on the MSR values for SKL please visit
ISDM under Managing HWP.

Signed-off-by: Alexandra Yates <
[email protected]>

Acked-by: Srinivas Pandruvada <
[email protected]>

Quoted 5 lines
---
  drivers/cpufreq/intel_pstate.c | 2 ++
  1 file changed, 2 insertions(+)
Quoted 14 lines
Quoted 12 lines
drivers/cpufreq/intel_pstate.c +0 -0
index 2e31d09..0eeb7da 100644
@@ -1242,6 +1242,8 @@ static int

intel_pstate_set_policy(struct
cpufreq_policy *policy)

            policy->max >= policy->cpuinfo.max_freq) {
                pr_debug("intel_pstate: set
performance\n");
                limits = &performance_limits;

drivers/cpufreq/intel_pstate.c

Quoted 2 lines
drivers/cpufreq/intel_pstate.c +2 -0
+               if (hwp_active)
+                       intel_pstate_hwp_set();

Honestly, I'm not really sure how this is matching the changelog.

Quoted 7 lines
Quoted 6 lines

What it does is to ensure that the correct limits are used when
in the
HWP mode too as far as I can say. Is my understanding correct
here?

Yes.

OK

But if we make the "performance" limits take effect here, it will effectively
make HWP use min = max = 100%, right? Is that what we want to happen
here?

Quoted 6 lines
Quoted 2 lines

Yes. intel_pstate_hwp_set() uses limits->min_perf_pct and limits ->max_perf_pct to set HWP limits. Here these will be set to 100%.

OK, so that's the intended behavior of "performance" in the HWP case, right?

Yes.

Quoted 2 lines

I'll apply this patch, but I'm going to write a new changelog for it, then.

Sure.

Thanks,
Srinivas

Quoted 4 lines

Thanks,
Rafael