Commit f6a7409c authored by Viresh Kumar's avatar Viresh Kumar Committed by Rafael J. Wysocki

cpufreq: Notify governors when cpus are hot-[un]plugged

Because cpufreq core and governors worry only about the online cpus, if a cpu is
hot [un]plugged, we must notify governors about it, otherwise be ready to expect
something unexpected.

We already have notifiers in the form of CPUFREQ_GOV_START/CPUFREQ_GOV_STOP, we
just need to call them now.
Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 643ae6e8
...@@ -751,11 +751,16 @@ static int cpufreq_add_dev_policy(unsigned int cpu, ...@@ -751,11 +751,16 @@ static int cpufreq_add_dev_policy(unsigned int cpu,
return -EBUSY; return -EBUSY;
} }
__cpufreq_governor(managed_policy, CPUFREQ_GOV_STOP);
spin_lock_irqsave(&cpufreq_driver_lock, flags); spin_lock_irqsave(&cpufreq_driver_lock, flags);
cpumask_copy(managed_policy->cpus, policy->cpus); cpumask_copy(managed_policy->cpus, policy->cpus);
per_cpu(cpufreq_cpu_data, cpu) = managed_policy; per_cpu(cpufreq_cpu_data, cpu) = managed_policy;
spin_unlock_irqrestore(&cpufreq_driver_lock, flags); spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
__cpufreq_governor(managed_policy, CPUFREQ_GOV_START);
__cpufreq_governor(managed_policy, CPUFREQ_GOV_LIMITS);
pr_debug("CPU already managed, adding link\n"); pr_debug("CPU already managed, adding link\n");
ret = sysfs_create_link(&dev->kobj, ret = sysfs_create_link(&dev->kobj,
&managed_policy->kobj, &managed_policy->kobj,
...@@ -1066,8 +1071,13 @@ static int __cpufreq_remove_dev(struct device *dev, struct subsys_interface *sif ...@@ -1066,8 +1071,13 @@ static int __cpufreq_remove_dev(struct device *dev, struct subsys_interface *sif
*/ */
if (unlikely(cpu != data->cpu)) { if (unlikely(cpu != data->cpu)) {
pr_debug("removing link\n"); pr_debug("removing link\n");
__cpufreq_governor(data, CPUFREQ_GOV_STOP);
cpumask_clear_cpu(cpu, data->cpus); cpumask_clear_cpu(cpu, data->cpus);
spin_unlock_irqrestore(&cpufreq_driver_lock, flags); spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
__cpufreq_governor(data, CPUFREQ_GOV_START);
__cpufreq_governor(data, CPUFREQ_GOV_LIMITS);
kobj = &dev->kobj; kobj = &dev->kobj;
cpufreq_cpu_put(data); cpufreq_cpu_put(data);
unlock_policy_rwsem_write(cpu); unlock_policy_rwsem_write(cpu);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment