From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: Leo Yan <leo.yan@linaro.org>
Cc: edubezval@gmail.com, kevin.wangtao@linaro.org,
vincent.guittot@linaro.org, amit.kachhap@gmail.com,
linux-kernel@vger.kernel.org, javi.merino@kernel.org,
rui.zhang@intel.com, daniel.thompson@linaro.org,
linux-pm@vger.kernel.org, Viresh Kumar <viresh.kumar@linaro.org>
Subject: Re: [PATCH V2 6/7] thermal/drivers/cpu_cooling: Introduce the cpu idle cooling driver
Date: Tue, 27 Mar 2018 12:56:28 +0200 [thread overview]
Message-ID: <3d1ba2a7-5520-9e80-4e30-a1a413fb417f@linaro.org> (raw)
In-Reply-To: <20180327033554.GB21693@leoy-ThinkPad-X240s>
On 27/03/2018 05:35, Leo Yan wrote:
> On Wed, Feb 21, 2018 at 04:29:27PM +0100, Daniel Lezcano wrote:
>
> [...]
>
>> +/**
>> + * cpuidle_cooling_injection_thread - Idle injection mainloop thread function
>> + * @arg: a void pointer containing the idle cooling device address
>> + *
>> + * This main function does basically two operations:
>> + *
>> + * - Goes idle for a specific amount of time
>> + *
>> + * - Sets a timer to wake up all the idle injection threads after a
>> + * running period
>> + *
>> + * That happens only when the mitigation is enabled, otherwise the
>> + * task is scheduled out.
>> + *
>> + * In order to keep the tasks synchronized together, it is the last
>> + * task exiting the idle period which is in charge of setting the
>> + * timer.
>> + *
>> + * This function never returns.
>> + */
>> +static int cpuidle_cooling_injection_thread(void *arg)
>> +{
>> + struct sched_param param = { .sched_priority = MAX_USER_RT_PRIO/2 };
>
> I am just wandering if should set priority to (MAX_RT_PRIO - 1)?
> Otherwise I am concern it might be cannot enter deep idle state when
> any CPU idle injection thread is preempted by other higher priority RT
> threads so all CPUs have no alignment for idle state entering/exiting.
I do believe we should consider other RT tasks more important than the
idle injection threads.
>> + struct cpuidle_cooling_device *idle_cdev = arg;
>> + struct cpuidle_cooling_tsk *cct = per_cpu_ptr(&cpuidle_cooling_tsk,
>> + smp_processor_id());
>> + DEFINE_WAIT(wait);
>> +
>> + set_freezable();
>> +
>> + sched_setscheduler(current, SCHED_FIFO, ¶m);
>> +
>> + while (1) {
>> + s64 next_wakeup;
>> +
>> + prepare_to_wait(&cct->waitq, &wait, TASK_INTERRUPTIBLE);
>> +
>> + schedule();
>> +
>> + atomic_inc(&idle_cdev->count);
>> +
>> + play_idle(idle_cdev->idle_cycle / USEC_PER_MSEC);
>> +
>> + /*
>> + * The last CPU waking up is in charge of setting the
>> + * timer. If the CPU is hotplugged, the timer will
>> + * move to another CPU (which may not belong to the
>> + * same cluster) but that is not a problem as the
>> + * timer will be set again by another CPU belonging to
>> + * the cluster, so this mechanism is self adaptive and
>> + * does not require any hotplugging dance.
>> + */
>> + if (!atomic_dec_and_test(&idle_cdev->count))
>> + continue;
>> +
>> + if (!idle_cdev->state)
>> + continue;
>> +
>> + next_wakeup = cpuidle_cooling_runtime(idle_cdev);
>> +
>> + hrtimer_start(&idle_cdev->timer, ns_to_ktime(next_wakeup),
>> + HRTIMER_MODE_REL_PINNED);
>
> If SoC temperature descreases under tipping point, will the timer be
> disabled for this case? Or will here set next timer event with big
> value from next_wakeup?
Another timer (the polling one) will update the 'state' variable to zero
in the set_cur_state. In the worst case, we check the idle_cdev->state
right before it is updated and we end up with an extra idle injection
cycle which is perfectly fine.
--
<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
prev parent reply other threads:[~2018-03-27 10:56 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1519226968-19821-1-git-send-email-daniel.lezcano@linaro.org>
[not found] ` <1519226968-19821-6-git-send-email-daniel.lezcano@linaro.org>
2018-03-06 23:19 ` [PATCH V2 5/7] thermal/drivers/cpu_cooling: Add idle cooling device documentation Pavel Machek
2018-03-07 11:42 ` Daniel Lezcano
2018-03-08 8:59 ` Pavel Machek
2018-03-08 11:54 ` Daniel Thompson
2018-03-07 17:09 ` [PATCH V2 0/7] CPU cooling device new strategies Eduardo Valentin
2018-03-07 18:57 ` Daniel Lezcano
2018-03-08 12:03 ` Daniel Thompson
2018-03-26 14:30 ` Leo Yan
2018-03-27 9:35 ` Daniel Lezcano
[not found] ` <1519226968-19821-7-git-send-email-daniel.lezcano@linaro.org>
[not found] ` <20180223073432.GF26947@vireshk-i7>
[not found] ` <faaf027c-e01c-6801-9a0c-ab7e0ba669a1@linaro.org>
2018-02-26 4:30 ` [PATCH V2 6/7] thermal/drivers/cpu_cooling: Introduce the cpu idle cooling driver Viresh Kumar
2018-03-13 19:15 ` Daniel Lezcano
2018-04-04 8:50 ` Daniel Lezcano
2018-04-05 4:49 ` Viresh Kumar
2018-03-27 3:43 ` Leo Yan
2018-03-27 11:10 ` Daniel Lezcano
2018-03-27 2:03 ` Leo Yan
2018-03-27 10:26 ` Daniel Lezcano
2018-03-27 12:28 ` Juri Lelli
2018-03-27 12:31 ` Daniel Lezcano
2018-03-27 13:08 ` Juri Lelli
2018-03-27 3:35 ` Leo Yan
2018-03-27 10:56 ` Daniel Lezcano [this message]
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=3d1ba2a7-5520-9e80-4e30-a1a413fb417f@linaro.org \
--to=daniel.lezcano@linaro.org \
--cc=amit.kachhap@gmail.com \
--cc=daniel.thompson@linaro.org \
--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;
as well as URLs for NNTP newsgroup(s).