Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1548639 > unrolled thread

[PATCH 0/3] cpufreq: intel_pstate: Locking and limits fix-ups

Started by"Rafael J. Wysocki" <rjw@rjwysocki.net>
First post2016-12-30 16:10 +0100
Last post2016-12-30 19:00 +0100
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [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

#1548639 — [PATCH 0/3] cpufreq: intel_pstate: Locking and limits fix-ups

From"Rafael J. Wysocki" <rjw@rjwysocki.net>
Date2016-12-30 16:10 +0100
Subject[PATCH 0/3] cpufreq: intel_pstate: Locking and limits fix-ups
Message-ID<sU6YG-5Yf-13@gated-at.bofh.it>
Hi,

This series fixes a couple of possible locking issues and limits synchronization
in intel pstate.

[1/3] Add locking to intel_pstate_resume().
[2/3] Add locking to intel_cpufreq_verify_policy().
[3/3] Always keep all limits settings in sync.

Thanks,
Rafael

[toc] | [next] | [standalone]


#1548640 — [PATCH 1/3] cpufreq: intel_pstate: Use locking in intel_pstate_resume()

From"Rafael J. Wysocki" <rjw@rjwysocki.net>
Date2016-12-30 16:10 +0100
Subject[PATCH 1/3] cpufreq: intel_pstate: Use locking in intel_pstate_resume()
Message-ID<sU6YG-5Yf-17@gated-at.bofh.it>
In reply to#1548639
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)

[toc] | [prev] | [next] | [standalone]


#1548665

FromSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Date2016-12-30 19:00 +0100
Message-ID<sU9Db-7ue-5@gated-at.bofh.it>
In reply to#1548639
On Fri, 2016-12-30 at 15:54 +0100, Rafael J. Wysocki wrote:
> Hi,
> 
> This series fixes a couple of possible locking issues and limits
> synchronization
> in intel pstate.
> 
> [1/3] Add locking to intel_pstate_resume().
> [2/3] Add locking to intel_cpufreq_verify_policy().
> [3/3] Always keep all limits settings in sync.
> 
Looks good to me.

Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>


Thanks,
Srinivas

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web