diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-10-28 21:29:13 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-10-28 21:29:13 -0400 |
commit | b546e0c289f7e9faf86999d34e895ee2b31c719b (patch) | |
tree | d33cbd3ea56a4b2c792778da632ee88921c1316e | |
parent | 1308fd75e5ae211ee2ad688a58e4d7d0d8df4975 (diff) | |
parent | 8b2ada27dc1045e8191673bf769a1136ce8a0127 (diff) |
Merge tag 'pm-4.9-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull power management fixes from Rafael Wysocki:
"These fix two intel_pstate issues related to the way it works when the
scaling_governor sysfs attribute is set to "performance" and fix up
messages in the system suspend core code.
Specifics:
- Fix a missing KERN_CONT in a system suspend message by converting
the affected code to using pr_info() and pr_cont() instead of the
"raw" printk() (Jon Hunter).
- Make intel_pstate set the CPU P-state from its .set_policy()
callback when the scaling_governor sysfs attribute is set to
"performance" so that it interacts with NOHZ_FULL more predictably
which was the case before 4.7 (Rafael Wysocki).
- Make intel_pstate always request the maximum allowed P-state when
the scaling_governor sysfs attribute is set to "performance" to
prevent it from effectively ingoring that setting is some
situations (Rafael Wysocki)"
* tag 'pm-4.9-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
cpufreq: intel_pstate: Always set max P-state in performance mode
PM / suspend: Fix missing KERN_CONT for suspend message
cpufreq: intel_pstate: Set P-state upfront in performance mode
-rw-r--r-- | drivers/cpufreq/intel_pstate.c | 38 | ||||
-rw-r--r-- | kernel/power/suspend.c | 4 |
2 files changed, 34 insertions, 8 deletions
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index f535f8123258..4737520ec823 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c | |||
@@ -179,6 +179,7 @@ struct _pid { | |||
179 | /** | 179 | /** |
180 | * struct cpudata - Per CPU instance data storage | 180 | * struct cpudata - Per CPU instance data storage |
181 | * @cpu: CPU number for this instance data | 181 | * @cpu: CPU number for this instance data |
182 | * @policy: CPUFreq policy value | ||
182 | * @update_util: CPUFreq utility callback information | 183 | * @update_util: CPUFreq utility callback information |
183 | * @update_util_set: CPUFreq utility callback is set | 184 | * @update_util_set: CPUFreq utility callback is set |
184 | * @iowait_boost: iowait-related boost fraction | 185 | * @iowait_boost: iowait-related boost fraction |
@@ -201,6 +202,7 @@ struct _pid { | |||
201 | struct cpudata { | 202 | struct cpudata { |
202 | int cpu; | 203 | int cpu; |
203 | 204 | ||
205 | unsigned int policy; | ||
204 | struct update_util_data update_util; | 206 | struct update_util_data update_util; |
205 | bool update_util_set; | 207 | bool update_util_set; |
206 | 208 | ||
@@ -1142,10 +1144,8 @@ static void intel_pstate_get_min_max(struct cpudata *cpu, int *min, int *max) | |||
1142 | *min = clamp_t(int, min_perf, cpu->pstate.min_pstate, max_perf); | 1144 | *min = clamp_t(int, min_perf, cpu->pstate.min_pstate, max_perf); |
1143 | } | 1145 | } |
1144 | 1146 | ||
1145 | static void intel_pstate_set_min_pstate(struct cpudata *cpu) | 1147 | static void intel_pstate_set_pstate(struct cpudata *cpu, int pstate) |
1146 | { | 1148 | { |
1147 | int pstate = cpu->pstate.min_pstate; | ||
1148 | |||
1149 | trace_cpu_frequency(pstate * cpu->pstate.scaling, cpu->cpu); | 1149 | trace_cpu_frequency(pstate * cpu->pstate.scaling, cpu->cpu); |
1150 | cpu->pstate.current_pstate = pstate; | 1150 | cpu->pstate.current_pstate = pstate; |
1151 | /* | 1151 | /* |
@@ -1157,6 +1157,20 @@ static void intel_pstate_set_min_pstate(struct cpudata *cpu) | |||
1157 | pstate_funcs.get_val(cpu, pstate)); | 1157 | pstate_funcs.get_val(cpu, pstate)); |
1158 | } | 1158 | } |
1159 | 1159 | ||
1160 | static void intel_pstate_set_min_pstate(struct cpudata *cpu) | ||
1161 | { | ||
1162 | intel_pstate_set_pstate(cpu, cpu->pstate.min_pstate); | ||
1163 | } | ||
1164 | |||
1165 | static void intel_pstate_max_within_limits(struct cpudata *cpu) | ||
1166 | { | ||
1167 | int min_pstate, max_pstate; | ||
1168 | |||
1169 | update_turbo_state(); | ||
1170 | intel_pstate_get_min_max(cpu, &min_pstate, &max_pstate); | ||
1171 | intel_pstate_set_pstate(cpu, max_pstate); | ||
1172 | } | ||
1173 | |||
1160 | static void intel_pstate_get_cpu_pstates(struct cpudata *cpu) | 1174 | static void intel_pstate_get_cpu_pstates(struct cpudata *cpu) |
1161 | { | 1175 | { |
1162 | cpu->pstate.min_pstate = pstate_funcs.get_min(); | 1176 | cpu->pstate.min_pstate = pstate_funcs.get_min(); |
@@ -1325,7 +1339,8 @@ static inline void intel_pstate_adjust_busy_pstate(struct cpudata *cpu) | |||
1325 | 1339 | ||
1326 | from = cpu->pstate.current_pstate; | 1340 | from = cpu->pstate.current_pstate; |
1327 | 1341 | ||
1328 | target_pstate = pstate_funcs.get_target_pstate(cpu); | 1342 | target_pstate = cpu->policy == CPUFREQ_POLICY_PERFORMANCE ? |
1343 | cpu->pstate.turbo_pstate : pstate_funcs.get_target_pstate(cpu); | ||
1329 | 1344 | ||
1330 | intel_pstate_update_pstate(cpu, target_pstate); | 1345 | intel_pstate_update_pstate(cpu, target_pstate); |
1331 | 1346 | ||
@@ -1491,7 +1506,9 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy) | |||
1491 | pr_debug("set_policy cpuinfo.max %u policy->max %u\n", | 1506 | pr_debug("set_policy cpuinfo.max %u policy->max %u\n", |
1492 | policy->cpuinfo.max_freq, policy->max); | 1507 | policy->cpuinfo.max_freq, policy->max); |
1493 | 1508 | ||
1494 | cpu = all_cpu_data[0]; | 1509 | cpu = all_cpu_data[policy->cpu]; |
1510 | cpu->policy = policy->policy; | ||
1511 | |||
1495 | if (cpu->pstate.max_pstate_physical > cpu->pstate.max_pstate && | 1512 | if (cpu->pstate.max_pstate_physical > cpu->pstate.max_pstate && |
1496 | policy->max < policy->cpuinfo.max_freq && | 1513 | policy->max < policy->cpuinfo.max_freq && |
1497 | policy->max > cpu->pstate.max_pstate * cpu->pstate.scaling) { | 1514 | policy->max > cpu->pstate.max_pstate * cpu->pstate.scaling) { |
@@ -1499,7 +1516,7 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy) | |||
1499 | policy->max = policy->cpuinfo.max_freq; | 1516 | policy->max = policy->cpuinfo.max_freq; |
1500 | } | 1517 | } |
1501 | 1518 | ||
1502 | if (policy->policy == CPUFREQ_POLICY_PERFORMANCE) { | 1519 | if (cpu->policy == CPUFREQ_POLICY_PERFORMANCE) { |
1503 | limits = &performance_limits; | 1520 | limits = &performance_limits; |
1504 | if (policy->max >= policy->cpuinfo.max_freq) { | 1521 | if (policy->max >= policy->cpuinfo.max_freq) { |
1505 | pr_debug("set performance\n"); | 1522 | pr_debug("set performance\n"); |
@@ -1535,6 +1552,15 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy) | |||
1535 | limits->max_perf = round_up(limits->max_perf, FRAC_BITS); | 1552 | limits->max_perf = round_up(limits->max_perf, FRAC_BITS); |
1536 | 1553 | ||
1537 | out: | 1554 | out: |
1555 | if (cpu->policy == CPUFREQ_POLICY_PERFORMANCE) { | ||
1556 | /* | ||
1557 | * NOHZ_FULL CPUs need this as the governor callback may not | ||
1558 | * be invoked on them. | ||
1559 | */ | ||
1560 | intel_pstate_clear_update_util_hook(policy->cpu); | ||
1561 | intel_pstate_max_within_limits(cpu); | ||
1562 | } | ||
1563 | |||
1538 | intel_pstate_set_update_util_hook(policy->cpu); | 1564 | intel_pstate_set_update_util_hook(policy->cpu); |
1539 | 1565 | ||
1540 | intel_pstate_hwp_set_policy(policy); | 1566 | intel_pstate_hwp_set_policy(policy); |
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c index 1e7f5da648d9..6ccb08f57fcb 100644 --- a/kernel/power/suspend.c +++ b/kernel/power/suspend.c | |||
@@ -498,9 +498,9 @@ static int enter_state(suspend_state_t state) | |||
498 | 498 | ||
499 | #ifndef CONFIG_SUSPEND_SKIP_SYNC | 499 | #ifndef CONFIG_SUSPEND_SKIP_SYNC |
500 | trace_suspend_resume(TPS("sync_filesystems"), 0, true); | 500 | trace_suspend_resume(TPS("sync_filesystems"), 0, true); |
501 | printk(KERN_INFO "PM: Syncing filesystems ... "); | 501 | pr_info("PM: Syncing filesystems ... "); |
502 | sys_sync(); | 502 | sys_sync(); |
503 | printk("done.\n"); | 503 | pr_cont("done.\n"); |
504 | trace_suspend_resume(TPS("sync_filesystems"), 0, false); | 504 | trace_suspend_resume(TPS("sync_filesystems"), 0, false); |
505 | #endif | 505 | #endif |
506 | 506 | ||