* [PATCHv3] thermal/drivers/samsung/acpm-tmu: Fix spurious CPU throttling
@ 2026-11-25 17:39 Christian Loehle
2026-11-26 9:16 ` Alexey Klimov
` (2 more replies)
0 siblings, 3 replies; 13+ messages in thread
From: Christian Loehle @ 2026-11-25 17:39 UTC (permalink / raw)
To: tudor.ambarus, bzolnier
Cc: krzk, rafael, daniel.lezcano, lukasz.luba, linux-kernel,
linux-samsung-soc, linux-pm, Christian Loehle
acpm_tmu_set_trips() supplies two thresholds, but the ACPM command writes
all eight slots, zero-filling the rest. On GS101, slot 7 limits CPU clocks
independently of its interrupt mask. Setting it to 0 C limits all three
clusters to about 200 MHz while cpufreq reports the requested frequencies.
This was found through trial and error while tracking EAS regressions.
Program slot 7 from the lowest active hot trip so hardware throttling can
precede the critical trip's system shutdown. Cache the low/high window and
update the hot limit from set_trip_temp(), because the thermal core skips
set_trips() when that window is unchanged.
Fixes: 50a2c5d4062a ("thermal/drivers/samsung: Add Exynos ACPM TMU driver GS101")
Signed-off-by: Christian Loehle <christian.loehle@arm.com>
---
Since v2:
- Use hot instead of critical s.t. it precedes shutdown. (Tudor)
Since v1:
- Rebase onto linux-next, including Daniel’s queued ACPM TMU fixes.
- Cache only low/high and look up the lowest active critical trip when programming. (Tudor)
- Retain the requested window even if programming fails, matching the thermal core.
- Handle critical-trip deactivation and zones without an active critical trip.
drivers/thermal/samsung/acpm-tmu.c | 76 +++++++++++++++++++++++++++---
1 file changed, 70 insertions(+), 6 deletions(-)
diff --git a/drivers/thermal/samsung/acpm-tmu.c b/drivers/thermal/samsung/acpm-tmu.c
index 4799ef518a7a..08856d713d5d 100644
--- a/drivers/thermal/samsung/acpm-tmu.c
+++ b/drivers/thermal/samsung/acpm-tmu.c
@@ -39,6 +39,10 @@
#define GS101_REG_INTPEND(i) ((i) * 0x50 + 0xf8)
+#define ACPM_TMU_NUM_THRESHOLDS 8
+/* Threshold 7 throttles the CPUs in hardware, regardless of the INTEN mask. */
+#define ACPM_TMU_HW_TRIP_THRESHOLD 7
+
enum {
P0_INTPEND,
P1_INTPEND,
@@ -70,6 +74,9 @@ struct acpm_tmu_sensor {
struct acpm_tmu_priv *priv;
struct mutex lock; /* protects sensor state */
enum thermal_device_mode mode;
+ /* Last requested window, protected by the thermal zone lock */
+ int low;
+ int high;
bool enabled;
};
@@ -228,7 +235,8 @@ static int acpm_tmu_get_temp(struct thermal_zone_device *tz, int *temp)
}
static int acpm_tmu_update_thresholds(struct acpm_tmu_sensor *sensor,
- u8 thresholds[2], u8 inten)
+ u8 thresholds[ACPM_TMU_NUM_THRESHOLDS],
+ u8 inten)
{
struct acpm_tmu_priv *priv = sensor->priv;
struct acpm_handle *handle = priv->handle;
@@ -249,7 +257,7 @@ static int acpm_tmu_update_thresholds(struct acpm_tmu_sensor *sensor,
}
ret = ops->set_threshold(handle, mbox_chan_id, acpm_sensor_id,
- thresholds, 2);
+ thresholds, ACPM_TMU_NUM_THRESHOLDS);
if (!ret) {
ret = ops->set_interrupt_enable(handle, mbox_chan_id,
acpm_sensor_id, inten);
@@ -267,15 +275,40 @@ static int acpm_tmu_update_thresholds(struct acpm_tmu_sensor *sensor,
return ret;
}
-static int acpm_tmu_set_trips(struct thermal_zone_device *tz, int low, int high)
+struct acpm_tmu_hot_trip {
+ const struct thermal_trip *updated;
+ int temperature;
+};
+
+static int acpm_tmu_get_hot_temp(struct thermal_trip *trip, void *arg)
+{
+ struct acpm_tmu_hot_trip *hot = arg;
+
+ if (trip->type == THERMAL_TRIP_HOT && trip != hot->updated &&
+ trip->temperature != THERMAL_TEMP_INVALID)
+ hot->temperature = min(hot->temperature, trip->temperature);
+
+ return 0;
+}
+
+static int acpm_tmu_program_thresholds(struct thermal_zone_device *tz,
+ const struct thermal_trip *trip, int temp)
{
struct acpm_tmu_sensor *sensor = thermal_zone_device_priv(tz);
- struct acpm_tmu_priv *priv = sensor->priv;
- struct device *dev = priv->dev;
- u8 thresholds[2] = {};
+ struct device *dev = sensor->priv->dev;
+ struct acpm_tmu_hot_trip hot = { trip, INT_MAX };
+ u8 thresholds[ACPM_TMU_NUM_THRESHOLDS] = {};
+ int low = sensor->low, high = sensor->high;
u8 inten = 0;
int ret;
+ /* Exclude the trip being updated until the proposed value is considered. */
+ for_each_thermal_trip(tz, acpm_tmu_get_hot_temp, &hot);
+ if (temp != THERMAL_TEMP_INVALID)
+ hot.temperature = min(hot.temperature, temp);
+ thresholds[ACPM_TMU_HW_TRIP_THRESHOLD] =
+ clamp_val(hot.temperature / MILLIDEGREE_PER_DEGREE, 0, 255);
+
/* If a valid lower bound exists, set the threshold and enable its interrupt */
if (low > -INT_MAX) {
thresholds[0] = clamp_val(low / MILLIDEGREE_PER_DEGREE, 0, 255);
@@ -299,6 +332,34 @@ static int acpm_tmu_set_trips(struct thermal_zone_device *tz, int low, int high)
return ret;
}
+static int acpm_tmu_set_trips(struct thermal_zone_device *tz, int low, int high)
+{
+ struct acpm_tmu_sensor *sensor = thermal_zone_device_priv(tz);
+
+ /* The core remembers this window even if programming fails. */
+ sensor->low = low;
+ sensor->high = high;
+
+ return acpm_tmu_program_thresholds(tz, NULL, INT_MAX);
+}
+
+static int acpm_tmu_set_trip_temp(struct thermal_zone_device *tz,
+ const struct thermal_trip *trip, int temp)
+{
+ if (trip->type != THERMAL_TRIP_HOT)
+ return 0;
+
+ if (temp != THERMAL_TEMP_INVALID &&
+ (temp < 0 || temp > 255 * MILLIDEGREE_PER_DEGREE))
+ return -EINVAL;
+
+ /*
+ * The core can skip .set_trips() when the window is unchanged and has
+ * not committed trip->temperature yet. Substitute the proposed value.
+ */
+ return acpm_tmu_program_thresholds(tz, trip, temp);
+}
+
static int acpm_tmu_change_mode(struct thermal_zone_device *tz,
enum thermal_device_mode mode)
{
@@ -329,6 +390,7 @@ static const struct thermal_zone_device_ops acpm_tmu_sensor_ops = {
.change_mode = acpm_tmu_change_mode,
.get_temp = acpm_tmu_get_temp,
.set_trips = acpm_tmu_set_trips,
+ .set_trip_temp = acpm_tmu_set_trip_temp,
};
static bool acpm_tmu_clear_pending_irq(struct acpm_tmu_sensor *sensor)
@@ -477,6 +539,8 @@ static int acpm_tmu_probe(struct platform_device *pdev)
mutex_init(&sensor->lock);
sensor->group = &data->sensor_groups[i];
sensor->priv = priv;
+ sensor->low = -INT_MAX;
+ sensor->high = INT_MAX;
tzd = devm_thermal_of_zone_register(dev, i, sensor,
&acpm_tmu_sensor_ops);
--
2.34.1
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCHv3] thermal/drivers/samsung/acpm-tmu: Fix spurious CPU throttling
2026-11-25 17:39 [PATCHv3] thermal/drivers/samsung/acpm-tmu: Fix spurious CPU throttling Christian Loehle
@ 2026-11-26 9:16 ` Alexey Klimov
2026-11-26 10:50 ` Christian Loehle
2026-11-26 11:33 ` Tudor Ambarus
2026-11-26 12:58 ` André Draszik
2 siblings, 1 reply; 13+ messages in thread
From: Alexey Klimov @ 2026-11-26 9:16 UTC (permalink / raw)
To: Christian Loehle, tudor.ambarus
Cc: bzolnier, krzk, rafael, daniel.lezcano, lukasz.luba,
linux-kernel, linux-samsung-soc, linux-pm
Hi Christian, Tudor,
On Wed, 25 Nov 2026 at 17:40, Christian Loehle <christian.loehle@arm.com> wrote:
>
> acpm_tmu_set_trips() supplies two thresholds, but the ACPM command writes
> all eight slots, zero-filling the rest. On GS101, slot 7 limits CPU clocks
> independently of its interrupt mask. Setting it to 0 C limits all three
> clusters to about 200 MHz while cpufreq reports the requested frequencies.
> This was found through trial and error while tracking EAS regressions.
Cpufreq reports the requested frequencies — are these cached values
being reported?
Or is this what the kernel gets via the ACPM call?
> Program slot 7 from the lowest active hot trip so hardware throttling can
> precede the critical trip's system shutdown. Cache the low/high window and
> update the hot limit from set_trip_temp(), because the thermal core skips
> set_trips() when that window is unchanged.
FWIW, Exynos850 control register for TMU has bits to enabled/disable
such behaviour (and it probably works).
Maybe gs101 also has it.
But it seems that cpufreq scaling feature itself is explicitly enabled.
[...]
Best regards,
Alexey
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCHv3] thermal/drivers/samsung/acpm-tmu: Fix spurious CPU throttling
2026-11-26 9:16 ` Alexey Klimov
@ 2026-11-26 10:50 ` Christian Loehle
2026-11-26 11:03 ` Tudor Ambarus
` (2 more replies)
0 siblings, 3 replies; 13+ messages in thread
From: Christian Loehle @ 2026-11-26 10:50 UTC (permalink / raw)
To: Alexey Klimov, tudor.ambarus
Cc: bzolnier, krzk, rafael, daniel.lezcano, lukasz.luba,
linux-kernel, linux-samsung-soc, linux-pm
[-- Attachment #1: Type: text/plain, Size: 1705 bytes --]
On 11/26/26 09:16, Alexey Klimov wrote:
> Hi Christian, Tudor,
>
> On Wed, 25 Nov 2026 at 17:40, Christian Loehle <christian.loehle@arm.com> wrote:
>>
>> acpm_tmu_set_trips() supplies two thresholds, but the ACPM command writes
>> all eight slots, zero-filling the rest. On GS101, slot 7 limits CPU clocks
>> independently of its interrupt mask. Setting it to 0 C limits all three
>> clusters to about 200 MHz while cpufreq reports the requested frequencies.
>> This was found through trial and error while tracking EAS regressions.
>
> Cpufreq reports the requested frequencies — are these cached values
> being reported?
> Or is this what the kernel gets via the ACPM call?
Requested frequencies are reported. The 200MHz I only deduced from PMU counters.
>
>> Program slot 7 from the lowest active hot trip so hardware throttling can
>> precede the critical trip's system shutdown. Cache the low/high window and
>> update the hot limit from set_trip_temp(), because the thermal core skips
>> set_trips() when that window is unchanged.
>
> FWIW, Exynos850 control register for TMU has bits to enabled/disable
> such behaviour (and it probably works).
> Maybe gs101 also has it.
> But it seems that cpufreq scaling feature itself is explicitly enabled.
Thanks for the hint Alexey!
THERM_TRIP_EN is bit12 on Exynos850, clearing that on gs101 still stays on 200MHz
for me. The downstream driver doesn't define it either.
Clearing bit16, i.e. 0x09003 instead of 0x19003 does indeed remove the throttling
even with all zeroes in slot7.
I would probably still go with $SUBJECT, as I'd say the risk of this having unwanted
side effects is lower IMHO, but I'm also happy with either.
See attached patch.
[-- Attachment #2: 0001-thermal-drivers-samsung-acpm-tmu-Disable-hardware-CP.patch --]
[-- Type: text/x-patch, Size: 1886 bytes --]
From 2ca500c0d1b766241170fb8a4f4b2002b42250cc Mon Sep 17 00:00:00 2001
From: Christian Loehle <christian.loehle@arm.com>
Date: Thu, 26 Nov 2026 10:46:34 +0000
Subject: [PATCH] thermal/drivers/samsung/acpm-tmu: Disable hardware CPU
throttling
acpm_tmu_set_trips() supplies two thresholds, but the ACPM command writes
all eight slots, zero-filling the rest. On GS101, slot 7 limits CPU clocks
independently of its interrupt mask. Setting it to 0 C limits all three
clusters to 200 MHz while cpufreq reports the requested frequencies.
Clear the CPU throttling enable bit in CONTROL after ACPM initialization,
leaving CPU cooling and critical shutdown to the thermal core.
Fixes: 50a2c5d4062a ("thermal/drivers/samsung: Add Exynos ACPM TMU driver GS101")
Signed-off-by: Christian Loehle <christian.loehle@arm.com>
---
drivers/thermal/samsung/acpm-tmu.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/thermal/samsung/acpm-tmu.c b/drivers/thermal/samsung/acpm-tmu.c
index 4799ef518a7a..fa1bfc0d1070 100644
--- a/drivers/thermal/samsung/acpm-tmu.c
+++ b/drivers/thermal/samsung/acpm-tmu.c
@@ -37,6 +37,8 @@
#define GS101_CPUCL0_SENSOR_MASK (EXYNOS_TMU_SENSOR(1) | \
EXYNOS_TMU_SENSOR(2))
+#define GS101_REG_CONTROL 0x50
+#define GS101_CONTROL_CPU_THROTTLE_EN BIT(16)
#define GS101_REG_INTPEND(i) ((i) * 0x50 + 0xf8)
enum {
@@ -470,6 +472,14 @@ static int acpm_tmu_probe(struct platform_device *pdev)
goto out_pm_put;
}
+ /* Disable slot 7 CPU throttling; the thermal core manages cooling. */
+ ret = regmap_clear_bits(regmap, GS101_REG_CONTROL,
+ GS101_CONTROL_CPU_THROTTLE_EN);
+ if (ret) {
+ ret = dev_err_probe(dev, ret, "Failed to disable CPU throttling\n");
+ goto out_pm_put;
+ }
+
for (i = 0; i < priv->num_sensors; i++) {
struct acpm_tmu_sensor *sensor = &priv->sensors[i];
struct thermal_zone_device *tzd;
--
2.34.1
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCHv3] thermal/drivers/samsung/acpm-tmu: Fix spurious CPU throttling
2026-11-26 10:50 ` Christian Loehle
@ 2026-11-26 11:03 ` Tudor Ambarus
2026-11-26 11:51 ` Alexey Klimov
2026-11-26 15:31 ` Alexey Klimov
2 siblings, 0 replies; 13+ messages in thread
From: Tudor Ambarus @ 2026-11-26 11:03 UTC (permalink / raw)
To: Christian Loehle, Alexey Klimov
Cc: bzolnier, krzk, rafael, daniel.lezcano, lukasz.luba,
linux-kernel, linux-samsung-soc, linux-pm
On 11/26/26 12:50 PM, Christian Loehle wrote:
>>> Program slot 7 from the lowest active hot trip so hardware throttling can
>>> precede the critical trip's system shutdown. Cache the low/high window and
>>> update the hot limit from set_trip_temp(), because the thermal core skips
>>> set_trips() when that window is unchanged.
>>
>> FWIW, Exynos850 control register for TMU has bits to enabled/disable
>> such behaviour (and it probably works).
>> Maybe gs101 also has it.
>> But it seems that cpufreq scaling feature itself is explicitly enabled.
>
> Thanks for the hint Alexey!
> THERM_TRIP_EN is bit12 on Exynos850, clearing that on gs101 still stays on 200MHz
> for me. The downstream driver doesn't define it either.
> Clearing bit16, i.e. 0x09003 instead of 0x19003 does indeed remove the throttling
> even with all zeroes in slot7.
> I would probably still go with $SUBJECT, as I'd say the risk of this having unwanted
I prefer current patch. On GS101 the TMU control registers are owned by the
ACPM firmware, which may rewrite CONTROL (e.g. on init, tz_control or resume),
and clearing the bit would also drop the hardware throttling as a backstop,
which downstream keeps enabled.
Cheers,
ta
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCHv3] thermal/drivers/samsung/acpm-tmu: Fix spurious CPU throttling
2026-11-25 17:39 [PATCHv3] thermal/drivers/samsung/acpm-tmu: Fix spurious CPU throttling Christian Loehle
2026-11-26 9:16 ` Alexey Klimov
@ 2026-11-26 11:33 ` Tudor Ambarus
2026-11-26 12:58 ` André Draszik
2 siblings, 0 replies; 13+ messages in thread
From: Tudor Ambarus @ 2026-11-26 11:33 UTC (permalink / raw)
To: Christian Loehle, bzolnier
Cc: krzk, rafael, daniel.lezcano, lukasz.luba, linux-kernel,
linux-samsung-soc, linux-pm, Alexey Klimov, Peter Griffin,
André Draszik, Juan Yescas
I tested the patch. With the driver loaded, all clusters now run at their
maximum frequency (measured via CPU_CYCLES) instead of ~200 MHz. Lowering
the hot trip via sysfs to 55 C reprograms threshold 7, and the hardware
then holds the CPU cluster at ~55 C under full load.
Reviewed-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Tested-by: Tudor Ambarus <tudor.ambarus@linaro.org>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCHv3] thermal/drivers/samsung/acpm-tmu: Fix spurious CPU throttling
2026-11-26 10:50 ` Christian Loehle
2026-11-26 11:03 ` Tudor Ambarus
@ 2026-11-26 11:51 ` Alexey Klimov
2026-11-26 14:43 ` Tudor Ambarus
2026-11-26 15:31 ` Alexey Klimov
2 siblings, 1 reply; 13+ messages in thread
From: Alexey Klimov @ 2026-11-26 11:51 UTC (permalink / raw)
To: tudor.ambarus
Cc: Christian Loehle, bzolnier, krzk, rafael, daniel.lezcano,
lukasz.luba, linux-kernel, linux-samsung-soc, linux-pm
On Thu, 26 Nov 2026 at 10:50, Christian Loehle <christian.loehle@arm.com> wrote:
>
> On 11/26/26 09:16, Alexey Klimov wrote:
> > Hi Christian, Tudor,
> >
> > On Wed, 25 Nov 2026 at 17:40, Christian Loehle <christian.loehle@arm.com> wrote:
> >>
> >> acpm_tmu_set_trips() supplies two thresholds, but the ACPM command writes
> >> all eight slots, zero-filling the rest. On GS101, slot 7 limits CPU clocks
> >> independently of its interrupt mask. Setting it to 0 C limits all three
> >> clusters to about 200 MHz while cpufreq reports the requested frequencies.
> >> This was found through trial and error while tracking EAS regressions.
> >
> > Cpufreq reports the requested frequencies — are these cached values
> > being reported?
> > Or is this what the kernel gets via the ACPM call?
>
> Requested frequencies are reported. The 200MHz I only deduced from PMU counters.
Tudor, your thoughts?
Is ACPM reporting an incorrect rate or are those cached values?
Thanks,
Alexey
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCHv3] thermal/drivers/samsung/acpm-tmu: Fix spurious CPU throttling
2026-11-25 17:39 [PATCHv3] thermal/drivers/samsung/acpm-tmu: Fix spurious CPU throttling Christian Loehle
2026-11-26 9:16 ` Alexey Klimov
2026-11-26 11:33 ` Tudor Ambarus
@ 2026-11-26 12:58 ` André Draszik
2 siblings, 0 replies; 13+ messages in thread
From: André Draszik @ 2026-11-26 12:58 UTC (permalink / raw)
To: Christian Loehle, tudor.ambarus, bzolnier
Cc: krzk, rafael, daniel.lezcano, lukasz.luba, linux-kernel,
linux-samsung-soc, linux-pm
Hi Christian,
On Wed, 2026-11-25 at 17:39 +0000, Christian Loehle wrote:
> acpm_tmu_set_trips() supplies two thresholds, but the ACPM command writes
> all eight slots, zero-filling the rest. On GS101, slot 7 limits CPU clocks
> independently of its interrupt mask. Setting it to 0 C limits all three
> clusters to about 200 MHz while cpufreq reports the requested frequencies.
> This was found through trial and error while tracking EAS regressions.
>
> Program slot 7 from the lowest active hot trip so hardware throttling can
> precede the critical trip's system shutdown. Cache the low/high window and
> update the hot limit from set_trip_temp(), because the thermal core skips
> set_trips() when that window is unchanged.
>
> Fixes: 50a2c5d4062a ("thermal/drivers/samsung: Add Exynos ACPM TMU driver GS101")
> Signed-off-by: Christian Loehle <christian.loehle@arm.com>
> ---
> Since v2:
> - Use hot instead of critical s.t. it precedes shutdown. (Tudor)
> Since v1:
> - Rebase onto linux-next, including Daniel’s queued ACPM TMU fixes.
> - Cache only low/high and look up the lowest active critical trip when programming. (Tudor)
> - Retain the requested window even if programming fails, matching the thermal core.
> - Handle critical-trip deactivation and zones without an active critical trip.
>
>
> drivers/thermal/samsung/acpm-tmu.c | 76 +++++++++++++++++++++++++++---
> 1 file changed, 70 insertions(+), 6 deletions(-)
Thanks for this patch. I was indeed wondering what was going on... Boot
time on Oriole is back to normal in my debug kernel; just to add some
numbers:
• reaching multi-user.target drops from 99–111 s down to 20–28 s (saving
71–90 s)
• adbd readiness drops from 120–132 s down to 21–29 s (saving 92–109 s).
• cold copy_modules rsync throughput jumps from 4.37 MB/s (1,727 files)
to 30.71 MB/s (1,713 files)
• CPU die temperatures at boot end also reflect unthrottled execution
(46–48 °C unpatched vs 49–58 °C patched).
Tested-by: André Draszik <andre.draszik@linaro.org>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCHv3] thermal/drivers/samsung/acpm-tmu: Fix spurious CPU throttling
2026-11-26 11:51 ` Alexey Klimov
@ 2026-11-26 14:43 ` Tudor Ambarus
2026-11-26 14:50 ` Alexey Klimov
0 siblings, 1 reply; 13+ messages in thread
From: Tudor Ambarus @ 2026-11-26 14:43 UTC (permalink / raw)
To: Alexey Klimov, Christian Loehle
Cc: bzolnier, krzk, rafael, daniel.lezcano, lukasz.luba,
linux-kernel, linux-samsung-soc, linux-pm, André Draszik,
Peter Griffin, Juan Yescas
On 11/26/26 1:51 PM, Alexey Klimov wrote:
> On Thu, 26 Nov 2026 at 10:50, Christian Loehle <christian.loehle@arm.com> wrote:
>>
>> On 11/26/26 09:16, Alexey Klimov wrote:
>>> Hi Christian, Tudor,
>>>
>>> On Wed, 25 Nov 2026 at 17:40, Christian Loehle <christian.loehle@arm.com> wrote:
>>>>
>>>> acpm_tmu_set_trips() supplies two thresholds, but the ACPM command writes
>>>> all eight slots, zero-filling the rest. On GS101, slot 7 limits CPU clocks
>>>> independently of its interrupt mask. Setting it to 0 C limits all three
>>>> clusters to about 200 MHz while cpufreq reports the requested frequencies.
>>>> This was found through trial and error while tracking EAS regressions.
>>>
>>> Cpufreq reports the requested frequencies — are these cached values
>>> being reported?
>>> Or is this what the kernel gets via the ACPM call?
>>
>> Requested frequencies are reported. The 200MHz I only deduced from PMU counters.
>
> Tudor, your thoughts?
> Is ACPM reporting an incorrect rate or are those cached values?
Both. I checked with debug prints in cpufreq:
- scaling_cur_freq returns the cached policy->cur.
- cpuinfo_cur_freq gets the freq via ACPM call. The value always matched
policy->cur
So ACPM reports the DVFS level it was asked to set, not the throttled
clock. With the hot trip lowered via sysfs so that the slot 7 throttle
engages, on the X1 (cpu6):
zone cycles/s (perf) scaling_cur_freq cpuinfo_cur_freq
68 C 0.85-1.21 GHz 2802000 2802000
Without throttling, the three agree (e.g. 2.19 GHz measured, 2188000
reported).
It would be good to specify in the commit message that the governors
don't see the throttle. Something like:
Program slot 7 from the lowest hot trip. Above that temperature the
firmware throttles the CPU clusters on its own, without cpufreq or the
thermal governors noticing, so the hot trip must stay above the range
where the governors regulate. This matches the downstream setup.
Cheers,
ta
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCHv3] thermal/drivers/samsung/acpm-tmu: Fix spurious CPU throttling
2026-11-26 14:43 ` Tudor Ambarus
@ 2026-11-26 14:50 ` Alexey Klimov
2026-11-26 15:01 ` Tudor Ambarus
0 siblings, 1 reply; 13+ messages in thread
From: Alexey Klimov @ 2026-11-26 14:50 UTC (permalink / raw)
To: Tudor Ambarus, Christian Loehle
Cc: bzolnier, krzk, rafael, daniel.lezcano, lukasz.luba,
linux-kernel, linux-samsung-soc, linux-pm, André Draszik,
Peter Griffin, Juan Yescas
On Thu Nov 26, 2026 at 2:43 PM GMT, Tudor Ambarus wrote:
>
>
> On 11/26/26 1:51 PM, Alexey Klimov wrote:
>> On Thu, 26 Nov 2026 at 10:50, Christian Loehle <christian.loehle@arm.com> wrote:
>>>
>>> On 11/26/26 09:16, Alexey Klimov wrote:
>>>> Hi Christian, Tudor,
>>>>
>>>> On Wed, 25 Nov 2026 at 17:40, Christian Loehle <christian.loehle@arm.com> wrote:
>>>>>
>>>>> acpm_tmu_set_trips() supplies two thresholds, but the ACPM command writes
>>>>> all eight slots, zero-filling the rest. On GS101, slot 7 limits CPU clocks
>>>>> independently of its interrupt mask. Setting it to 0 C limits all three
>>>>> clusters to about 200 MHz while cpufreq reports the requested frequencies.
>>>>> This was found through trial and error while tracking EAS regressions.
>>>>
>>>> Cpufreq reports the requested frequencies — are these cached values
>>>> being reported?
>>>> Or is this what the kernel gets via the ACPM call?
>>>
>>> Requested frequencies are reported. The 200MHz I only deduced from PMU counters.
>>
>> Tudor, your thoughts?
>> Is ACPM reporting an incorrect rate or are those cached values?
>
> Both. I checked with debug prints in cpufreq:
>
> - scaling_cur_freq returns the cached policy->cur.
> - cpuinfo_cur_freq gets the freq via ACPM call. The value always matched
> policy->cur
>
> So ACPM reports the DVFS level it was asked to set, not the throttled
> clock. With the hot trip lowered via sysfs so that the slot 7 throttle
> engages, on the X1 (cpu6):
>
> zone cycles/s (perf) scaling_cur_freq cpuinfo_cur_freq
> 68 C 0.85-1.21 GHz 2802000 2802000
>
> Without throttling, the three agree (e.g. 2.19 GHz measured, 2188000
> reported).
>
> It would be good to specify in the commit message that the governors
> don't see the throttle. Something like:
>
> Program slot 7 from the lowest hot trip. Above that temperature the
> firmware throttles the CPU clusters on its own, without cpufreq or the
> thermal governors noticing, so the hot trip must stay above the range
> where the governors regulate. This matches the downstream setup.
Ain't that mean that ACPM ->dvfs.set_rate() call doesn't work?
I don't remember all the detauls but I think you mentioned that
downstream doesn't execute set_rate() ACPM call and does the SFR
(mmio) reads, basically what we have on Exynos850.
What about clocks and corresponding PLL clocks?
Thanks,
Alexey
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCHv3] thermal/drivers/samsung/acpm-tmu: Fix spurious CPU throttling
2026-11-26 14:50 ` Alexey Klimov
@ 2026-11-26 15:01 ` Tudor Ambarus
2026-11-26 15:21 ` Alexey Klimov
0 siblings, 1 reply; 13+ messages in thread
From: Tudor Ambarus @ 2026-11-26 15:01 UTC (permalink / raw)
To: Alexey Klimov, Christian Loehle
Cc: bzolnier, krzk, rafael, daniel.lezcano, lukasz.luba,
linux-kernel, linux-samsung-soc, linux-pm, André Draszik,
Peter Griffin, Juan Yescas
On 11/26/26 4:50 PM, Alexey Klimov wrote:
> On Thu Nov 26, 2026 at 2:43 PM GMT, Tudor Ambarus wrote:
>>
>>
>> On 11/26/26 1:51 PM, Alexey Klimov wrote:
>>> On Thu, 26 Nov 2026 at 10:50, Christian Loehle <christian.loehle@arm.com> wrote:
>>>>
>>>> On 11/26/26 09:16, Alexey Klimov wrote:
>>>>> Hi Christian, Tudor,
>>>>>
>>>>> On Wed, 25 Nov 2026 at 17:40, Christian Loehle <christian.loehle@arm.com> wrote:
>>>>>>
>>>>>> acpm_tmu_set_trips() supplies two thresholds, but the ACPM command writes
>>>>>> all eight slots, zero-filling the rest. On GS101, slot 7 limits CPU clocks
>>>>>> independently of its interrupt mask. Setting it to 0 C limits all three
>>>>>> clusters to about 200 MHz while cpufreq reports the requested frequencies.
>>>>>> This was found through trial and error while tracking EAS regressions.
>>>>>
>>>>> Cpufreq reports the requested frequencies — are these cached values
>>>>> being reported?
>>>>> Or is this what the kernel gets via the ACPM call?
>>>>
>>>> Requested frequencies are reported. The 200MHz I only deduced from PMU counters.
>>>
>>> Tudor, your thoughts?
>>> Is ACPM reporting an incorrect rate or are those cached values?
>>
>> Both. I checked with debug prints in cpufreq:
>>
>> - scaling_cur_freq returns the cached policy->cur.
>> - cpuinfo_cur_freq gets the freq via ACPM call. The value always matched
>> policy->cur
>>
>> So ACPM reports the DVFS level it was asked to set, not the throttled
>> clock. With the hot trip lowered via sysfs so that the slot 7 throttle
>> engages, on the X1 (cpu6):
>>
>> zone cycles/s (perf) scaling_cur_freq cpuinfo_cur_freq
>> 68 C 0.85-1.21 GHz 2802000 2802000
>>
>> Without throttling, the three agree (e.g. 2.19 GHz measured, 2188000
>> reported).
>>
>> It would be good to specify in the commit message that the governors
>> don't see the throttle. Something like:
>>
>> Program slot 7 from the lowest hot trip. Above that temperature the
>> firmware throttles the CPU clusters on its own, without cpufreq or the
>> thermal governors noticing, so the hot trip must stay above the range
>> where the governors regulate. This matches the downstream setup.
>
> Ain't that mean that ACPM ->dvfs.set_rate() call doesn't work?
No, set_rate() works. Without throttling, the measured frequency follows
every requested level (1.80/2.25/2.76 GHz at the cluster maxima, 2.19 GHz
for 2188000, and scaling_max_freq caps take effect). FREQ_GET returns the
level that was set; the throttle is applied by hardware below that level.
> I don't remember all the detauls but I think you mentioned that
> downstream doesn't execute set_rate() ACPM call and does the SFR
> (mmio) reads, basically what we have on Exynos850.
>
Downstream sets CPU rates through ACPM as well: cal_dfs_set_rate() calls
exynos_acpm_set_rate() for ACPM vclks and caches the rate in vclk->vrate.
cal_dfs_get_rate() returns that cached value and only asks ACPM when
nothing is cached. So GS101 doesn't need the E850 approach, since its
firmware implements FREQ_GET.
> What about clocks and corresponding PLL clocks?
>
Upstream has no CMU_CPUCLx driver. I'd expect a PLL readback to show the
DVFS level too.
Cheers,
ta
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCHv3] thermal/drivers/samsung/acpm-tmu: Fix spurious CPU throttling
2026-11-26 15:01 ` Tudor Ambarus
@ 2026-11-26 15:21 ` Alexey Klimov
2026-11-26 15:55 ` Tudor Ambarus
0 siblings, 1 reply; 13+ messages in thread
From: Alexey Klimov @ 2026-11-26 15:21 UTC (permalink / raw)
To: Tudor Ambarus, Christian Loehle
Cc: bzolnier, krzk, rafael, daniel.lezcano, lukasz.luba,
linux-kernel, linux-samsung-soc, linux-pm, André Draszik,
Peter Griffin, Juan Yescas
On Thu Nov 26, 2026 at 3:01 PM GMT, Tudor Ambarus wrote:
>
>
> On 11/26/26 4:50 PM, Alexey Klimov wrote:
>> On Thu Nov 26, 2026 at 2:43 PM GMT, Tudor Ambarus wrote:
>>>
>>>
>>> On 11/26/26 1:51 PM, Alexey Klimov wrote:
>>>> On Thu, 26 Nov 2026 at 10:50, Christian Loehle <christian.loehle@arm.com> wrote:
>>>>>
>>>>> On 11/26/26 09:16, Alexey Klimov wrote:
>>>>>> Hi Christian, Tudor,
>>>>>>
>>>>>> On Wed, 25 Nov 2026 at 17:40, Christian Loehle <christian.loehle@arm.com> wrote:
>>>>>>>
>>>>>>> acpm_tmu_set_trips() supplies two thresholds, but the ACPM command writes
>>>>>>> all eight slots, zero-filling the rest. On GS101, slot 7 limits CPU clocks
>>>>>>> independently of its interrupt mask. Setting it to 0 C limits all three
>>>>>>> clusters to about 200 MHz while cpufreq reports the requested frequencies.
>>>>>>> This was found through trial and error while tracking EAS regressions.
>>>>>>
>>>>>> Cpufreq reports the requested frequencies — are these cached values
>>>>>> being reported?
>>>>>> Or is this what the kernel gets via the ACPM call?
>>>>>
>>>>> Requested frequencies are reported. The 200MHz I only deduced from PMU counters.
>>>>
>>>> Tudor, your thoughts?
>>>> Is ACPM reporting an incorrect rate or are those cached values?
>>>
>>> Both. I checked with debug prints in cpufreq:
>>>
>>> - scaling_cur_freq returns the cached policy->cur.
>>> - cpuinfo_cur_freq gets the freq via ACPM call. The value always matched
>>> policy->cur
>>>
>>> So ACPM reports the DVFS level it was asked to set, not the throttled
>>> clock. With the hot trip lowered via sysfs so that the slot 7 throttle
>>> engages, on the X1 (cpu6):
>>>
>>> zone cycles/s (perf) scaling_cur_freq cpuinfo_cur_freq
>>> 68 C 0.85-1.21 GHz 2802000 2802000
>>>
>>> Without throttling, the three agree (e.g. 2.19 GHz measured, 2188000
>>> reported).
>>>
>>> It would be good to specify in the commit message that the governors
>>> don't see the throttle. Something like:
>>>
>>> Program slot 7 from the lowest hot trip. Above that temperature the
>>> firmware throttles the CPU clusters on its own, without cpufreq or the
>>> thermal governors noticing, so the hot trip must stay above the range
>>> where the governors regulate. This matches the downstream setup.
>>
>> Ain't that mean that ACPM ->dvfs.set_rate() call doesn't work?
>
> No, set_rate() works. Without throttling, the measured frequency follows
> every requested level (1.80/2.25/2.76 GHz at the cluster maxima, 2.19 GHz
> for 2188000, and scaling_max_freq caps take effect). FREQ_GET returns the
> level that was set; the throttle is applied by hardware below that level.
Sorry, I did a mistake, I meant get_rate() obviously.
>> I don't remember all the detauls but I think you mentioned that
>> downstream doesn't execute set_rate() ACPM call and does the SFR
>> (mmio) reads, basically what we have on Exynos850.
>>
>
> Downstream sets CPU rates through ACPM as well: cal_dfs_set_rate() calls
> exynos_acpm_set_rate() for ACPM vclks and caches the rate in vclk->vrate.
> cal_dfs_get_rate() returns that cached value and only asks ACPM when
> nothing is cached. So GS101 doesn't need the E850 approach, since its
> firmware implements FREQ_GET.
Which returns wrongs frequency for the situation described in the commit
message and in this discussion => doesn't work? But the call itself
is implemented and doesn't return an error.
"limits all three clusters to about 200 MHz while cpufreq reports
the requested frequencies."
And also your tests.
>> What about clocks and corresponding PLL clocks?
>>
> Upstream has no CMU_CPUCLx driver. I'd expect a PLL readback to show the
> DVFS level too.
I am not sure.
TMU should assert a direct hardware sideband signal to the CMU block.
I would imagine it may play with CMU's clock divider/gate or triggers
skipping of clock pulses/injecting idle cycles.
Best regards,
Alexey
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCHv3] thermal/drivers/samsung/acpm-tmu: Fix spurious CPU throttling
2026-11-26 10:50 ` Christian Loehle
2026-11-26 11:03 ` Tudor Ambarus
2026-11-26 11:51 ` Alexey Klimov
@ 2026-11-26 15:31 ` Alexey Klimov
2 siblings, 0 replies; 13+ messages in thread
From: Alexey Klimov @ 2026-11-26 15:31 UTC (permalink / raw)
To: Christian Loehle, tudor.ambarus
Cc: bzolnier, krzk, rafael, daniel.lezcano, lukasz.luba,
linux-kernel, linux-samsung-soc, linux-pm
On Thu Nov 26, 2026 at 10:50 AM GMT, Christian Loehle wrote:
> On 11/26/26 09:16, Alexey Klimov wrote:
>> Hi Christian, Tudor,
>>
>> On Wed, 25 Nov 2026 at 17:40, Christian Loehle <christian.loehle@arm.com> wrote:
>>>
>>> acpm_tmu_set_trips() supplies two thresholds, but the ACPM command writes
>>> all eight slots, zero-filling the rest. On GS101, slot 7 limits CPU clocks
>>> independently of its interrupt mask. Setting it to 0 C limits all three
>>> clusters to about 200 MHz while cpufreq reports the requested frequencies.
>>> This was found through trial and error while tracking EAS regressions.
>>
>> Cpufreq reports the requested frequencies — are these cached values
>> being reported?
>> Or is this what the kernel gets via the ACPM call?
>
> Requested frequencies are reported. The 200MHz I only deduced from PMU counters.
>
>>
>>> Program slot 7 from the lowest active hot trip so hardware throttling can
>>> precede the critical trip's system shutdown. Cache the low/high window and
>>> update the hot limit from set_trip_temp(), because the thermal core skips
>>> set_trips() when that window is unchanged.
>>
>> FWIW, Exynos850 control register for TMU has bits to enabled/disable
>> such behaviour (and it probably works).
>> Maybe gs101 also has it.
>> But it seems that cpufreq scaling feature itself is explicitly enabled.
>
> Thanks for the hint Alexey!
> THERM_TRIP_EN is bit12 on Exynos850, clearing that on gs101 still stays on 200MHz
> for me. The downstream driver doesn't define it either.
> Clearing bit16, i.e. 0x09003 instead of 0x19003 does indeed remove the throttling
> even with all zeroes in slot7.
> I would probably still go with $SUBJECT, as I'd say the risk of this having unwanted
> side effects is lower IMHO, but I'm also happy with either.
Sure, no objections about the patch here!
I just thought that for exynos850 we might need to initialise it manually
since we rely there less on ACPM and what bootloader leaves for kernel.
Thanks for checking.
Best regards,
Alexey
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCHv3] thermal/drivers/samsung/acpm-tmu: Fix spurious CPU throttling
2026-11-26 15:21 ` Alexey Klimov
@ 2026-11-26 15:55 ` Tudor Ambarus
0 siblings, 0 replies; 13+ messages in thread
From: Tudor Ambarus @ 2026-11-26 15:55 UTC (permalink / raw)
To: Alexey Klimov, Christian Loehle
Cc: bzolnier, krzk, rafael, daniel.lezcano, lukasz.luba,
linux-kernel, linux-samsung-soc, linux-pm, André Draszik,
Peter Griffin, Juan Yescas
On 11/26/26 5:21 PM, Alexey Klimov wrote:
> Which returns wrongs frequency for the situation described in the commit
> message and in this discussion => doesn't work?
Yes, it seems linux can't see the hardware throttle. I need to study whether
there's a notification mechanism. On a first looks GS101 lacks it.
Let's keep the hot trip as a last-resort backstop, as downstream does.
Will try to ask around, maybe we find out what the firmware does. I'll add
the topic to my todo list, but it's not something that I'll get to soon.
Cheers,
ta
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2026-11-26 15:55 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-25 17:39 [PATCHv3] thermal/drivers/samsung/acpm-tmu: Fix spurious CPU throttling Christian Loehle
2026-11-26 9:16 ` Alexey Klimov
2026-11-26 10:50 ` Christian Loehle
2026-11-26 11:03 ` Tudor Ambarus
2026-11-26 11:51 ` Alexey Klimov
2026-11-26 14:43 ` Tudor Ambarus
2026-11-26 14:50 ` Alexey Klimov
2026-11-26 15:01 ` Tudor Ambarus
2026-11-26 15:21 ` Alexey Klimov
2026-11-26 15:55 ` Tudor Ambarus
2026-11-26 15:31 ` Alexey Klimov
2026-11-26 11:33 ` Tudor Ambarus
2026-11-26 12:58 ` André Draszik
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®