linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: Martin Kepplinger <martin.kepplinger@puri.sm>,
	viresh.kumar@linaro.org, kevin.wangtao@linaro.org,
	leo.yan@linaro.org, edubezval@gmail.com,
	vincent.guittot@linaro.org, javi.merino@kernel.org,
	rui.zhang@intel.com, daniel.thompson@linaro.org
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 6/7] thermal/drivers/cpu_cooling: Introduce the cpu idle cooling driver
Date: Mon, 5 Aug 2019 09:37:43 +0200	[thread overview]
Message-ID: <2d7f1caa-351a-8fdc-bb6b-151f7313a042@linaro.org> (raw)
In-Reply-To: <20190805051111.24318-1-martin.kepplinger@puri.sm>

On 05/08/2019 07:11, Martin Kepplinger wrote:
> ---

[ ... ]

>> +static s64 cpuidle_cooling_runtime(struct cpuidle_cooling_device *idle_cdev)
>> +{
>> +	s64 next_wakeup;
>> +	unsigned long state = idle_cdev->state;
>> +
>> +	/*
>> +	 * The function should not be called when there is no
>> +	 * mitigation because:
>> +	 * - that does not make sense
>> +	 * - we end up with a division by zero
>> +	 */
>> +	if (!state)
>> +		return 0;
>> +
>> +	next_wakeup = (s64)((idle_cdev->idle_cycle * 100) / state) -
>> +		idle_cdev->idle_cycle;
>> +
>> +	return next_wakeup * NSEC_PER_USEC;
>> +}
>> +
> 
> There is a bug in your calculation formula here when "state" becomes 100.
> You return 0 for the injection rate, which is the same as "rate" being 0,
> which is dangerous. You stop cooling when it's most necessary :)

Right, thanks for spotting this.

> I'm not sure how much sense really being 100% idle makes, so I, when testing
> this, just say if (state == 100) { state = 99 }. Anyways, just don't return 0.
> 
> Daniel, thanks a lot for these additions! Could you send an update of this?

Yes, I'm working on a new version.

> btw, that's what I'm referring to:
> https://lore.kernel.org/linux-pm/1522945005-7165-1-git-send-email-daniel.lezcano@linaro.org/
> I know it's a little old already, but it seems like there hasn't been any
> equivalent solution in the meantime, has it?
> 
> Using cpuidle for cooling is way more effective than cpufreq (which often
> hardly is).

On which platform that happens?


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


  parent reply	other threads:[~2019-08-05  7:37 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-05 16:16 [PATCH v3 0/7] CPU cooling device new strategies Daniel Lezcano
2018-04-05 16:16 ` [PATCH v3 1/7] thermal/drivers/cpu_cooling: Fixup the header and copyright Daniel Lezcano
     [not found]   ` <20180411061514.GL7671@vireshk-i7>
2018-04-11  8:56     ` Daniel Lezcano
2018-04-05 16:16 ` [PATCH v3 2/7] thermal/drivers/cpu_cooling: Add Software Package Data Exchange (SPDX) Daniel Lezcano
2018-04-05 16:16 ` [PATCH v3 3/7] thermal/drivers/cpu_cooling: Remove pointless field Daniel Lezcano
2018-04-05 16:16 ` [PATCH v3 4/7] thermal/drivers/Kconfig: Convert the CPU cooling device to a choice Daniel Lezcano
     [not found]   ` <20180411061851.GM7671@vireshk-i7>
2018-04-11  8:58     ` Daniel Lezcano
2018-04-05 16:16 ` [PATCH v3 5/7] thermal/drivers/cpu_cooling: Add idle cooling device documentation Daniel Lezcano
2018-04-05 16:16 ` [PATCH v3 6/7] thermal/drivers/cpu_cooling: Introduce the cpu idle cooling driver Daniel Lezcano
2018-04-11  8:51   ` Viresh Kumar
2018-04-11  9:29     ` Daniel Lezcano
2018-04-13 11:23   ` Sudeep Holla
2018-04-13 11:47     ` Daniel Lezcano
2018-04-16  7:37       ` Viresh Kumar
2018-04-16  7:44         ` Daniel Lezcano
2018-04-16  9:34           ` Sudeep Holla
2018-04-16  9:37           ` Viresh Kumar
2018-04-16  9:45             ` Daniel Lezcano
2018-04-16  9:50               ` Viresh Kumar
2018-04-16 10:03                 ` Daniel Lezcano
2018-04-16 10:10                   ` Viresh Kumar
2018-04-16 12:10                     ` Daniel Lezcano
2018-04-16 12:30                       ` Lorenzo Pieralisi
2018-04-16 13:57                         ` Daniel Lezcano
2018-04-16 14:22                           ` Lorenzo Pieralisi
2018-04-17  7:17                             ` Daniel Lezcano
2018-04-17 10:24                               ` Lorenzo Pieralisi
2018-04-16 12:31                       ` Sudeep Holla
2018-04-16 12:49                         ` Daniel Lezcano
2018-04-16 13:03                           ` Sudeep Holla
2018-04-16 12:29                 ` Sudeep Holla
2018-04-13 11:38   ` Daniel Thompson
2018-04-13 11:46     ` Daniel Lezcano
2019-08-05  5:11   ` Martin Kepplinger
2019-08-05  6:53     ` Martin Kepplinger
2019-08-05  7:39       ` Daniel Lezcano
2019-08-05  7:42         ` Martin Kepplinger
2019-08-05  7:58           ` Daniel Lezcano
2019-10-25 11:22             ` Martin Kepplinger
2019-10-25 14:45               ` Daniel Lezcano
2019-10-26 18:23                 ` Martin Kepplinger
2019-10-28 15:16                   ` Daniel Lezcano
2019-08-05  7:37     ` Daniel Lezcano [this message]
2019-08-05  7:40       ` Martin Kepplinger
2018-04-05 16:16 ` [PATCH v3 7/7] cpuidle/drivers/cpuidle-arm: Register the cooling device Daniel Lezcano
2018-04-11  8:51   ` Viresh Kumar

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=2d7f1caa-351a-8fdc-bb6b-151f7313a042@linaro.org \
    --to=daniel.lezcano@linaro.org \
    --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=martin.kepplinger@puri.sm \
    --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).