On 23 May 2013 08:14, Xiaoguang Chen <chenxg@xxxxxxxxxxx> wrote: > Do you mean my patch will cause deadlock? I once tried to add another lock > to protect the GOV_STOP/START sequence instead of using the rwsem in this > patch. > But I saw deadlock indeed. > In cpufreq_add_policy_cpu, the lock has to be added before the rwsem since > GOV_STOP is > before lock_policy_rwsem_write, but in cpufreq_update_policy, it will first > get the rwsem, and then > call __cpufreq_set_policy which will contain GOV_STOP again, if we add the > new lock before this GOV_STOP, > then we may get deadlock in below sequence: > 1) hotplug in one cpu by calling cpufreq_add_policy_cpu in which new lock is > locked first then rwsem is locked. > 2) governor change in cpufreq_update_policy in which rwsem is locked first > then new lock is locked. > this is a deadlock issue if above two steps interleaves Check this patch. https://patchwork-mail.kernel.org/patch/2575231/ -- To unsubscribe from this list: send the line "unsubscribe cpufreq" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html