diff options
author | Sang-Hun Lee <sanlee@nvidia.com> | 2013-02-10 17:48:24 -0800 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2013-09-14 13:02:37 -0700 |
commit | 89f99a20306f418d161db2f09d76edcc995525d7 (patch) | |
tree | f5fd54274ee7a5e1ab06732eab1ffaaa717c5cff /arch/arm/mach-tegra/tegra3_throttle.c | |
parent | 68b998198056a5c734a319d11e451da4f04867c1 (diff) |
arm: mach-tegra: resolve tegra_cpu_lock race condition
Problem description:
- lock used in cpuquiet, cpu-tegra3.c, tegra2-throttle.c, and tegra3_throttle
originate from cpu-tegra.c, tegra_cpu_lock
- edp_update_limit and tegra_auto_hotplug_governor need a protection from
tegra_cpu_lock. These are also called by tegra_cpu_set_speed_cap
- Some callers of tegra_cpu_set_speed_cap do not acquire tegra_cpu_lock,
but some do
Fix description:
- Create a locked variant and unlocked variant of tegra_cpu_set_speed_cap
to make it explicit that tegra_cpu_lock is needed for tegra_cpu_set_speed_cap
- Replace existing calls with new variants of tegra_cpu_set_speed_cap appropriately
Bug 1225764
Change-Id: I8aa6356df278375e3a9105023f66c8286e3fdbef
Signed-off-by: Sang-Hun Lee <sanlee@nvidia.com>
Reviewed-on: http://git-master/r/199238
(cherry picked from commit 91bdd64c3c80480195a5ccdb8cef969ca5a18afc)
Reviewed-on: http://git-master/r/207640
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Diffstat (limited to 'arch/arm/mach-tegra/tegra3_throttle.c')
-rw-r--r-- | arch/arm/mach-tegra/tegra3_throttle.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/arch/arm/mach-tegra/tegra3_throttle.c b/arch/arm/mach-tegra/tegra3_throttle.c index 62ba41b5b79d..90ab7c4b6dec 100644 --- a/arch/arm/mach-tegra/tegra3_throttle.c +++ b/arch/arm/mach-tegra/tegra3_throttle.c @@ -33,6 +33,7 @@ #include "clock.h" #include "cpu-tegra.h" +/* cpu_throttle_lock is tegra_cpu_lock from cpu-tegra.c */ static struct mutex *cpu_throttle_lock; static DEFINE_MUTEX(bthrot_list_lock); static LIST_HEAD(bthrot_list); @@ -218,9 +219,7 @@ tegra_throttle_set_cur_state(struct thermal_cooling_device *cdev, if (cur_state == 0) { tegra_throttle_cap_freqs_update(NULL, -1, 1);/* uncap freqs */ - mutex_lock(cpu_throttle_lock); tegra_cpu_set_speed_cap(NULL); - mutex_unlock(cpu_throttle_lock); } else { if (cur_state == 1 && direction == 0) bthrot->throttle_count++; @@ -234,9 +233,7 @@ tegra_throttle_set_cur_state(struct thermal_cooling_device *cdev, bthrot->cpu_cap_freq = bthrot->throt_tab[index].cap_freqs[0]; - mutex_lock(cpu_throttle_lock); tegra_cpu_set_speed_cap(NULL); - mutex_unlock(cpu_throttle_lock); } } |