Public bug reported:

Source package: thermald

In adaptive mode, thermald 2.5.6-2ubuntu0.24.04.6 lowers the package
power limit (PL1) below the minimum that the firmware's ITMT table sets.
On my laptop, PL1 falls from 72 W to 15 W within about 35 seconds
whenever the skin temperature sensor reads more than 51 °C. The firmware
table sets 72 W as the minimum for that case.

At 15 W, the CPU cores run at 400 MHz to 1 GHz under load, and the
integrated GPU is power-throttled
(/sys/class/drm/card1/gt/gt0/throttle_reason_pl1 = 1). The desktop
becomes slow to respond to typing and scrolling.

Upstream fixed this in commit 9bb5a211823a81dc03a311882d64bce72eee3200 
("Cleanup clamping code", 30 March 2026):
https://github.com/intel/thermal_daemon/commit/9bb5a211823a81dc03a311882d64bce72eee3200
The fix is included in thermald 2.5.12. I applied this commit to the noble 
package as an extra quilt patch. With the patched package, PL1 stays at 72 W.

1) Release

$ lsb_release -rd
Description:    Ubuntu 24.04.5 LTS
Release:        24.04

2) Package version

$ apt-cache policy thermald
thermald:
  Installed: 2.5.6-2ubuntu0.24.04.6+pl1clamp1
  Candidate: 2.5.6-2ubuntu0.24.04.6+pl1clamp1
  Version table:
 *** 2.5.6-2ubuntu0.24.04.6+pl1clamp1 100
        100 /var/lib/dpkg/status
     2.5.6-2ubuntu0.24.04.6 500
        500 http://de.archive.ubuntu.com/ubuntu noble-updates/main amd64 
Packages
     2.5.6-2build2 500
        500 http://de.archive.ubuntu.com/ubuntu noble/main amd64 Packages

The bug occurs with 2.5.6-2ubuntu0.24.04.6 from noble-updates. The
installed version 2.5.6-2ubuntu0.24.04.6+pl1clamp1 is my local rebuild
with the upstream fix (see "Test results" below).

System:

- Kernel 7.0.0-38-generic
- thermald started as: /usr/sbin/thermald --systemd --dbus-enable --adaptive
- power-profiles-daemon 0.21-1ubuntu3, profile "performance"
- Dell Pro Max 16 Plus MB16250, BIOS 3.3.2
- Intel Core Ultra 7 265HX (Arrow Lake)
- On AC power

Steps to reproduce:

1. Set the power profile to "performance".
2. Run a CPU workload until the SKIN thermal zone reads more than 51 °C.
3. Read /sys/class/powercap/intel-rapl-mmio:0/constraint_0_power_limit_uw every 
few seconds.

3) Expected result

PL1 does not go below 72 W (72000000) while the SKIN entry of the ITMT
table is active.

4) Actual result

PL1 decreases in steps to 15 W (15000000) and stays there until the SKIN
temperature drops below 51 °C.

Details from a debug run (thermald --no-daemon --adaptive
--loglevel=debug, 180 seconds, unpatched 2.5.6-2ubuntu0.24.04.6,
attached as thermald-debug.log):

- The adaptive engine matches condition set 8 (Oem0 == 3, Motion == 0, 
Power_source == 0). Target 8 is "performance":
    PL1PowerLimit 72000, PL1MAX 72000, PL1MIN 15000, PL2PowerLimit 160000, 
PL1TimeWindow 56000
- ITMT table "performance":
    SKIN  trip_temp:51 pl1_min:72000
    TSSD  trip_temp:80 pl1_min:30000
    NGFF  trip_temp:70 pl1_min:30000
    TMEM  trip_temp:80 pl1_min:30000
- PPCC: TCPU.D0 Limit 0: power_limit_max 65000, power_limit_min 15000, 
step_size 250
- The cooling device range is min_state 72000000, max_state 15000000. The 
trip-specific limit is read correctly, but the state still goes to 15000000.

Excerpt from thermald-debug.log (SKIN trip, 51 °C):

[1792651503][DEBUG]def_max_state:15000000 temp_max_state:72000000 
curr_max_state:72000000
[1792651503][INFO]Set : threshold:51000, temperature:54050, 
cdev:31(rapl_controller_mmio), curr_state:64006000, max_state:15000000
[1792651508][INFO]Set : threshold:51000, temperature:55050, 
cdev:31(rapl_controller_mmio), curr_state:64284000, max_state:15000000
[1792651513][INFO]Set : threshold:51000, temperature:56050, 
cdev:31(rapl_controller_mmio), curr_state:63284000, max_state:15000000
[1792651518][INFO]Set : threshold:51000, temperature:57050, 
cdev:31(rapl_controller_mmio), curr_state:61284000, max_state:15000000
[1792651523][INFO]Set : threshold:51000, temperature:57050, 
cdev:31(rapl_controller_mmio), curr_state:57284000, max_state:15000000
[1792651528][INFO]Set : threshold:51000, temperature:57050, 
cdev:31(rapl_controller_mmio), curr_state:49284000, max_state:15000000
[1792651533][INFO]Set : threshold:51000, temperature:58050, 
cdev:31(rapl_controller_mmio), curr_state:33284000, max_state:15000000
[1792651538][INFO]Set : threshold:51000, temperature:57050, 
cdev:31(rapl_controller_mmio), curr_state:15000000, max_state:15000000
...
[1792651619][INFO]Set : threshold:51000, temperature:50050, 
cdev:31(rapl_controller_mmio), curr_state:15250000, max_state:15000000

PL1 stays at 15-16 W from 1792651538 until SKIN drops to 50 °C at
1792651619.

Cause:

For the RAPL cooling device, min_state (72000000) is greater than
max_state (15000000). In 2.5.6, thd_clamp_state_max() in
src/thd_cdev.cpp replaces _max_state with the trip-specific value
(72000000) and then clamps only if min_state > _max_state. Both values
are 72000000, so the condition is false and the state is returned
without clamping. The code that reduces cooling also calls
thd_clamp_state_max() and thd_clamp_state_min() without the trip-
specific limits. Commit 9bb5a21 rewrites both clamp functions, passes
the trip-specific limits in all calls, and copies _min_state and
_max_state from the active trip limit.

Test results:

I rebuilt 2.5.6-2ubuntu0.24.04.6 with commit 9bb5a21 added as
debian/patches/upstream-9bb5a21-cleanup-clamping.patch. The patch
applies without changes on top of the existing 15 patches. Only
/usr/sbin/thermald differs from the archive package.

Result over 3 minutes, same machine, adaptive mode, "performance"
profile:

                         2.5.6-2ubuntu0.24.04.6    with 9bb5a21
  PL1                    15-35 W                   72 W (constant)
  SKIN temperature       about 51 °C               62-66 °C
  Package temperature    59-105 °C                 80-105 °C
  P-core clock (CPU 0-3) 400-3600 MHz              4300-5100 MHz
  GPU PL1 throttle       set in most samples       set in 1 of 12 samples

With the fix, PL1 still respects the other ITMT entries and the PPCC
limits.

Other releases (from Launchpad, not tested by me):

- questing: 2.5.9-1ubuntu0.3, based on an upstream version without 9bb5a21
- resolute: 2.5.11-0ubuntu1.1, based on an upstream version without 9bb5a21
- 2.5.12-1 contains the fix

I have not checked whether the questing or resolute packages carry the
fix as a separate patch.

The patch is the unmodified upstream commit linked above.

** Affects: thermald (Ubuntu)
     Importance: Undecided
         Status: New

** Attachment added: "output of thermald --no-daemon --adaptive 
--loglevel=debug, 180 seconds, unpatched 2.5.6-2ubuntu0.24.04.6"
   
https://bugs.launchpad.net/bugs/2172039/+attachment/6011933/+files/thermald-debug.log

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2172039

Title:
  thermald adaptive mode lowers PL1 to 15 W and ignores ITMT pl1_min

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/thermald/+bug/2172039/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to