lkml.org 
[lkml]   [2015]   [Sep]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] thermal: avoid division by zero in power allocator
On Mon, 28 Sep 2015 23:28:34 +0200 Andrea Arcangeli <aarcange@redhat.com> wrote:

> During boot I get a div by zero Oops regression starting in v4.3-rc3.
>
> ...
>
> --- a/drivers/thermal/power_allocator.c
> +++ b/drivers/thermal/power_allocator.c
> @@ -144,6 +144,16 @@ static void estimate_pid_constants(struct thermal_zone_device *tz,
> switch_on_temp = 0;
>
> temperature_threshold = control_temp - switch_on_temp;
> + /*
> + * estimate_pid_constants() tries to find appropriate default
> + * values for thermal zones that don't provide them. If a
> + * system integrator has configured a thermal zone with two
> + * passive trip points at the same temperature, that person
> + * hasn't put any effort to set up the thermal zone properly
> + * so just give up.
> + */
> + if (!temperature_threshold)
> + return;
>
> if (!tz->tzp->k_po || force)
> tz->tzp->k_po = int_to_frac(sustainable_power) /

a) Are we sure this won't leave tz->tzp fields uninitialized?

b) I'm not understanding that code at all. The "proportional" term
in a PID controller is supposed to be proportional to the (desired -
actual) difference (aka "the error").

But estimate_pid_constants() appears to be setting the
"proportional" term to be proportional to 1/error!

Maybe a description of local `temperature_threshold' would help
clue me in.



\
 
 \ /
  Last update: 2015-09-29 22:41    [W:0.071 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site