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 2/3] cpufreq: intel_pstate: Use locking in intel_cpufreq_verify_policy()
Date: Fri, 30 Dec 2016 15:57:11 +0100 [thread overview]
Message-ID: <2958352.e0VhhpxTVR@aspire.rjw.lan> (raw)
In-Reply-To: <5344750.TOCWYON8QY@aspire.rjw.lan>
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
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>
---
drivers/cpufreq/intel_pstate.c | 4 ++++
1 file changed, 4 insertions(+)
Index: linux-pm/drivers/cpufreq/intel_pstate.c
===================================================================
--- linux-pm.orig/drivers/cpufreq/intel_pstate.c
+++ linux-pm/drivers/cpufreq/intel_pstate.c
@@ -2157,8 +2157,12 @@ static int intel_cpufreq_verify_policy(s
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;
}
next prev parent reply other threads:[~2016-12-30 15:02 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 ` [PATCH 1/3] cpufreq: intel_pstate: Use locking in intel_pstate_resume() Rafael J. Wysocki
2016-12-30 14:57 ` Rafael J. Wysocki [this message]
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=2958352.e0VhhpxTVR@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
all inboxes | Powered by JetHome®