Skip to contentSkip to conversation

Thermal:about a BUG

DISCUSSION Zhang Rui 2 participants 2 messages Nov 21, 2013 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Zhang Rui

author
#1 lore raw

Hi,

thanks for reporting the problem.

Quoted 33 lines · On 三, 2013-11-20 at 17:07 +0800, [email protected] wrote:

Hi all
Recently I porting the thermal driver,I think there will be a bug following,I am Just not sure about it,
In functon get_target_state (),
...
case THERMAL_TREND_DROPPING:
if (cur_state == instance->lower) {
if (!throttle)
next_target = THERMAL_NO_TARGET;

} else {
    next_target = cur_state - 1;
    if (next_target > instance->upper)
        next_target = instance->upper;
}

break;
case THERMAL_TREND_DROP_FULL:
if (cur_state == instance->lower) {
if (!throttle)

        next_target = THERMAL_NO_TARGET;
} else
    next_target = instance->lower;

break;
..

For case THERMAL_TREND_DROPPING
if cur_state=0,instance->lower=2,
so next_state =0xffffffff ,so next_target > instance->upper will be right,

I think In this case will be wrong.
and I think this will be okay.

Quoted 8 lines

if (cur_state <= instance->lower) {
if (!throttle)
next_target = THERMAL_NO_TARGET;

} else {
    next_target = cur_state - 1;
    if (next_target > instance->upper)
        next_target = instance->upper;
}

this should fix the problem for you, plus we may also needs this change for THERMAL_TREND_DROPPING_FULL case.
But my question would be:
How could a cooling device be in a cooling state that is lower than the lower limit of an active thermal_instance?
This seems like that the cooling device' cooling state is changed beyond thermal core, and I do not think the current code handles this situation well. IMO, we need a bigger fix for this issue. Let me think about it and reply to you later.

thanks,
rui

#2 lore raw
Quoted 47 lines · Zhang Rui

Hi,

thanks for reporting the problem.

Quoted 33 lines · On 三, 2013-11-20 at 17:07 +0800, [email protected] wrote:

Hi all
Recently I porting the thermal driver,I think there will be a bug following,I am Just not sure about it,
In functon get_target_state (),
...
case THERMAL_TREND_DROPPING:
if (cur_state == instance->lower) {
if (!throttle)
next_target = THERMAL_NO_TARGET;

} else {
    next_target = cur_state - 1;
    if (next_target > instance->upper)
        next_target = instance->upper;
}

break;
case THERMAL_TREND_DROP_FULL:
if (cur_state == instance->lower) {
if (!throttle)

        next_target = THERMAL_NO_TARGET;
} else
    next_target = instance->lower;

break;
..

For case THERMAL_TREND_DROPPING
if cur_state=0,instance->lower=2,
so next_state =0xffffffff ,so next_target > instance->upper will be right,

I think In this case will be wrong.
and I think this will be okay.

Quoted 8 lines

if (cur_state <= instance->lower) {
if (!throttle)
next_target = THERMAL_NO_TARGET;

} else {
    next_target = cur_state - 1;
    if (next_target > instance->upper)
        next_target = instance->upper;
}
Quoted 9 lines

this should fix the problem for you, plus we may also needs this change for THERMAL_TREND_DROPPING_FULL case.
But my question would be:
How could a cooling device be in a cooling state that is lower than the lower limit of an active thermal_instance?
This seems like that the cooling device' cooling state is changed beyond thermal core, and I do not think the current code handles this situation well. IMO, we need a bigger fix for this issue. Let me think about it and reply to you later.

I think it is better to investigate further before we come up with a fix.

Xu, can you please describe the thermal zone you are using? Also what cooling device are you using? Is the cooling device in mainline?

Do you really see this error happening? Can you please describe the scenario that leads to the error ?

Quoted 8 lines

thanks,
rui

Signature · 3 lines
You have got to be excited about what you are doing. (L. Lamport)

Eduardo Valentin