[CPUFREQ] fix timer teardown in conservative governor
[sfrench/cifs-2.6.git] / drivers / cpufreq / cpufreq_conservative.c
index 2ecd95e4ab1aca33c6e858698d0c16f1b28a19ba..7a74d175287b2f44fc7a7329ce79bd51b5f9b779 100644 (file)
@@ -91,6 +91,9 @@ static unsigned int dbs_enable;       /* number of CPUs using this policy */
  * (like __cpufreq_driver_target()) is being called with dbs_mutex taken, then
  * cpu_hotplug lock should be taken before that. Note that cpu_hotplug lock
  * is recursive for the same process. -Venki
+ * DEADLOCK ALERT! (2) : do_dbs_timer() must not take the dbs_mutex, because it
+ * would deadlock with cancel_delayed_work_sync(), which is needed for proper
+ * raceless workqueue teardown.
  */
 static DEFINE_MUTEX(dbs_mutex);
 
@@ -542,7 +545,7 @@ static inline void dbs_timer_init(struct cpu_dbs_info_s *dbs_info)
 static inline void dbs_timer_exit(struct cpu_dbs_info_s *dbs_info)
 {
        dbs_info->enable = 0;
-       cancel_delayed_work(&dbs_info->work);
+       cancel_delayed_work_sync(&dbs_info->work);
 }
 
 static int cpufreq_governor_dbs(struct cpufreq_policy *policy,