From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Linux PM <linux-pm@vger.kernel.org>
Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 1/3] cpufreq: intel_pstate: Use locking in intel_pstate_resume()
Date: Fri, 30 Dec 2016 15:56:14 +0100 [thread overview]
Message-ID: <2964225.km2UYHItYB@aspire.rjw.lan> (raw)
In-Reply-To: <5344750.TOCWYON8QY@aspire.rjw.lan>
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)
next prev parent reply other threads:[~2016-12-30 15:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-30 14:54 [PATCH 0/3] cpufreq: intel_pstate: Locking and limits fix-ups Rafael J. Wysocki
2016-12-30 14:56 ` Rafael J. Wysocki [this message]
2016-12-30 14:57 ` [PATCH 2/3] cpufreq: intel_pstate: Use locking in intel_cpufreq_verify_policy() Rafael J. Wysocki
2016-12-30 14:58 ` [PATCH 3/3] cpufreq: intel_pstate: Always keep all limits settings in sync Rafael J. Wysocki
2016-12-30 17:49 ` [PATCH 0/3] cpufreq: intel_pstate: Locking and limits fix-ups Srinivas Pandruvada
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2964225.km2UYHItYB@aspire.rjw.lan \
--to=rjw@rjwysocki.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=srinivas.pandruvada@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).