summaryrefslogtreecommitdiff
path: root/drivers/cpuquiet
diff options
context:
space:
mode:
authorPeter Boonstoppel <pboonstoppel@nvidia.com>2013-01-24 11:04:02 -0800
committerMrutyunjay Sawant <msawant@nvidia.com>2013-02-14 06:05:27 -0800
commit6c7e9a897eee426661f6e8ca1ca420d28a004289 (patch)
treebf6feb219855af6b97fc30f34dd3fb5bfa1979e0 /drivers/cpuquiet
parent26d32b09e4bca90b8b10da9b88f370fe451bab52 (diff)
cpuquiet: Remove synchronization from runnables_work_func()
runnables_stop() can deadlock when cancel_work_sync() waits for the work function to end and the work function blocks on the same lock held by runnables_stop(). Removing the locks from runnables_work_func() fixes this. This should be safe because runnables_lock protects runnables_state and runnables_work_func() only reads runnables_state. Also, the functions that change state to DISABLED do a cancel_work_sync() to guarantee the work function stopped running. Bug 1215668 Change-Id: I70617b3b0fc81db8555869e67e3b11652af8d94c Signed-off-by: Peter Boonstoppel <pboonstoppel@nvidia.com> Reviewed-on: http://git-master/r/195797 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Diwakar Tundlam <dtundlam@nvidia.com> Tested-by: Sang-Hun Lee <sanlee@nvidia.com> Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Diffstat (limited to 'drivers/cpuquiet')
-rw-r--r--drivers/cpuquiet/governors/runnable_threads.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/drivers/cpuquiet/governors/runnable_threads.c b/drivers/cpuquiet/governors/runnable_threads.c
index 6eba7a61a012..676cde5bdec6 100644
--- a/drivers/cpuquiet/governors/runnable_threads.c
+++ b/drivers/cpuquiet/governors/runnable_threads.c
@@ -183,11 +183,8 @@ static void runnables_work_func(struct work_struct *work)
unsigned int cpu = nr_cpu_ids;
int action, state;
- mutex_lock(&runnables_lock);
- if (runnables_state != RUNNING) {
- mutex_unlock(&runnables_lock);
+ if (runnables_state != RUNNING)
return;
- }
action = get_action(nr_run_last);
if (action > 0) {
@@ -199,7 +196,6 @@ static void runnables_work_func(struct work_struct *work)
if (cpu < nr_cpu_ids)
cpuquiet_quiesence_cpu(cpu);
}
- mutex_unlock(&runnables_lock);
}
CPQ_BASIC_ATTRIBUTE(sample_rate, 0644, uint);