<feed xmlns='http://www.w3.org/2005/Atom'>
<title>wireguard-linux/drivers/thermal, branch update-toolchain</title>
<subtitle>WireGuard for the Linux kernel</subtitle>
<id>https://git.zx2c4.com/wireguard-linux/atom/drivers/thermal?h=update-toolchain</id>
<link rel='self' href='https://git.zx2c4.com/wireguard-linux/atom/drivers/thermal?h=update-toolchain'/>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/'/>
<updated>2024-08-16T11:13:59Z</updated>
<entry>
<title>thermal: gov_bang_bang: Use governor_data to reduce overhead</title>
<updated>2024-08-16T11:13:59Z</updated>
<author>
<name>Rafael J. Wysocki</name>
<email>rafael.j.wysocki@intel.com</email>
</author>
<published>2024-08-13T14:29:11Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=6e6f58a170ea98e44075b761f2da42a5aec47dfb'/>
<id>urn:sha1:6e6f58a170ea98e44075b761f2da42a5aec47dfb</id>
<content type='text'>
After running once, the for_each_trip_desc() loop in
bang_bang_manage() is pure needless overhead because it is not going to
make any changes unless a new cooling device has been bound to one of
the trips in the thermal zone or the system is resuming from sleep.

For this reason, make bang_bang_manage() set governor_data for the
thermal zone and check it upfront to decide whether or not it needs to
do anything.

However, governor_data needs to be reset in some cases to let
bang_bang_manage() know that it should walk the trips again, so add an
.update_tz() callback to the governor and make the core additionally
invoke it during system resume.

To avoid affecting the other users of that callback unnecessarily, add
a special notification reason for system resume, THERMAL_TZ_RESUME, and
also pass it to __thermal_zone_device_update() called during system
resume for consistency.

Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
Acked-by: Peter Kästle &lt;peter@piie.net&gt;
Reviewed-by: Zhang Rui &lt;rui.zhang@intel.com&gt;
Cc: 6.10+ &lt;stable@vger.kernel.org&gt; # 6.10+
Link: https://patch.msgid.link/2285575.iZASKD2KPV@rjwysocki.net
</content>
</entry>
<entry>
<title>thermal: gov_bang_bang: Add .manage() callback</title>
<updated>2024-08-16T11:13:49Z</updated>
<author>
<name>Rafael J. Wysocki</name>
<email>rafael.j.wysocki@intel.com</email>
</author>
<published>2024-08-13T14:27:33Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=5f64b4a1ab1b0412446d42e1fc2964c2cdb60b27'/>
<id>urn:sha1:5f64b4a1ab1b0412446d42e1fc2964c2cdb60b27</id>
<content type='text'>
After recent changes, the Bang-bang governor may not adjust the
initial configuration of cooling devices to the actual situation.

Namely, if a cooling device bound to a certain trip point starts in
the "on" state and the thermal zone temperature is below the threshold
of that trip point, the trip point may never be crossed on the way up
in which case the state of the cooling device will never be adjusted
because the thermal core will never invoke the governor's
.trip_crossed() callback.  [Note that there is no issue if the zone
temperature is at the trip threshold or above it to start with because
.trip_crossed() will be invoked then to indicate the start of thermal
mitigation for the given trip.]

To address this, add a .manage() callback to the Bang-bang governor
and use it to ensure that all of the thermal instances managed by the
governor have been initialized properly and the states of all of the
cooling devices involved have been adjusted to the current zone
temperature as appropriate.

Fixes: 530c932bdf75 ("thermal: gov_bang_bang: Use .trip_crossed() instead of .throttle()")
Link: https://lore.kernel.org/linux-pm/1bfbbae5-42b0-4c7d-9544-e98855715294@piie.net/
Cc: 6.10+ &lt;stable@vger.kernel.org&gt; # 6.10+
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
Acked-by: Peter Kästle &lt;peter@piie.net&gt;
Reviewed-by: Zhang Rui &lt;rui.zhang@intel.com&gt;
Link: https://patch.msgid.link/8419356.T7Z3S40VBb@rjwysocki.net
</content>
</entry>
<entry>
<title>thermal: gov_bang_bang: Split bang_bang_control()</title>
<updated>2024-08-16T11:13:42Z</updated>
<author>
<name>Rafael J. Wysocki</name>
<email>rafael.j.wysocki@intel.com</email>
</author>
<published>2024-08-13T14:26:42Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=84248e35d9b60e03df7276627e4e91fbaf80f73d'/>
<id>urn:sha1:84248e35d9b60e03df7276627e4e91fbaf80f73d</id>
<content type='text'>
Move the setting of the thermal instance target state from
bang_bang_control() into a separate function that will be also called
in a different place going forward.

No intentional functional impact.

Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
Acked-by: Peter Kästle &lt;peter@piie.net&gt;
Reviewed-by: Zhang Rui &lt;rui.zhang@intel.com&gt;
Cc: 6.10+ &lt;stable@vger.kernel.org&gt; # 6.10+
Link: https://patch.msgid.link/3313587.aeNJFYEL58@rjwysocki.net
</content>
</entry>
<entry>
<title>thermal: gov_bang_bang: Call __thermal_cdev_update() directly</title>
<updated>2024-08-16T11:13:33Z</updated>
<author>
<name>Rafael J. Wysocki</name>
<email>rafael.j.wysocki@intel.com</email>
</author>
<published>2024-08-13T14:25:19Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=b9b6ee6fe258ce4d89592593efcd3d798c418859'/>
<id>urn:sha1:b9b6ee6fe258ce4d89592593efcd3d798c418859</id>
<content type='text'>
Instead of clearing the "updated" flag for each cooling device
affected by the trip point crossing in bang_bang_control() and
walking all thermal instances to run thermal_cdev_update() for all
of the affected cooling devices, call __thermal_cdev_update()
directly for each of them.

No intentional functional impact.

Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
Acked-by: Peter Kästle &lt;peter@piie.net&gt;
Reviewed-by: Zhang Rui &lt;rui.zhang@intel.com&gt;
Cc: 6.10+ &lt;stable@vger.kernel.org&gt; # 6.10+
Link: https://patch.msgid.link/13583081.uLZWGnKmhe@rjwysocki.net
</content>
</entry>
<entry>
<title>Merge branch 'thermal-intel'</title>
<updated>2024-07-31T10:31:27Z</updated>
<author>
<name>Rafael J. Wysocki</name>
<email>rafael.j.wysocki@intel.com</email>
</author>
<published>2024-07-31T10:31:27Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=d955d7cecb51b1a3ef4849886f39688aba3f60b3'/>
<id>urn:sha1:d955d7cecb51b1a3ef4849886f39688aba3f60b3</id>
<content type='text'>
Merge fixes for the int340x thermal driver handling of MSI IRQs:

 - Fix MSI error path cleanup in int340x, allow it to work with a
   subset of thermal MSI IRQs if some of them are not working and
   make it free all MSI IRQs on module exit (Srinivas Pandruvada).

* thermal-intel:
  thermal: intel: int340x: Free MSI IRQ vectors on module exit
  thermal: intel: int340x: Allow limited thermal MSI support
  thermal: intel: int340x: Fix kernel warning during MSI cleanup
</content>
</entry>
<entry>
<title>thermal: trip: Avoid skipping trips in thermal_zone_set_trips()</title>
<updated>2024-07-31T10:30:58Z</updated>
<author>
<name>Rafael J. Wysocki</name>
<email>rafael.j.wysocki@intel.com</email>
</author>
<published>2024-07-30T14:41:18Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=f844793f2d374ffb7f2231f4d36cd4bc52f12de0'/>
<id>urn:sha1:f844793f2d374ffb7f2231f4d36cd4bc52f12de0</id>
<content type='text'>
Say there are 3 trip points A, B, C sorted in ascending temperature
order with no hysteresis.  If the zone temerature is exactly equal to
B, thermal_zone_set_trips() will set the boundaries to A and C and the
hardware will not catch any crossing of B (either way) until either A
or C is crossed and the boundaries are changed.

To avoid that, use non-strict inequalities when comparing the trip
threshold to the zone temperature in thermal_zone_set_trips().

In the example above, it will cause both boundaries to be set to B,
which is desirable because an interrupt will trigger when the zone
temperature becomes different from B regardless of which way it goes.
That will allow a new interval to be set depending on the direction of
the zone temperature change.

Fixes: 893bae92237d ("thermal: trip: Make thermal_zone_set_trips() use trip thresholds")
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
Link: https://patch.msgid.link/12509184.O9o76ZdvQC@rjwysocki.net
</content>
</entry>
<entry>
<title>thermal: intel: int340x: Free MSI IRQ vectors on module exit</title>
<updated>2024-07-30T14:36:58Z</updated>
<author>
<name>Srinivas Pandruvada</name>
<email>srinivas.pandruvada@linux.intel.com</email>
</author>
<published>2024-07-23T14:02:28Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=f8ce49be2743541bdc9e184fab1cfd736031ab66'/>
<id>urn:sha1:f8ce49be2743541bdc9e184fab1cfd736031ab66</id>
<content type='text'>
On module exit call proc_thermal_free_msi() to free vectors allocated by
pci_alloc_irq_vectors().

Fixes: 7a9a8c5faf41 ("thermal: intel: int340x: Support MSI interrupt for Lunar Lake")
Signed-off-by: Srinivas Pandruvada &lt;srinivas.pandruvada@linux.intel.com&gt;
Reviewed-by: Zhang Rui &lt;rui.zhang@intel.com&gt;
Link: https://patch.msgid.link/20240723140228.865919-4-srinivas.pandruvada@linux.intel.com
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>thermal: intel: int340x: Allow limited thermal MSI support</title>
<updated>2024-07-30T14:36:51Z</updated>
<author>
<name>Srinivas Pandruvada</name>
<email>srinivas.pandruvada@linux.intel.com</email>
</author>
<published>2024-07-23T14:02:27Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=b85a2d300a37641456c238591a056404436675c2'/>
<id>urn:sha1:b85a2d300a37641456c238591a056404436675c2</id>
<content type='text'>
On some Lunar Lake pre-production systems, not all the MSI thermal
vectors are valid. In that case instead of failing module load, continue
with partial thermal interrupt support.

pci_alloc_irq_vectors() can return less than expected maximum vectors.
In that case call devm_request_threaded_irq() only for current maximum
vectors.

Fixes: 7a9a8c5faf41 ("thermal: intel: int340x: Support MSI interrupt for Lunar Lake")
Reported-by: Yijun Shen &lt;Yijun.Shen@dell.com&gt;
Tested-by: Yijun Shen &lt;Yijun.Shen@dell.com&gt;
Signed-off-by: Srinivas Pandruvada &lt;srinivas.pandruvada@linux.intel.com&gt;
Reviewed-by: Zhang Rui &lt;rui.zhang@intel.com&gt;
Link: https://patch.msgid.link/20240723140228.865919-3-srinivas.pandruvada@linux.intel.com
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>thermal: intel: int340x: Fix kernel warning during MSI cleanup</title>
<updated>2024-07-30T14:36:39Z</updated>
<author>
<name>Srinivas Pandruvada</name>
<email>srinivas.pandruvada@linux.intel.com</email>
</author>
<published>2024-07-23T14:02:26Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=b630a04121519c0f93f9cc8994147191cc3c17b4'/>
<id>urn:sha1:b630a04121519c0f93f9cc8994147191cc3c17b4</id>
<content type='text'>
On some pre-production Lunar Lake systems, there is a kernel
warning:

remove_proc_entry: removing non-empty directory 'irq/172'
WARNING: CPU: 0 PID: 501 at fs/proc/generic.c:717
	remove_proc_entry+0x1b4/0x1e0
...
...
remove_proc_entry+0x1b4/0x1e0
report_bug+0x182/0x1b0
handle_bug+0x51/0xa0
exc_invalid_op+0x18/0x80
asm_exc_invalid_op+0x1b/0x20
remove_proc_entry+0x1b4/0x1e0
remove_proc_entry+0x1b4/0x1e0
unregister_irq_proc+0xf2/0x120
free_desc+0x41/0xe0
irq_domain_free_irqs+0x138/0x1c0
irq_free_descs+0x52/0x80
irq_domain_free_irqs+0x151/0x1c0
msi_domain_free_locked.part.0+0x17e/0x1c0
msi_domain_free_irqs_all_locked+0x74/0xc0
pci_msi_teardown_msi_irqs+0x50/0x60
pci_free_msi_irqs+0x12/0x40
pci_free_irq_vectors+0x58/0x70

On these systems, not all the MSI thermal vectors are valid. This causes
devm_request_threaded_irq() to fail for some vectors. As part of the
clean up on this error, pci_free_irq_vectors() is called without calling
devm_free_irq(). This causes the above warning.

Add a function proc_thermal_free_msi() to call devm_free_irq() for all
successfully registered IRQ handlers, then call pci_free_irq_vectors().
Call this function for MSI cleanup.

Fixes: 7a9a8c5faf41 ("thermal: intel: int340x: Support MSI interrupt for Lunar Lake")
Reported-by: Yijun Shen &lt;Yijun.shen@dell.com&gt;
Tested-by: Yijun Shen &lt;Yijun.shen@dell.com&gt;
Signed-off-by: Srinivas Pandruvada &lt;srinivas.pandruvada@linux.intel.com&gt;
Reviewed-by: Zhang Rui &lt;rui.zhang@intel.com&gt;
Link: https://patch.msgid.link/20240723140228.865919-2-srinivas.pandruvada@linux.intel.com
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>thermal: core: Back off when polling thermal zones on errors</title>
<updated>2024-07-24T10:40:23Z</updated>
<author>
<name>Rafael J. Wysocki</name>
<email>rafael.j.wysocki@intel.com</email>
</author>
<published>2024-07-18T19:01:14Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=f7c1b0e4ae47e67c6f9af84568a5f4a80638ccd8'/>
<id>urn:sha1:f7c1b0e4ae47e67c6f9af84568a5f4a80638ccd8</id>
<content type='text'>
Commit a8a261774466 ("thermal: core: Call monitor_thermal_zone() if zone
temperature is invalid") introduced a polling mechanism by which the
thermal core attampts to get a valid temperature value for thermal zones
where the .get_temp() callback returns errors to start with (for
example, due to initialization ordering woes).  However, this polling is
carried out periodically ad infinitum and every iteration of it causes
a message to be printed to the kernel log which means a lot of log noise
on systems where there are thermal zones that never get ready for some
reason.  It is also not really useful to continuously poll thermal zones
that never respond.

To address this, modify the thermal core to increase the delay between
consecutive thermal zone temperature checks after every check that fails
until it reaches a certain maximum value.  At that point, the thermal
zone in question will be disabled, but user space will be able to
reenable it if it believes that the failure is transient.

Also change the code to print messages regarding failed temperature
checks to the kernel log only twice, once when the thermal zone's
.get_temp() callback returns an error for the first time and once when
disabling the given thermal zone.  In addition, a dev_crit() message
will be printed at that point if the given thermal zone contains a
critical trip point to notify the system operator about the situation.

Fixes: a8a261774466 ("thermal: core: Call monitor_thermal_zone() if zone temperature is invalid")
Link: https://lore.kernel.org/linux-acpi/CAGnHSE=RyPK++UG0-wAtVKgeJxe0uzFYgLxm+RUOKKoQquW=Ow@mail.gmail.com/
Reported-by: Tom Yan &lt;tom.ty89@gmail.com&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
Link: https://patch.msgid.link/2962033.e9J7NaK4W3@rjwysocki.net
</content>
</entry>
</feed>
