Skip to content

Commit 2734fdb

Browse files
committed
tools/power x86_energy_perf_policy: Prefer driver HWP limits
When we are successful in using cpufreq min/max limits, skip setting the raw MSR limits entirely. This is necessary to avoid undoing any modification that the cpufreq driver makes to our sysfs request. eg. intel_pstate may take our request for a limit that is valid according to HWP.CAP.MIN/MAX and clip it to be within the range available in PLATFORM_INFO. Signed-off-by: Len Brown <len.brown@intel.com>
1 parent f8241f5 commit 2734fdb

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ unsigned char turbo_update_value;
6262
unsigned char update_hwp_epp;
6363
unsigned char update_hwp_min;
6464
unsigned char update_hwp_max;
65+
unsigned char hwp_limits_done_via_sysfs;
6566
unsigned char update_hwp_desired;
6667
unsigned char update_hwp_window;
6768
unsigned char update_hwp_use_pkg;
@@ -951,8 +952,10 @@ int ratio_2_sysfs_khz(int ratio)
951952
}
952953
/*
953954
* If HWP is enabled and cpufreq sysfs attribtes are present,
954-
* then update sysfs, so that it will not become
955-
* stale when we write to MSRs.
955+
* then update via sysfs. The intel_pstate driver may modify (clip)
956+
* this request, say, when HWP_CAP is outside of PLATFORM_INFO limits,
957+
* and the driver-chosen value takes precidence.
958+
*
956959
* (intel_pstate's max_perf_pct and min_perf_pct will follow cpufreq,
957960
* so we don't have to touch that.)
958961
*/
@@ -1007,6 +1010,8 @@ int update_sysfs(int cpu)
10071010
if (update_hwp_max)
10081011
update_cpufreq_scaling_freq(1, cpu, req_update.hwp_max);
10091012

1013+
hwp_limits_done_via_sysfs = 1;
1014+
10101015
return 0;
10111016
}
10121017

@@ -1085,10 +1090,10 @@ int update_hwp_request_msr(int cpu)
10851090
if (debug)
10861091
print_hwp_request(cpu, &req, "old: ");
10871092

1088-
if (update_hwp_min)
1093+
if (update_hwp_min && !hwp_limits_done_via_sysfs)
10891094
req.hwp_min = req_update.hwp_min;
10901095

1091-
if (update_hwp_max)
1096+
if (update_hwp_max && !hwp_limits_done_via_sysfs)
10921097
req.hwp_max = req_update.hwp_max;
10931098

10941099
if (update_hwp_desired)

0 commit comments

Comments
 (0)