Message ID | ee81ef766064a79a5332f390d39dc3e4cca5fca5.1422346933.git.viresh.kumar@linaro.org |
---|---|
State | New |
Headers | show |
On 12 February 2015 at 11:22, Saravana Kannan <skannan@codeaurora.org> wrote: > I don't see anything wrong with scaling_governor showing the last used > governor when the CPUs are just logically hotplug removed. In the physical But the governor is *not* used currently by the CPUs and marking it used is completely wrong. > hotplug case, the whole directory would go away and the policy would be > freed. So, this is not a concern there. Its not relevant here. > Also, longer term (after your series goes in), I think we actually should > NOT send POLICY_EXIT on just logical hotplug. That way, the governor > tunables are not lost across a logical hotplug. I am not sure about it. For example, after all CPUs of a policy are gone, the governor is free to be get removed. And so the user should be free to do rmmod on it. -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 21c8ef6073d7..ed36c09f83cc 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1032,9 +1032,6 @@ static struct cpufreq_policy *cpufreq_policy_restore(unsigned int cpu) } read_unlock_irqrestore(&cpufreq_driver_lock, flags); - if (policy) - policy->governor = NULL; - return policy; } @@ -1466,6 +1463,8 @@ static int __cpufreq_remove_dev_finish(struct device *dev, if (!cpufreq_suspended) cpufreq_policy_free(policy); + else + policy->governor = NULL; } else if (has_target()) { ret = __cpufreq_governor(policy, CPUFREQ_GOV_START); if (!ret)
Later commits would change the way policies are managed today. Policies wouldn't be freed on cpu hotplug (currently they aren't freed on suspend), and while the CPU is offline, the sysfs cpufreq files would still be present. Because we don't mark policy->governor as NULL, it still contains pointer of the last governor it used. And when we read the 'scaling_governor' file, it shows the old value. To prevent from this, mark policy->governor as NULL after we have issued CPUFREQ_GOV_POLICY_EXIT event for its governor. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> --- drivers/cpufreq/cpufreq.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)