Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1548640
| From | "Rafael J. Wysocki" <rjw@rjwysocki.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 1/3] cpufreq: intel_pstate: Use locking in intel_pstate_resume() |
| Date | 2016-12-30 16:10 +0100 |
| Message-ID | <sU6YG-5Yf-17@gated-at.bofh.it> (permalink) |
| References | <sU6YG-5Yf-13@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Theoretically, intel_pstate_resume() may be executed in parallel
with intel_pstate_set_policy(), if the latter is invoked via
cpufreq_update_policy() as a result of a notification, so use
intel_pstate_limits_lock in there too to avoid race conditions.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/cpufreq/intel_pstate.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
Index: linux-pm/drivers/cpufreq/intel_pstate.c
===================================================================
--- linux-pm.orig/drivers/cpufreq/intel_pstate.c
+++ linux-pm/drivers/cpufreq/intel_pstate.c
@@ -968,12 +968,20 @@ static int intel_pstate_hwp_save_state(s
static int intel_pstate_resume(struct cpufreq_policy *policy)
{
+ int ret;
+
if (!hwp_active)
return 0;
+ mutex_lock(&intel_pstate_limits_lock);
+
all_cpu_data[policy->cpu]->epp_policy = 0;
- return intel_pstate_hwp_set_policy(policy);
+ ret = intel_pstate_hwp_set_policy(policy);
+
+ mutex_unlock(&intel_pstate_limits_lock);
+
+ return ret;
}
static void intel_pstate_hwp_set_online_cpus(void)
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/3] cpufreq: intel_pstate: Locking and limits fix-ups "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-12-30 16:10 +0100 [PATCH 1/3] cpufreq: intel_pstate: Use locking in intel_pstate_resume() "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-12-30 16:10 +0100 Re: [PATCH 0/3] cpufreq: intel_pstate: Locking and limits fix-ups Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> - 2016-12-30 19:00 +0100
csiph-web