summaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2016-12-30 15:57:11 +0100
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2016-12-31 21:48:43 +0100
commitcad30467963267509d5b0d7d3c9bd1af3b91e720 (patch)
tree1401116f7b9bce68c4d4c1140b4648c5dcd1919f /drivers/cpufreq
parentcpufreq: intel_pstate: Use locking in intel_pstate_resume() (diff)
downloadlinux-cad30467963267509d5b0d7d3c9bd1af3b91e720.tar.xz
linux-cad30467963267509d5b0d7d3c9bd1af3b91e720.zip
cpufreq: intel_pstate: Use locking in intel_cpufreq_verify_policy()
Race conditions are possible if intel_cpufreq_verify_policy() is executed in parallel with global limits updates from sysfs, so the invocation of intel_pstate_update_perf_limits() in it should be carried out under intel_pstate_limits_lock. Make that happen. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r--drivers/cpufreq/intel_pstate.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index dc457abb7dab..f8e514d7fbc4 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -2103,8 +2103,12 @@ static int intel_cpufreq_verify_policy(struct cpufreq_policy *policy)
if (per_cpu_limits)
perf_limits = cpu->perf_limits;
+ mutex_lock(&intel_pstate_limits_lock);
+
intel_pstate_update_perf_limits(policy, perf_limits);
+ mutex_unlock(&intel_pstate_limits_lock);
+
return 0;
}