[lkml]   [2020]   [Oct]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 2/2] thermal: power allocator: estimate sustainable power only once
Hi Lukasz,

On Friday 02 Oct 2020 at 13:24:16 (+0100), Lukasz Luba wrote:
> The sustainable power value might come from the Device Tree or can be
> estimated in run time. There is no need to estimate every time when the
> governor is called and temperature is high. Instead, store the estimated
> value and make it available via standard sysfs interface so it can be
> checked from the user-space.
> Signed-off-by: Lukasz Luba <>
> ---
> drivers/thermal/gov_power_allocator.c | 2 ++
> 1 file changed, 2 insertions(+)
> diff --git a/drivers/thermal/gov_power_allocator.c b/drivers/thermal/gov_power_allocator.c
> index f69fafe486a5..dd59085f38f5 100644
> --- a/drivers/thermal/gov_power_allocator.c
> +++ b/drivers/thermal/gov_power_allocator.c
> @@ -204,6 +204,8 @@ static u32 pid_controller(struct thermal_zone_device *tz,
> estimate_pid_constants(tz, sustainable_power,
> params->trip_switch_on, control_temp,
> true);
> + /* Do the estimation only once and make available in sysfs */
> + tz->tzp->sustainable_power = sustainable_power;

After looking over the code, it does seems mostly useless to do the
estimation every time the controller kicks in.

But I have two comments in this regard:

- The estimation is dependent on the temperature we control for which
can be changed from sysfs. While I don't see that as a big worry,
(sustainable power is an estimation anyway), it might be worth a
more detailed comment on why we don't expect this to be a problem,
or what we expect the consequences of computing sustainable power
only once could be.

- In the function comment for estimate_pid_constants() there is a
mention of sustainable power:
* Sustainable power is provided in case it was estimated. The
* estimated sustainable_power should not be stored in the
* thermal_zone_parameters so it has to be passed explicitly to this
* function.
If we are going to compute the sustainable power estimation only once,
this comment should be removed, the estimated value should be added to
the trip point parameters before estimate_pid_constants(), and the
sustainable_power argument should be removed.
Otherwise we end up with conflicting information in the code.


> }
> err = control_temp - tz->temperature;
> --
> 2.17.1

 \ /
  Last update: 2020-10-08 12:14    [W:0.290 / U:0.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site