lkml.org 
[lkml]   [2018]   [Apr]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH V2 6/7] thermal/drivers/cpu_cooling: Introduce the cpu idle cooling driver
From
Date
On 26/02/2018 05:30, Viresh Kumar wrote:

[ ... ]

>>>> +
>>>> + for_each_possible_cpu(cpu) {
>>>> + cpumask = topology_core_cpumask(cpu);
>>>> +
>>>> + cct = per_cpu_ptr(&cpuidle_cooling_tsk, cpu);
>>>> +
>>>> + /*
>>>> + * This condition makes the first cpu belonging to the
>>>> + * cluster to create a cooling device and allocates
>>>> + * the structure. Others CPUs belonging to the same
>>>> + * cluster will just increment the refcount on the
>>>> + * cooling device structure and initialize it.
>>>> + */
>>>> + if (cpu == cpumask_first(cpumask)) {
>>>
>>> Your function still have few assumptions of cpu numbering and it will
>>> break in few cases. What if the CPUs on a big Little system (4x4) are
>>> present in this order: B L L L L B B B ??
>>>
>>> This configuration can happen if CPUs in DT are marked as: 0-3 LITTLE,
>>> 4-7 big and a big CPU is used by the boot loader to bring up Linux.
>>
>> Ok, how can I sort it out ?
>
> I would do something like this:
>
> cpumask_copy(possible, cpu_possible_mask);
>
> while (!cpumask_empty(possible)) {
> first = cpumask_first(possible);
> cpumask = topology_core_cpumask(first);
> cpumask_andnot(possible, possible, cpumask);
>
> allocate_cooling_dev(first); //This is most of this function in your patch.
>
> while (!cpumask_empty(cpumask)) {
> temp = cpumask_first(possible);
> //rest init "temp"
> cpumask_clear_cpu(temp, cpumask);
> }
>
> //Everything done, register cooling device for cpumask.
> }


Mmh, that sounds very complex. May be it is simpler to count the number
of cluster and initialize the idle_cdev for each cluster and then go for
this loop with the cluster cpumask.




--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

\
 
 \ /
  Last update: 2018-04-04 10:50    [W:0.113 / U:0.764 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site