public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Javi Merino <javi.merino@kernel.org>
To: Lukasz Luba <lukasz.luba@arm.com>
Cc: linux-pm@vger.kernel.org, edubezval@gmail.com,
	rui.zhang@intel.com, orjan.eide@arm.com, chris.diamand@arm.com
Subject: Re: [PATCH v2 2/3] thermal: devfreq_cooling: add new interface for direct power read
Date: Tue, 21 Feb 2017 13:34:25 +0000	[thread overview]
Message-ID: <20170221133425.GB23954@ct-lt-587> (raw)
In-Reply-To: <20170131161147.17002-3-lukasz.luba@arm.com>

On Tue, Jan 31, 2017 at 04:11:46PM +0000, Lukasz Luba wrote:
> This patch introduces a new interface for device drivers connected to
> devfreq_cooling in the thermal framework: get_real_power().
> 
> Some devices have more sophisticated methods (like power counters)
> to approximate the actual power that they use.
> In the previous implementation we had a pre-calculated power
> table which was then scaled by 'utilization'
> ('busy_time' and 'total_time' taken from devfreq 'last_status').
> 
> With this new interface the driver can provide more precise data
> regarding actual power to the thermal governor every time the power
> budget is calculated. We then use this value and calculate the real
> resource utilization scaling factor.
> 
> Reviewed-by: Chris Diamand <chris.diamand@arm.com>
> Signed-off-by: Lukasz Luba <lukasz.luba@arm.com>
> ---
>  drivers/thermal/devfreq_cooling.c | 78 ++++++++++++++++++++++++++++++---------
>  include/linux/devfreq_cooling.h   | 17 +++++++++
>  2 files changed, 78 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/thermal/devfreq_cooling.c b/drivers/thermal/devfreq_cooling.c
> index 7d55652..cba34bd 100644
> --- a/drivers/thermal/devfreq_cooling.c
> +++ b/drivers/thermal/devfreq_cooling.c
> @@ -27,6 +27,8 @@
>  
>  #include <trace/events/thermal.h>
>  
> +#define SCALE_ERROR_MITIGATION 100
> +
>  static DEFINE_MUTEX(devfreq_lock);
>  static DEFINE_IDR(devfreq_idr);
>  
> @@ -45,6 +47,12 @@ static DEFINE_IDR(devfreq_idr);
>   * @freq_table_size:	Size of the @freq_table and @power_table
>   * @power_ops:	Pointer to devfreq_cooling_power, used to generate the
>   *		@power_table.
> + * @res_util:	Resource utilization scaling factor for the power.
> + *		It is multiplied by 100 to minimize the error. It is used
> + *		for estimation of the power budget instead of using
> + *		'utilization' (which is	'busy_time / 'total_time').
> + *		The 'res_util' range is from 100 to (power_table[state] * 100)

I was going to say that this 100s should be SCALE_ERROR_MITIGATION but
given that we are unlikely to change SCALE_ERROR_MITIGATION, it is
probably clearer if we leave them as is.

Acked-by: Javi Merino <javi.merino@kernel.org>

  reply	other threads:[~2017-02-21 13:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-31 16:11 [PATCH v2 0/3] devfreq_cooling: let the driver supply the real power every time we need it Lukasz Luba
2017-01-31 16:11 ` [PATCH v2 1/3] thermal: devfreq_cooling: refactor code and add get_voltage function Lukasz Luba
2017-01-31 16:11 ` [PATCH v2 2/3] thermal: devfreq_cooling: add new interface for direct power read Lukasz Luba
2017-02-21 13:34   ` Javi Merino [this message]
2017-01-31 16:11 ` [PATCH v2 3/3] trace: thermal: add another parameter *power to the tracing function Lukasz Luba
2017-02-21 13:35 ` [PATCH v2 0/3] devfreq_cooling: let the driver supply the real power every time we need it Javi Merino
2017-02-28 13:52   ` Lukasz Luba

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=20170221133425.GB23954@ct-lt-587 \
    --to=javi.merino@kernel.org \
    --cc=chris.diamand@arm.com \
    --cc=edubezval@gmail.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=lukasz.luba@arm.com \
    --cc=orjan.eide@arm.com \
    --cc=rui.zhang@intel.com \
    /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