<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/thermal/gov_power_allocator.c, branch linux-6.9.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.9.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.9.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2024-04-03T14:32:15Z</updated>
<entry>
<title>thermal: gov_power_allocator: Allow binding without trip points</title>
<updated>2024-04-03T14:32:15Z</updated>
<author>
<name>Nikita Travkin</name>
</author>
<published>2024-04-03T11:31:41Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=da781936e7c301e6197eb6513775748e79fb2575'/>
<id>urn:sha1:da781936e7c301e6197eb6513775748e79fb2575</id>
<content type='text'>
IPA probe function was recently refactored to perform extra error checks
and make sure the thermal zone has trip points necessary for the IPA
operation. With this change, if a thermal zone is probed such that it
has no trip points that IPA can use, IPA will fail and the TZ won't be
created. This is the case if a platform defines a TZ without cooling
devices and only with "hot"/"critical" trip points, often found on some
Qualcomm devices [1].

Documentation across IPA code (notably get_governor_trips() kerneldoc)
suggests that IPA is supposed to handle such TZ even if it won't
actually do anything.

This commit partially reverts the previous change to allow IPA to bind
to such "empty" thermal zones.

Fixes: e83747c2f8e3 ("thermal: gov_power_allocator: Set up trip points earlier")
Link: arch/arm64/boot/dts/qcom/sc7180.dtsi#n4776 # [1]
Signed-off-by: Nikita Travkin &lt;nikita@trvn.ru&gt;
Reviewed-by: Lukasz Luba &lt;lukasz.luba@arm.com&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>thermal: gov_power_allocator: Allow binding without cooling devices</title>
<updated>2024-04-03T14:32:14Z</updated>
<author>
<name>Nikita Travkin</name>
</author>
<published>2024-04-03T11:31:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1057c4c36ef8b236a2e28edef301da0801338c5f'/>
<id>urn:sha1:1057c4c36ef8b236a2e28edef301da0801338c5f</id>
<content type='text'>
IPA was recently refactored to split out memory allocation into a
separate funciton. That funciton was made to return -EINVAL if there is
zero power_actors and thus no memory to allocate. This causes IPA to
fail probing when the thermal zone has no attached cooling devices.

Since cooling devices can attach after the thermal zone is created and
the governer is attached to it, failing probe due to the lack of cooling
devices is incorrect.

Change the allocate_actors_buffer() to return success when there is no
cooling devices present.

Fixes: 912e97c67cc3 ("thermal: gov_power_allocator: Move memory allocation out of throttle()")
Signed-off-by: Nikita Travkin &lt;nikita@trvn.ru&gt;
Reviewed-by: Lukasz Luba &lt;lukasz.luba@arm.com&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>thermal: gov_power_allocator: Avoid overwriting PID coefficients from setup time</title>
<updated>2024-02-12T13:13:36Z</updated>
<author>
<name>Di Shen</name>
</author>
<published>2024-02-07T02:09:23Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0fac6893ff6c08d6fab6f56b9550a2c4cee589fd'/>
<id>urn:sha1:0fac6893ff6c08d6fab6f56b9550a2c4cee589fd</id>
<content type='text'>
When the PID coefficients k_* are set via sysfs before the IPA
algorithm is triggered then the coefficients would be overwritten after
IPA throttle() is called. The old configuration values might be
different than the new values estimated by the IPA internal algorithm.

There might be a time delay when this overwriting happens. It
depends on the thermal zone temperature value. The temperature value
needs to cross the first trip point value then IPA algorithms start
operating. Although, the PID coefficients setup time should not be
affected or linked to any later operating phase and values must not be
overwritten.

This patch initializes params-&gt;sustainable_power when the governor
binds to thermal zone to avoid overwriting k_*. The basic function won't
be affected, as the k_* still can be estimated if the sustainable_power
is modified.

Signed-off-by: Di Shen &lt;di.shen@unisoc.com&gt;
Reviewed-by: Lukasz Luba &lt;lukasz.luba@arm.com&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>thermal: gov_power_allocator: avoid inability to reset a cdev</title>
<updated>2024-01-12T14:38:23Z</updated>
<author>
<name>Di Shen</name>
</author>
<published>2024-01-10T11:55:26Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e95fa7404716f6e25021e66067271a4ad8eb1486'/>
<id>urn:sha1:e95fa7404716f6e25021e66067271a4ad8eb1486</id>
<content type='text'>
Commit 0952177f2a1f ("thermal/core/power_allocator: Update once
cooling devices when temp is low") adds an update flag to avoid
triggering a thermal event when there is no need, and the thermal
cdev is updated once when the temperature is low.

But when the trips are writable, and switch_on_temp is set to be a
higher value, the cooling device state may not be reset to 0,
because last_temperature is smaller than switch_on_temp.

For example:
First:
switch_on_temp=70 control_temp=85;
Then userspace change the trip_temp:
switch_on_temp=45 control_temp=55 cur_temp=54

Then userspace reset the trip_temp:
switch_on_temp=70 control_temp=85 cur_temp=57 last_temp=54

At this time, the cooling device state should be reset to 0.
However, because cur_temp(57) &lt; switch_on_temp(70)
last_temp(54) &lt; switch_on_temp(70)  ----&gt;  update = false,
update is false, the cooling device state can not be reset.

Using the observation that tz-&gt;passive can also be regarded as the
temperature status, set the update flag to the tz-&gt;passive value.

When the temperature drops below switch_on for the first time, the
states of cooling devices can be reset once, and tz-&gt;passive is updated
to 0. In the next round, because tz-&gt;passive is 0, cdev-&gt;state will not
be updated.

By using the tz-&gt;passive value as the "update" flag, the issue above
can be solved, and the cooling devices can be updated only once when the
temperature is low.

Fixes: 0952177f2a1f ("thermal/core/power_allocator: Update once cooling devices when temp is low")
Cc: 5.13+ &lt;stable@vger.kernel.org&gt; # 5.13+
Suggested-by: Wei Wang &lt;wvw@google.com&gt;
Signed-off-by: Di Shen &lt;di.shen@unisoc.com&gt;
Reviewed-by: Lukasz Luba &lt;lukasz.luba@arm.com&gt;
[ rjw: Subject and changelog edits ]
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>thermal: gov_power_allocator: Support new update callback of weights</title>
<updated>2023-12-29T17:01:01Z</updated>
<author>
<name>Lukasz Luba</name>
</author>
<published>2023-12-20T23:17:53Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a3cd6db4cc2ed70fc3468cdb5eb20745e7fefba9'/>
<id>urn:sha1:a3cd6db4cc2ed70fc3468cdb5eb20745e7fefba9</id>
<content type='text'>
When the thermal instance's weight is updated from the sysfs the governor
update_tz() callback is triggered. Implement proper reaction to this
event in the IPA, which would save CPU cycles spent in throttle().
This will speed-up the main throttle() IPA function and clean it up
a bit.

Signed-off-by: Lukasz Luba &lt;lukasz.luba@arm.com&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>thermal: gov_power_allocator: Simplify checks for valid power actor</title>
<updated>2023-12-29T17:01:00Z</updated>
<author>
<name>Lukasz Luba</name>
</author>
<published>2023-12-20T23:17:50Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e3ecd5716b957ff0e558e853d34be8d1e8173f64'/>
<id>urn:sha1:e3ecd5716b957ff0e558e853d34be8d1e8173f64</id>
<content type='text'>
There is a need to check if the cooling device in the thermal zone
supports IPA callback and is set for control trip point.
Refactor the code which validates the power actor capabilities and
make it more consistent in all places.

No intentional functional impact.

Signed-off-by: Lukasz Luba &lt;lukasz.luba@arm.com&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>thermal: gov_power_allocator: Move memory allocation out of throttle()</title>
<updated>2023-12-29T17:01:00Z</updated>
<author>
<name>Lukasz Luba</name>
</author>
<published>2023-12-20T23:17:49Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=912e97c67cc3f333c4c5df8f51498c651792e658'/>
<id>urn:sha1:912e97c67cc3f333c4c5df8f51498c651792e658</id>
<content type='text'>
The new thermal callback allows to react to the change of cooling
instances in the thermal zone. Move the memory allocation to that new
callback and save CPU cycles in the throttle() code path.

Signed-off-by: Lukasz Luba &lt;lukasz.luba@arm.com&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>thermal: gov_power_allocator: Change trace functions</title>
<updated>2023-12-29T17:01:00Z</updated>
<author>
<name>Lukasz Luba</name>
</author>
<published>2023-12-20T23:17:48Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=792c3dc08ddcf29a514156bb72b3d2ad4998c69f'/>
<id>urn:sha1:792c3dc08ddcf29a514156bb72b3d2ad4998c69f</id>
<content type='text'>
Change trace event trace_thermal_power_allocator() to not use dynamic
array for requested power and granted power for all power actors.
Instead, simplify the trace event and print other simple values.

Add new trace event to print power actor information of requested power
and granted power. That trace event would be called in a loop for each
power actor. The trace data would be easier to parse comparing to the
dynamic array implementation.

Signed-off-by: Lukasz Luba &lt;lukasz.luba@arm.com&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>thermal: gov_power_allocator: Refactor checks in divvy_up_power()</title>
<updated>2023-12-29T17:01:00Z</updated>
<author>
<name>Lukasz Luba</name>
</author>
<published>2023-12-20T23:17:47Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3d827317b17febba02b6b976fa910364221fecaf'/>
<id>urn:sha1:3d827317b17febba02b6b976fa910364221fecaf</id>
<content type='text'>
Simplify the code and remove one extra 'if' block.

No intentional functional impact.

Signed-off-by: Lukasz Luba &lt;lukasz.luba@arm.com&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>thermal: gov_power_allocator: Refactor check_power_actors()</title>
<updated>2023-12-29T17:01:00Z</updated>
<author>
<name>Lukasz Luba</name>
</author>
<published>2023-12-20T23:17:46Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=2c06456f656f7093077b4df958ed86a6554bc917'/>
<id>urn:sha1:2c06456f656f7093077b4df958ed86a6554bc917</id>
<content type='text'>
In preparation for a subsequent change, rearrange check_power_actors().

No intentional functional impact.

Signed-off-by: Lukasz Luba &lt;lukasz.luba@arm.com&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
</feed>
