All of lore.kernel.org
 help / color / mirror / Atom feed
From: Javi Merino <javi.merino@arm.com>
To: Eduardo Valentin <edubezval@gmail.com>
Cc: "linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Punit Agrawal <Punit.Agrawal@arm.com>,
	"broonie@kernel.org" <broonie@kernel.org>,
	Zhang Rui <rui.zhang@intel.com>
Subject: Re: [PATCH v1 4/7] thermal: introduce the Power Allocator governor
Date: Thu, 26 Feb 2015 17:52:53 +0000	[thread overview]
Message-ID: <20150226175253.GA9883@e104805> (raw)
In-Reply-To: <20150225190037.GH2306@developer.amazonguestwifi.org>

On Wed, Feb 25, 2015 at 07:00:38PM +0000, Eduardo Valentin wrote:
> On Wed, Feb 25, 2015 at 02:48:49PM +0000, Javi Merino wrote:
> > Hi Eduardo,
> > 
> > On Tue, Feb 24, 2015 at 06:21:26PM +0000, Eduardo Valentin wrote:
> > > On Wed, Jan 28, 2015 at 05:00:35PM +0000, Javi Merino wrote:
> > > > +
> > > > +k_d
> > > > +---
> > > > +
> > > > +`k_d` configures the PID loop's derivative term constant.  It's
> > > > +recommended to leave it as the default: 0.
> > > > +
> > > 
> > > I know we are considering K_d = 0. However, ...
> > > 
> > > <yet another big cut>
> > > 
> > > > +	/*
> > > > +	 * Calculate the derivative term
> > > > +	 *
> > > > +	 * We do err - prev_err, so with a positive k_d, a decreasing
> > > > +	 * error (i.e. driving closer to the line) results in less
> > > > +	 * power being applied, slowing down the controller)
> > > > +	 */
> > > > +	d = mul_frac(tz->tzp->k_d, err - params->prev_err);
> > > 
> > > 
> > > ... Shouldn't the above d component consider the rate of changes over time of the error?
> > > 
> > > I would expect you should do:
> > > d = k_d * (dE / dt)
> > > 
> > > or
> > > 
> > > d = K_d * ((err - params->prev_err) / sampling_period)
> > > 
> > > in plain C:
> > > 
> > > +	d = mul_frac(tz->tzp->k_d, err - params->prev_err);
> > > +	d /= tz->passive_polling; /* might require fixed point division */
> > 
> > Could do.  To be honest, both k_d and passive_polling are constants so
> 
> Yes, I agree that they are constants. But if you deploy the thermal zone
> with different sampling period on different devices, then the behavior
> will change.
> 
> > I don't think you get anything by doing this other than the added
> > complexity of the fixed point division.  As you said, the default k_d
> > is 0, so I'm not strongly against it.
> 
> OK. Then I would prefer to add the division, as it makes the code aligned
> to the concept.

Fair enough, I've added it to the code.  We will send a v2 later today
if all regressions pass.

Cheers,
Javi

  reply	other threads:[~2015-02-26 17:53 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-28 17:00 [PATCH v1 0/7] The power allocator thermal governor Javi Merino
2015-01-28 17:00 ` [PATCH v1 1/7] thermal: let governors have private data for each thermal zone Javi Merino
2015-01-28 17:00 ` [PATCH v1 2/7] thermal: extend the cooling device API to include power information Javi Merino
2015-01-28 17:00 ` [PATCH v1 3/7] thermal: cpu_cooling: implement the power cooling device API Javi Merino
2015-01-28 17:56   ` Eduardo Valentin
2015-01-29 19:11     ` Javi Merino
2015-01-28 17:00 ` [PATCH v1 4/7] thermal: introduce the Power Allocator governor Javi Merino
2015-02-02 23:51   ` Lina Iyer
2015-02-03 13:03     ` Javi Merino
2015-02-03  4:31       ` Eduardo Valentin
2015-02-03 17:32         ` Lina Iyer
2015-02-03 19:19           ` Eduardo Valentin
2015-02-04 23:47             ` Lina Iyer
2015-02-09 10:14               ` Javi Merino
2015-02-24 18:21   ` Eduardo Valentin
2015-02-25 14:48     ` Javi Merino
2015-02-25 19:00       ` Eduardo Valentin
2015-02-26 17:52         ` Javi Merino [this message]
2015-02-26 20:32   ` Eduardo Valentin
2015-01-28 17:00 ` [PATCH v1 5/7] thermal: add trace events to the power allocator governor Javi Merino
2015-01-28 17:31   ` Steven Rostedt
2015-02-02 15:44     ` Javi Merino
2015-01-28 17:00 ` [PATCH v1 6/7] of: thermal: Introduce sustainable power for a thermal zone Javi Merino
2015-01-28 17:00 ` [PATCH v1 7/7] thermal: export thermal_zone_parameters to sysfs Javi Merino
2015-02-05 12:06 ` [PATCH v1 0/7] The power allocator thermal governor Javi Merino

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=20150226175253.GA9883@e104805 \
    --to=javi.merino@arm.com \
    --cc=Punit.Agrawal@arm.com \
    --cc=broonie@kernel.org \
    --cc=edubezval@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.