Hi Saravana, On 23 June 2013 08:32, Saravana Kannan <skannan@xxxxxxxxxxxxxx> wrote: > The sysfs store ops need to grab the policy write semaphore to avoid race > with hotplug and cpufreq_update_policy() calls. Without this, we could end > up with simultaneous calls to cpufreq_driver->target() Interesting. > diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c > index 2d53f47..37db7f0 100644 > --- a/drivers/cpufreq/cpufreq.c > +++ b/drivers/cpufreq/cpufreq.c > @@ -420,9 +420,13 @@ static ssize_t store_##file_name \ > if (ret != 1) \ > return -EINVAL; \ > \ > + lock_policy_rwsem_write(policy->cpu); \ > + \ > ret = __cpufreq_set_policy(policy, &new_policy); \ > policy->user_policy.object = policy->object; \ > \ > + unlock_policy_rwsem_write(policy->cpu); \ > + \ > return ret ? ret : count; \ > } As far as I know, this protection already exists. Check this function, which eventually calls all **store() related to struct freq_attr static ssize_t store(struct kobject *kobj, struct attribute *attr, const char *buf, size_t count) { struct cpufreq_policy *policy = to_policy(kobj); struct freq_attr *fattr = to_attr(attr); ssize_t ret = -EINVAL; policy = cpufreq_cpu_get_sysfs(policy->cpu); if (!policy) goto no_policy; if (lock_policy_rwsem_write(policy->cpu) < 0) goto fail; if (fattr->store) ret = fattr->store(policy, buf, count); else ret = -EIO; unlock_policy_rwsem_write(policy->cpu); fail: cpufreq_cpu_put_sysfs(policy); no_policy: return ret; } -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html