The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: Vincent Guittot <vincent.guittot@linaro.org>
Cc: Eduardo Valentin <edubezval@gmail.com>,
	Kevin Wangtao <kevin.wangtao@linaro.org>,
	Leo Yan <leo.yan@linaro.org>,
	Amit Kachhap <amit.kachhap@gmail.com>,
	viresh kumar <viresh.kumar@linaro.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Zhang Rui <rui.zhang@intel.com>,
	Javi Merino <javi.merino@kernel.org>,
	"open list:THERMAL" <linux-pm@vger.kernel.org>
Subject: Re: [PATCH 5/8] thermal/drivers/cpu_cooling: Introduce the cpu idle cooling driver
Date: Wed, 31 Jan 2018 16:27:44 +0100	[thread overview]
Message-ID: <22f4c4fc-fd74-b635-6859-7e2f599695f7@linaro.org> (raw)
In-Reply-To: <CAKfTPtAFNdOsNOBC8Qg3c=OB7P635gvePvfpDbc5QF10Tei-9Q@mail.gmail.com>

On 31/01/2018 10:56, Vincent Guittot wrote:
> On 31 January 2018 at 10:50, Daniel Lezcano <daniel.lezcano@linaro.org> wrote:
>> On 31/01/2018 10:46, Vincent Guittot wrote:
>>> On 31 January 2018 at 10:33, Daniel Lezcano <daniel.lezcano@linaro.org> wrote:
>>>> On 31/01/2018 10:01, Vincent Guittot wrote:
>>>>> Hi Daniel,
>>>>>
>>>>> On 23 January 2018 at 16:34, Daniel Lezcano <daniel.lezcano@linaro.org> wrote:
>>>>
>>>> [ ... ] (please trim :)
>>>>
>>>>>> +               /*
>>>>>> +                * Each cooling device is per package. Each package
>>>>>> +                * has a set of cpus where the physical number is
>>>>>> +                * duplicate in the kernel namespace. We need a way to
>>>>>> +                * address the waitq[] and tsk[] arrays with index
>>>>>> +                * which are not Linux cpu numbered.
>>>>>> +                *
>>>>>> +                * One solution is to use the
>>>>>> +                * topology_core_id(cpu). Other solution is to use the
>>>>>> +                * modulo.
>>>>>> +                *
>>>>>> +                * eg. 2 x cluster - 4 cores.
>>>>>> +                *
>>>>>> +                * Physical numbering -> Linux numbering -> % nr_cpus
>>>>>> +                *
>>>>>> +                * Pkg0 - Cpu0 -> 0 -> 0
>>>>>> +                * Pkg0 - Cpu1 -> 1 -> 1
>>>>>> +                * Pkg0 - Cpu2 -> 2 -> 2
>>>>>> +                * Pkg0 - Cpu3 -> 3 -> 3
>>>>>> +                *
>>>>>> +                * Pkg1 - Cpu0 -> 4 -> 0
>>>>>> +                * Pkg1 - Cpu1 -> 5 -> 1
>>>>>> +                * Pkg1 - Cpu2 -> 6 -> 2
>>>>>> +                * Pkg1 - Cpu3 -> 7 -> 3
>>>>>
>>>>>
>>>>> I'm not sure that the assumption above for the CPU numbering is safe.
>>>>> Can't you use a per cpu structure to point to resources that are per
>>>>> cpu instead ? so you will not have to rely on CPU ordering
>>>>
>>>> Can you elaborate ? I don't get the part with the percpu structure.
>>>
>>> Something like:
>>>
>>> struct cpuidle_cooling_cpu {
>>>        struct task_struct *tsk;
>>>        wait_queue_head_t waitq;
>>> };
>>>
>>> DECLARE_PER_CPU(struct cpuidle_cooling_cpu *, cpu_data);
>>
>> I got this part but I don't get how that fixes the ordering thing.
> 
> Because you don't care of the CPU ordering to retrieve the data as
> they are stored per cpu directly

That's what I did initially, but for consistency reasons with the
cpufreq cpu cooling device which is stored in a list and the combo cpu
cooling device, the cpuidle cooling device must be per cluster and
stored in a list.

Alternatively I can do:

struct cpuidle_cooling_device {
	struct thermal_cooling_device *cdev;
-	struct task_struct **tsk;
+	struct task_struct __percpu *tsk;
	struct cpumask *cpumask;
	struct list_head node;
	struct hrtimer timer;
	struct kref kref;
-	wait_queue_head_t *waitq;
+	wait_queue_head_t __percpu waitq;
	atomic_t count;
	unsigned int idle_cycle;
	unsigned int state;
};


-- 
 <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

  reply	other threads:[~2018-01-31 15:27 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-23 15:34 [PATCH 0/8] CPU cooling device new strategies Daniel Lezcano
2018-01-23 15:34 ` [PATCH 1/8] thermal/drivers/cpu_cooling: Fixup the header and copyright Daniel Lezcano
2018-01-31  5:17   ` Viresh Kumar
2018-01-31  7:03     ` Daniel Lezcano
2018-01-23 15:34 ` [PATCH 2/8] thermal/drivers/cpu_cooling: Add Software Package Data Exchange (SPDX) Daniel Lezcano
2018-01-31  5:18   ` Viresh Kumar
2018-02-08 14:05   ` Philippe Ombredanne
2018-02-08 14:07     ` Daniel Lezcano
2018-01-23 15:34 ` [PATCH 3/8] thermal/drivers/cpu_cooling: Remove pointless field Daniel Lezcano
2018-01-31  5:20   ` Viresh Kumar
2018-01-23 15:34 ` [PATCH 4/8] thermal/drivers/Kconfig: Convert the CPU cooling device to a choice Daniel Lezcano
2018-01-24 16:34   ` Daniel Thompson
2018-01-24 16:59     ` Daniel Lezcano
2018-01-25 10:57       ` Daniel Thompson
2018-01-25 13:36         ` Daniel Lezcano
2018-01-26 12:16           ` Daniel Thompson
2018-01-26 13:25             ` Daniel Lezcano
2018-01-31 10:09               ` Daniel Thompson
2018-02-07  9:04   ` Viresh Kumar
2018-02-07 10:15     ` Daniel Lezcano
2018-02-07 10:20       ` Viresh Kumar
2018-01-23 15:34 ` [PATCH 5/8] thermal/drivers/cpu_cooling: Introduce the cpu idle cooling driver Daniel Lezcano
2018-01-31  9:01   ` Vincent Guittot
2018-01-31  9:33     ` Daniel Lezcano
2018-01-31  9:46       ` Vincent Guittot
2018-01-31  9:50         ` Daniel Lezcano
2018-01-31  9:56           ` Vincent Guittot
2018-01-31 15:27             ` Daniel Lezcano [this message]
2018-02-01  7:57               ` Vincent Guittot
2018-02-01  8:25                 ` Daniel Lezcano
2018-02-05 13:54   ` Daniel Thompson
2018-02-06 11:34     ` Daniel Lezcano
2018-02-07  9:12   ` Viresh Kumar
2018-02-07 10:34     ` Daniel Lezcano
2018-02-07 10:41       ` Viresh Kumar
2018-02-09  9:41       ` Viresh Kumar
2018-02-16 17:39         ` Daniel Lezcano
2018-01-23 15:34 ` [PATCH 6/8] thermal/drivers/cpu_cooling: Add idle cooling device documentation Daniel Lezcano
2018-01-23 15:34 ` [PATCH 7/8] cpuidle/drivers/cpuidle-arm: Register the cooling device Daniel Lezcano
2018-01-23 15:34 ` [PATCH 8/8] thermal/drivers/cpu_cooling: Add the combo cpu " Daniel Lezcano
2018-02-02 10:42   ` Viresh Kumar
2018-02-02 14:30     ` Daniel Lezcano
2018-02-05  4:17       ` Viresh Kumar
2018-02-05 10:32         ` Daniel Lezcano
2018-02-06  4:28           ` Viresh Kumar
2018-02-06 10:48             ` Daniel Lezcano
2018-02-07  7:26               ` Viresh Kumar
2018-02-07 10:05                 ` Daniel Lezcano
2018-02-09  9:44       ` Viresh Kumar
2018-02-16  9:11         ` Daniel Lezcano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=22f4c4fc-fd74-b635-6859-7e2f599695f7@linaro.org \
    --to=daniel.lezcano@linaro.org \
    --cc=amit.kachhap@gmail.com \
    --cc=edubezval@gmail.com \
    --cc=javi.merino@kernel.org \
    --cc=kevin.wangtao@linaro.org \
    --cc=leo.yan@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=vincent.guittot@linaro.org \
    --cc=viresh.kumar@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox