Skip to content

Commit b546e0c

Browse files
committed
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
2 parents 1308fd7 + 8b2ada2 commit b546e0c

File tree

2 files changed

+34
-8
lines changed

2 files changed

+34
-8
lines changed

drivers/cpufreq/intel_pstate.c

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ struct _pid {
179179
/**
180180
* struct cpudata - Per CPU instance data storage
181181
* @cpu: CPU number for this instance data
182+
* @policy: CPUFreq policy value
182183
* @update_util: CPUFreq utility callback information
183184
* @update_util_set: CPUFreq utility callback is set
184185
* @iowait_boost: iowait-related boost fraction
@@ -201,6 +202,7 @@ struct _pid {
201202
struct cpudata {
202203
int cpu;
203204

205+
unsigned int policy;
204206
struct update_util_data update_util;
205207
bool update_util_set;
206208

@@ -1142,10 +1144,8 @@ static void intel_pstate_get_min_max(struct cpudata *cpu, int *min, int *max)
11421144
*min = clamp_t(int, min_perf, cpu->pstate.min_pstate, max_perf);
11431145
}
11441146

1145-
static void intel_pstate_set_min_pstate(struct cpudata *cpu)
1147+
static void intel_pstate_set_pstate(struct cpudata *cpu, int pstate)
11461148
{
1147-
int pstate = cpu->pstate.min_pstate;
1148-
11491149
trace_cpu_frequency(pstate * cpu->pstate.scaling, cpu->cpu);
11501150
cpu->pstate.current_pstate = pstate;
11511151
/*
@@ -1157,6 +1157,20 @@ static void intel_pstate_set_min_pstate(struct cpudata *cpu)
11571157
pstate_funcs.get_val(cpu, pstate));
11581158
}
11591159

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+
11601174
static void intel_pstate_get_cpu_pstates(struct cpudata *cpu)
11611175
{
11621176
cpu->pstate.min_pstate = pstate_funcs.get_min();
@@ -1325,7 +1339,8 @@ static inline void intel_pstate_adjust_busy_pstate(struct cpudata *cpu)
13251339

13261340
from = cpu->pstate.current_pstate;
13271341

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

13301345
intel_pstate_update_pstate(cpu, target_pstate);
13311346

@@ -1491,15 +1506,17 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy)
14911506
pr_debug("set_policy cpuinfo.max %u policy->max %u\n",
14921507
policy->cpuinfo.max_freq, policy->max);
14931508

1494-
cpu = all_cpu_data[0];
1509+
cpu = all_cpu_data[policy->cpu];
1510+
cpu->policy = policy->policy;
1511+
14951512
if (cpu->pstate.max_pstate_physical > cpu->pstate.max_pstate &&
14961513
policy->max < policy->cpuinfo.max_freq &&
14971514
policy->max > cpu->pstate.max_pstate * cpu->pstate.scaling) {
14981515
pr_debug("policy->max > max non turbo frequency\n");
14991516
policy->max = policy->cpuinfo.max_freq;
15001517
}
15011518

1502-
if (policy->policy == CPUFREQ_POLICY_PERFORMANCE) {
1519+
if (cpu->policy == CPUFREQ_POLICY_PERFORMANCE) {
15031520
limits = &performance_limits;
15041521
if (policy->max >= policy->cpuinfo.max_freq) {
15051522
pr_debug("set performance\n");
@@ -1535,6 +1552,15 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy)
15351552
limits->max_perf = round_up(limits->max_perf, FRAC_BITS);
15361553

15371554
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+
15381564
intel_pstate_set_update_util_hook(policy->cpu);
15391565

15401566
intel_pstate_hwp_set_policy(policy);

kernel/power/suspend.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -498,9 +498,9 @@ static int enter_state(suspend_state_t state)
498498

499499
#ifndef CONFIG_SUSPEND_SKIP_SYNC
500500
trace_suspend_resume(TPS("sync_filesystems"), 0, true);
501-
printk(KERN_INFO "PM: Syncing filesystems ... ");
501+
pr_info("PM: Syncing filesystems ... ");
502502
sys_sync();
503-
printk("done.\n");
503+
pr_cont("done.\n");
504504
trace_suspend_resume(TPS("sync_filesystems"), 0, false);
505505
#endif
506506

0 commit comments

Comments
 (0)