Commit 111b8b3f authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

cpufreq: intel_pstate: Always keep all limits settings in sync

Make intel_pstate update per-logical-CPU limits when the global
settings are changed to ensure that they are always in sync and
users will not see confusing values in per-logical-CPU sysfs
attributes.

This also fixes the problem that setting the "no_turbo" global
attribute to 1 in the "passive" mode (ie. when intel_pstate acts
as a regular cpufreq driver) when scaling_governor is set to
"performance" has no effect.
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: default avatarSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
parent cad30467
...@@ -803,13 +803,13 @@ static struct freq_attr *hwp_cpufreq_attrs[] = { ...@@ -803,13 +803,13 @@ static struct freq_attr *hwp_cpufreq_attrs[] = {
NULL, NULL,
}; };
static void intel_pstate_hwp_set(const struct cpumask *cpumask) static void intel_pstate_hwp_set(struct cpufreq_policy *policy)
{ {
int min, hw_min, max, hw_max, cpu, range, adj_range; int min, hw_min, max, hw_max, cpu, range, adj_range;
struct perf_limits *perf_limits = limits; struct perf_limits *perf_limits = limits;
u64 value, cap; u64 value, cap;
for_each_cpu(cpu, cpumask) { for_each_cpu(cpu, policy->cpus) {
int max_perf_pct, min_perf_pct; int max_perf_pct, min_perf_pct;
struct cpudata *cpu_data = all_cpu_data[cpu]; struct cpudata *cpu_data = all_cpu_data[cpu];
s16 epp; s16 epp;
...@@ -895,7 +895,7 @@ static void intel_pstate_hwp_set(const struct cpumask *cpumask) ...@@ -895,7 +895,7 @@ static void intel_pstate_hwp_set(const struct cpumask *cpumask)
static int intel_pstate_hwp_set_policy(struct cpufreq_policy *policy) static int intel_pstate_hwp_set_policy(struct cpufreq_policy *policy)
{ {
if (hwp_active) if (hwp_active)
intel_pstate_hwp_set(policy->cpus); intel_pstate_hwp_set(policy);
return 0; return 0;
} }
...@@ -930,11 +930,12 @@ static int intel_pstate_resume(struct cpufreq_policy *policy) ...@@ -930,11 +930,12 @@ static int intel_pstate_resume(struct cpufreq_policy *policy)
return ret; return ret;
} }
static void intel_pstate_hwp_set_online_cpus(void) static void intel_pstate_update_policies(void)
{ {
get_online_cpus(); int cpu;
intel_pstate_hwp_set(cpu_online_mask);
put_online_cpus(); for_each_possible_cpu(cpu)
cpufreq_update_policy(cpu);
} }
/************************** debugfs begin ************************/ /************************** debugfs begin ************************/
...@@ -1055,11 +1056,10 @@ static ssize_t store_no_turbo(struct kobject *a, struct attribute *b, ...@@ -1055,11 +1056,10 @@ static ssize_t store_no_turbo(struct kobject *a, struct attribute *b,
limits->no_turbo = clamp_t(int, input, 0, 1); limits->no_turbo = clamp_t(int, input, 0, 1);
if (hwp_active)
intel_pstate_hwp_set_online_cpus();
mutex_unlock(&intel_pstate_limits_lock); mutex_unlock(&intel_pstate_limits_lock);
intel_pstate_update_policies();
return count; return count;
} }
...@@ -1084,11 +1084,10 @@ static ssize_t store_max_perf_pct(struct kobject *a, struct attribute *b, ...@@ -1084,11 +1084,10 @@ static ssize_t store_max_perf_pct(struct kobject *a, struct attribute *b,
limits->max_perf_pct); limits->max_perf_pct);
limits->max_perf = div_ext_fp(limits->max_perf_pct, 100); limits->max_perf = div_ext_fp(limits->max_perf_pct, 100);
if (hwp_active)
intel_pstate_hwp_set_online_cpus();
mutex_unlock(&intel_pstate_limits_lock); mutex_unlock(&intel_pstate_limits_lock);
intel_pstate_update_policies();
return count; return count;
} }
...@@ -1113,11 +1112,10 @@ static ssize_t store_min_perf_pct(struct kobject *a, struct attribute *b, ...@@ -1113,11 +1112,10 @@ static ssize_t store_min_perf_pct(struct kobject *a, struct attribute *b,
limits->min_perf_pct); limits->min_perf_pct);
limits->min_perf = div_ext_fp(limits->min_perf_pct, 100); limits->min_perf = div_ext_fp(limits->min_perf_pct, 100);
if (hwp_active)
intel_pstate_hwp_set_online_cpus();
mutex_unlock(&intel_pstate_limits_lock); mutex_unlock(&intel_pstate_limits_lock);
intel_pstate_update_policies();
return count; return count;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment