[PATCH v4 3/5] cpufreq: Don't destroy/realloc policy/sysfs on hotplug/suspend
Viresh Kumar
viresh.kumar at linaro.org
Tue Aug 12 01:51:53 PDT 2014
On 12 August 2014 03:43, Saravana Kannan <skannan at codeaurora.org> wrote:
> On 08/07/2014 03:48 AM, Viresh Kumar wrote:
>>> @@ -1369,24 +1354,15 @@ static int __cpufreq_remove_dev_prepare(struct
>>> device *dev,
>>> }
>>> }
>>>
>>> - if (!cpufreq_driver->setpolicy)
>>> - strncpy(per_cpu(cpufreq_cpu_governor, cpu),
>>> - policy->governor->name, CPUFREQ_NAME_LEN);
>>> -
>>
>>
>> Why? Probably I did mention this earlier as well?
>
>
> This code is saving the governor name here to restore it when the policy is
> created again after suspend/resume or hotplug of all CPUs. Since we no
> longer throw away the policy struct, there's no point in doing this.
>
> I should remove this per cpu variable though. Will do it in v5.
Hmm, makes sense. So probably keep this code in this patch and get rid
of all uses of 'cpufreq_cpu_governor' in a separate patch.
>>> + if (cpus > 1) {
>>> + if (cpu == policy->cpu) {
>>> + new_cpu = cpumask_any_but(policy->cpus, cpu);
>>> + if (new_cpu >= 0)
>>
>>
>> Can this ever be false?
>
>
> If this is the last CPU going down.
Can that be true? Its present in (cpus > 1) block :)
>>> static int cpufreq_remove_dev(struct device *dev, struct
>>> subsys_interface *sif)
>>> {
>>> unsigned int cpu = dev->id;
>>> - int ret;
>>> -
>>> - if (cpu_is_offline(cpu))
>>> - return 0;
>>> + int ret = 0;
>>>
>>> - ret = __cpufreq_remove_dev_prepare(dev, sif);
>>> + if (cpu_online(cpu))
>>> + ret = __cpufreq_remove_dev_prepare(dev, sif);
>>
>>
>> Why do you need a change here?
>
>
> Since we no longer do remove_dev_finish during hotplug, we can't just short
> circuit the entire function. We have to finish the remove when the CPU is
> hot-removed or when the cpufreq driver is unregistered.
I think this is tricky and we must have a clear comment here..
I missed this on my initial reviews..
More information about the linux-arm-kernel
mailing list