mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: Di Shen <cindygm567@gmail.com>, lukasz.luba@arm.com
Cc: Di Shen <di.shen@unisoc.com>,
	rafael@kernel.org, amitk@kernel.org, rui.zhang@intel.com,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	xuewen.yan@unisoc.com, jeson.gao@unisoc.com, orsonzhai@gmail.com,
	zhanglyra@gmail.com
Subject: Re: [PATCH V5] thermal/core/power_allocator: reset thermal governor when trip point is changed
Date: Tue, 11 Jul 2023 10:23:34 +0200	[thread overview]
Message-ID: <33508f0e-414f-a990-29ad-58e43d20374b@linaro.org> (raw)
In-Reply-To: <CAHYJL4p7FEjLTZURA6fvVPCmwKodmxWS7fNpi_c0ZFBX7yjDZQ@mail.gmail.com>


Hi Di,

On 11/07/2023 05:40, Di Shen wrote:

[ ... ]

>>>>> +static void power_allocator_reset(struct thermal_zone_device *tz)
>>>>> +{
>>>>> +     struct power_allocator_params *params = tz->governor_data;
>>>>> +
>>>>> +     reset_pid_controller(params);
>>>>> +     allow_maximum_power(tz, true);
>>>>
>>>> Do you really want to allow the maximum power? What about if the trip
>>>> temperature is decreased ?
>>>>
>>> If the trip temperature is decreased, allow_maximum_power will only
>>> be executed once, and then the ipa governor will adapt to the lower trip
>>> temperature and calculate the allocated power for cooling actors again.
>>> Right?
>>
>> Sorry for jumping in this fifth version but I'm not sure about resetting
>> the change is the right way (and probably, changing a trip point with
>> the power allocator is not a good idea)
>>
>> The platforms where the IPA is planned to be used are creating a dummy
>> trip point where the IPA begins the acquisition without cooling devices
>> in order to have the math building the PID schema (eg. hi3660.dtsi).
>>
>> What about the sustainable power vs the trip point temperature? I mean
>> we can change the trip temperature but not the sustainable power which
>> is directly related to the target temperature. So the resulting power
>> computation will be wrong.
>>
> I totally agree, thanks for reminding me. Sustainable power is the maximum
> power available at the target temperature, so it must be updated when the trip
> point is changed. Sorry for missing this point. How about calling
> get_sustainable_power() to update the sustainable_power? Furthermore, when
> the sustainble_power() is changed, the pid constants tzp->k_* must be estimated
> again. In get_sustainble_power, it checks that the sustainable_power is updated,
> it will call the estimate_pid_constants() to renew the tzp->k_*.

Yes and the sustainable power can be set from userspace too.

So here we have to distinguish what is related to the thermal setup and 
the thermal usage.

Actually the thermal framework should protect the information from the 
firmware. It is not acceptable to have an user being able to change the 
trip points provided by the firmware.

The writable trip point should allow only temperature changes below the 
ones given in the firmware.

>> The more I think about that, the more I do believe writable trip point
>> and IPA are incompatible.
>>
>> What about forbid that?
>>
>> For instance, add a set_trip callback instead of resetting in the
>> governor and return -EPERM from the IPA?
>>
> I've seen that you have sent a patch recently which adds the callback
> thermal_zone_trips_update(), is that what you said set_trip callback?

Not exactly.

Instead of adding a 'reset' callback, add a 'trip_update' (or whatever 
the name) callback.

Then pass the trip point to the callback along with the thermal zone.

int ipa_trip_update(struct thermal_zone_device *tz,
			struct thermal_trip *trip)
{
	// Do more IPA crazy stuff or return -EPERM
}


>> Lukasz ?

Lukasz? what do you think?


-- 
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


  reply	other threads:[~2023-07-11  8:23 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-10  3:32 Di Shen
2023-07-10  4:41 ` Di Shen
2023-07-10  8:55 ` Daniel Lezcano
2023-07-10 13:36   ` Di Shen
2023-07-10 19:33     ` Daniel Lezcano
2023-07-11  3:40       ` Di Shen
2023-07-11  8:23         ` Daniel Lezcano [this message]
2023-07-17 10:07           ` Lukasz Luba
2023-07-17 10:36             ` Daniel Lezcano
2023-09-13 12:33             ` Di Shen

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=33508f0e-414f-a990-29ad-58e43d20374b@linaro.org \
    --to=daniel.lezcano@linaro.org \
    --cc=amitk@kernel.org \
    --cc=cindygm567@gmail.com \
    --cc=di.shen@unisoc.com \
    --cc=jeson.gao@unisoc.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=lukasz.luba@arm.com \
    --cc=orsonzhai@gmail.com \
    --cc=rafael@kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=xuewen.yan@unisoc.com \
    --cc=zhanglyra@gmail.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

all inboxes | Powered by JetHome®