Devicetree
 help / color / mirror / Atom feed
* [PATCH v2 0/6] thermal/drivers/samsung: acpm-tmu: fix IRQ storm and tune GS101 DT
@ 2026-12-04 10:05 André Draszik
  2026-12-04 10:05 ` [PATCH v2 1/6] arm64: dts: exynos: gs101: raise critical trips André Draszik
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: André Draszik @ 2026-12-04 10:05 UTC (permalink / raw)
  To: Tudor Ambarus, Krzysztof Kozlowski, Peter Griffin, Alim Akhtar,
	Bartlomiej Zolnierkiewicz, Rafael J. Wysocki, Daniel Lezcano,
	Zhang Rui, Lukasz Luba, Alexey Klimov, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley
  Cc: Christian Loehle, linux-samsung-soc, linux-arm-kernel, linux-pm,
	devicetree, linux-kernel, André Draszik

Hi,

The acpm-tmu driver wakes the thermal core in a storm of interrupts
whenever a GS101 CPU thermal zone is inside its trip window or at its
hot trip: on Pixel 6 that is up to 330 interrupts per second while
power_allocator throttles the two Cortex-X1 cores. This series stops
the storm and adjusts the thermal zones in gs101-tmu.dtsi.

- Raise the critical trips from 105 °C to 115 °C; today a loaded phone
  comes within 3 K of an emergency shutdown.
- Poll the CPU zones every 10 ms while throttling, give them
  sustainable-power, and align switch-on and little-mitigate with the
  vendor DT.
- Add the ACPM TMU set_hysteresis op, which the storm fix needs.
- Collect the pending bits of all probes of a sensor group, stop the
  interrupt storm, and report the trend of a zone relative to its trip
  so that step_wise does not depend on the storm (three patches).

Pixel 6, non-debug kernel. Columns are TMU interrupts, peak temperature
of the big cluster zone and the throughput of a busy loop on the two
Cortex-X1 cores in million iterations per second. "base" is
next-20261123 with the prerequisite below applied, as ranges over
several boots ("patches 1-2" and "patches 3-6" are from a single boot
each).

Both Cortex-X1 cores loaded for 8 s:

                 step_wise                   power_allocator
  base           49-694  99-100 °C 1.02-1.23 0-2650  58-85 °C 0.23-0.72
  patches 1-2    187-223 99-100 °C 1.14-1.22 125-142 88 °C    1.05
  patches 3-6    3-5     96-99 °C  1.07-1.18 28      81-83 °C 0.49-0.52
  patches 1,3-6  2-6     96-99 °C  1.01-1.12 29-30   81-89 °C 0.48-0.52
  patches 1-6    3-4     93-95 °C  1.08-1.18 4-6     89-91 °C 1.03-1.14

(In one base power_allocator run the big cluster stayed at 500 MHz and
58 °C for all 8 s, below the 80 °C switch-on trip, with 0 interrupts.)

First 110 s after boot: 91 TMU interrupts on base, 7 with patches
1,3-6.

All eight cores loaded for 60 s, step_wise:

  base           101-102 °C within 22 s; the test stops the load there
  patches 1-2    598-793 99 °C      0.84-0.89
  patches 3-6    8       98 °C      0.81 (run 0); 101-102 °C in 0.9 s*
  patches 1,3-6  11-75   100-101 °C 0.68-0.74
  patches 1-6    5       91-93 °C   0.70-0.79

* Two warm back-to-back runs stopped at the 101 °C safety limit (32
  and 30 interrupts), 3 K below the unpatched 105 °C critical trip.

All eight cores loaded for 60 s, power_allocator:

  base           165**   75 °C    0.46
  patches 1-2    44      92 °C    0.75
  patches 3-6    272     82 °C    0.44
  patches 1,3-6  368     84 °C    0.42
  patches 1-6    4-5     91-92 °C 0.69-0.77

** Single base run: the big cluster stayed at 984 MHz (<=75 °C, below
   the 80 °C switch-on trip) for 59.98 s and the mid cluster only hit
   80 °C for ~6 s before staying at 799 MHz (67-71 °C). On patches 3-6
   and 1,3-6, the 272 and 368 interrupts are repeated 80 °C crossings
   without sustainable-power (~4.5-6/s), not a comparator storm.

The vendor kernel polls these zones every 50 ms; 50 ms suffices for
step_wise, but power_allocator oscillates at 50 ms and 20 ms with its
default gains (see patch 2 for numbers).

Merging across maintainer trees:
The series is ordered so that patches 1-2 (DT) and patches 3-6
(firmware + thermal) can be merged in parallel for the same merge
window:

- Patches 1-2 via the Samsung SoC DT tree: no build dependency on
  patches 3-6; gs101-tmu.dtsi is only in linux-next so far, not
  v7.4-rc1. Alone, patches 1-2 match or improve on base across all three
  tables above and saw 35 boot TMU interrupts at 120 s uptime vs 91 at
  110 s and 113 at 62 s on base. The only trade-off while waiting for
  patches 3-6 is noisier moderate load in 70-79 °C as switch-on drops
  to 70 °C: 30 s mid-cluster load peaking at 75 °C saw 91 interrupts and
  259 ms kworker time vs 26 and 7 ms on base.
- Patches 3-6 together via the thermal tree, with an Ack on patch 3 from
  the Samsung/ACPM maintainers or via an immutable branch; patch 5 does
  not build without patch 3. Alone on the unmodified DT, patches 3-6
  stop the storm (3 boot interrupts at 105 s uptime, 0 during 30 s
  mid-cluster load), while power_allocator stays throttled hard until
  patch 2 lands.
- Patches 1,3-6 without patch 2: step_wise is no worse than base with
  the 115 °C critical margin, and power_allocator keeps throttling hard
  until patch 2 lands.
- Patch 6 (.get_trend()) changes step_wise behaviour and can be taken
  or discussed separately, as patches 3-5 do not depend on it; without
  it, step_wise overshoots more once the storm is gone (numbers in
  patch 6).

Prerequisites:
- thermal/drivers/samsung/acpm-tmu: Fix spurious CPU throttling (v3)
  https://lore.kernel.org/r/20261125173959.2198116-1-christian.loehle@arm.com
  Patch 5 builds on its slot 7 handling. It is not in next-20261202.

This series is based on next-20261202. The comparison tables above are
from next-20261123; the acpm-tmu driver, thermal_core.c, the step_wise
and power_allocator governors, the ACPM TMU interface and gs101-tmu.dtsi
are identical in the two. The three driver patches were measured one
after the other in one boot on next-20261202 (non-debug, with patch 1
only in the DT); those numbers are in patches 4-6.

The full v2 series was then verified on Pixel 6 (Oriole) on
next-20261202 with step_wise and power_allocator (8 s dual-X1 and 60 s
all-core loads, plus .set_trip_temp(), .change_mode() and hwmon reads):
- Non-debug kernel: 2-5 TMU interrupts per run, peak big-cluster
  temperature 90-95 °C (0 hot-trip crossings), 1.16-1.21 M iter/s
  (step_wise) and 1.04-1.05 M iter/s (power_allocator) on dual-X1.
- Debug kernel with KASAN and lockdep (debug_locks: 1, zero splats):
  5 TMU interrupts per run, peak big-cluster temperature 91-94 °C
  (0 hot-trip crossings). The debug kernel needs these pending series
  on top:
- usb: typec: tcpm/tcpci_maxim: lockdep, wakeup and vbus regulator
  fixes (v3)
  https://lore.kernel.org/r/20261130-max77759-wait-v3-0-1ee9034dd228@linaro.org
- phy: samsung-ufs: fix gs101 OOB read and use counted config tables
  https://lore.kernel.org/r/20261127-gs101-ufs-phy-oob-v1-0-144b0e04c3a8@linaro.org
Without them, a lockdep report in tcpci_maxim or a KASAN report in the
UFS PHY driver switches lock debugging off during boot. On
next-20261123 the debug kernel also needed "pinctrl: samsung: keep bus
clock enabled", which is in next-20261202.
Not tested: suspend/resume, Pixel 6 Pro (Raven) and probes colder than
about 10 °C.
Known limitation: while a zone sits at its hot trip, the TMU still
raises about 100 interrupts per second (see patch 5); they no longer
wake the thermal core.

Cheers
Andre'

Signed-off-by: André Draszik <andre.draszik@linaro.org>
---
Changes in v2:
- Rebase onto next-20261202 and update the prerequisites.
- Split the driver fix (v1 patch 4) into three: OR the pending bits
  (patch 4), fix the storm (patch 5), add .get_trend() (patch 6), with
  tightened comments and no functional change to the combined code. Each
  state was measured on its own; patches 4-6 carry their own numbers.
- Patch 5: the TMU raises an interrupt once per threshold crossing of
  each probe, not for as long as a probe is beyond a threshold; correct
  the commit message and two comments accordingly.
- Patch 5: state that the BIT(8) interrupts at the hot trip remain, and
  that user-space thresholds below the current temperature rely on
  polling.
- Patch 2: say that power_allocator recomputes its power budget on
  every zone update instead of claiming that its control loop runs at
  the polling period; give the heating rate per sensor reading instead
  of "within 8 ms".
- Refer to the other patches of this series by subject instead of by
  number in commit messages, as the patches go through different trees.
- Link to v1: https://lore.kernel.org/r/20261201-b4-acpm-tmu-irq-storm-v1-0-265039ee23d5@linaro.org

---
André Draszik (6):
      arm64: dts: exynos: gs101: raise critical trips
      arm64: dts: exynos: gs101: tune CPU thermal zones
      firmware: samsung: acpm: add TMU set_hysteresis op
      thermal/drivers/samsung: acpm-tmu: OR pending bits
      thermal/drivers/samsung: acpm-tmu: fix IRQ storm
      thermal/drivers/samsung: acpm-tmu: add .get_trend()

 arch/arm64/boot/dts/exynos/google/gs101-tmu.dtsi   |  23 ++--
 drivers/firmware/samsung/exynos-acpm-tmu.c         |  29 ++++-
 drivers/firmware/samsung/exynos-acpm-tmu.h         |   3 +
 drivers/firmware/samsung/exynos-acpm.c             |   1 +
 drivers/thermal/samsung/acpm-tmu.c                 | 133 ++++++++++++++-------
 .../linux/firmware/samsung/exynos-acpm-protocol.h  |   3 +
 6 files changed, 135 insertions(+), 57 deletions(-)
---
base-commit: 799dd936553182df5770dde7f38d94c8337df75a
change-id: 20261127-b4-acpm-tmu-irq-storm-dc0fabb5e387
prerequisite-message-id: <20261125173959.2198116-1-christian.loehle@arm.com>
prerequisite-patch-id: e76cca78612886c74f766e2724c499e67208fcae

Best regards,
-- 
André Draszik <andre.draszik@linaro.org>


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-12-04 10:23 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-04 10:05 [PATCH v2 0/6] thermal/drivers/samsung: acpm-tmu: fix IRQ storm and tune GS101 DT André Draszik
2026-12-04 10:05 ` [PATCH v2 1/6] arm64: dts: exynos: gs101: raise critical trips André Draszik
2026-12-04 10:05 ` [PATCH v2 2/6] arm64: dts: exynos: gs101: tune CPU thermal zones André Draszik
2026-12-04 10:05 ` [PATCH v2 3/6] firmware: samsung: acpm: add TMU set_hysteresis op André Draszik
2026-12-04 10:05 ` [PATCH v2 4/6] thermal/drivers/samsung: acpm-tmu: OR pending bits André Draszik
2026-12-04 10:05 ` [PATCH v2 5/6] thermal/drivers/samsung: acpm-tmu: fix IRQ storm André Draszik
2026-12-04 10:23   ` sashiko-bot
2026-12-04 10:05 ` [PATCH v2 6/6] thermal/drivers/samsung: acpm-tmu: add .get_trend() André Draszik
2026-12-04 10:21   ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox