diff options
Diffstat (limited to 'drivers/cpufreq/cpufreq_conservative.c')
-rw-r--r-- | drivers/cpufreq/cpufreq_conservative.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c index e07a35487bde..8878a154ed43 100644 --- a/drivers/cpufreq/cpufreq_conservative.c +++ b/drivers/cpufreq/cpufreq_conservative.c | |||
@@ -72,6 +72,14 @@ static DEFINE_PER_CPU(struct cpu_dbs_info_s, cpu_dbs_info); | |||
72 | 72 | ||
73 | static unsigned int dbs_enable; /* number of CPUs using this policy */ | 73 | static unsigned int dbs_enable; /* number of CPUs using this policy */ |
74 | 74 | ||
75 | /* | ||
76 | * DEADLOCK ALERT! There is a ordering requirement between cpu_hotplug | ||
77 | * lock and dbs_mutex. cpu_hotplug lock should always be held before | ||
78 | * dbs_mutex. If any function that can potentially take cpu_hotplug lock | ||
79 | * (like __cpufreq_driver_target()) is being called with dbs_mutex taken, then | ||
80 | * cpu_hotplug lock should be taken before that. Note that cpu_hotplug lock | ||
81 | * is recursive for the same process. -Venki | ||
82 | */ | ||
75 | static DEFINE_MUTEX (dbs_mutex); | 83 | static DEFINE_MUTEX (dbs_mutex); |
76 | static DECLARE_WORK (dbs_work, do_dbs_timer, NULL); | 84 | static DECLARE_WORK (dbs_work, do_dbs_timer, NULL); |
77 | 85 | ||
@@ -414,12 +422,14 @@ static void dbs_check_cpu(int cpu) | |||
414 | static void do_dbs_timer(void *data) | 422 | static void do_dbs_timer(void *data) |
415 | { | 423 | { |
416 | int i; | 424 | int i; |
425 | lock_cpu_hotplug(); | ||
417 | mutex_lock(&dbs_mutex); | 426 | mutex_lock(&dbs_mutex); |
418 | for_each_online_cpu(i) | 427 | for_each_online_cpu(i) |
419 | dbs_check_cpu(i); | 428 | dbs_check_cpu(i); |
420 | schedule_delayed_work(&dbs_work, | 429 | schedule_delayed_work(&dbs_work, |
421 | usecs_to_jiffies(dbs_tuners_ins.sampling_rate)); | 430 | usecs_to_jiffies(dbs_tuners_ins.sampling_rate)); |
422 | mutex_unlock(&dbs_mutex); | 431 | mutex_unlock(&dbs_mutex); |
432 | unlock_cpu_hotplug(); | ||
423 | } | 433 | } |
424 | 434 | ||
425 | static inline void dbs_timer_init(void) | 435 | static inline void dbs_timer_init(void) |
@@ -514,6 +524,7 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
514 | break; | 524 | break; |
515 | 525 | ||
516 | case CPUFREQ_GOV_LIMITS: | 526 | case CPUFREQ_GOV_LIMITS: |
527 | lock_cpu_hotplug(); | ||
517 | mutex_lock(&dbs_mutex); | 528 | mutex_lock(&dbs_mutex); |
518 | if (policy->max < this_dbs_info->cur_policy->cur) | 529 | if (policy->max < this_dbs_info->cur_policy->cur) |
519 | __cpufreq_driver_target( | 530 | __cpufreq_driver_target( |
@@ -524,6 +535,7 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
524 | this_dbs_info->cur_policy, | 535 | this_dbs_info->cur_policy, |
525 | policy->min, CPUFREQ_RELATION_L); | 536 | policy->min, CPUFREQ_RELATION_L); |
526 | mutex_unlock(&dbs_mutex); | 537 | mutex_unlock(&dbs_mutex); |
538 | unlock_cpu_hotplug(); | ||
527 | break; | 539 | break; |
528 | } | 540 | } |
529 | return 0; | 541 | return 0; |