* [PATCH] thermal: intel: x86_pkg_temp_thermal: Fix bogus trip temperature
@ 2025-05-19 7:09 Zhang Rui
2025-05-19 19:10 ` Rafael J. Wysocki
0 siblings, 1 reply; 2+ messages in thread
From: Zhang Rui @ 2025-05-19 7:09 UTC (permalink / raw)
To: rafael.j.wysocki; +Cc: zhangn1985, daniel.lezcano, linux-kernel, linux-pm
The tj_max value obtained from the Intel TCC library are in Celsius,
whereas the thermal subsystem operates in milli-Celsius.
This discrepancy leads to incorrect trip temperature calculations.
Fix bogus trip temperature by converting tj_max to milli-Celsius Unit.
Fixes: 8ef0ca4a177d ("Merge back other thermal control material for 6.3.")
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Reported-by: zhang ning <zhangn1985@outlook.com>
Closes: https://lore.kernel.org/all/TY2PR01MB3786EF0FE24353026293F5ACCD97A@TY2PR01MB3786.jpnprd01.prod.outlook.com/
Tested-by: zhang ning <zhangn1985@outlook.com>
---
Commit 983eb370cb87 ("thermal/x86_pkg_temp_thermal: Use Intel TCC
library") converts tj_max to use the standard API without switching the
Unit, which is a bug. This was mitigated by the next commit 58374a3970a0
("thermal/x86_pkg_temp_thermal: Add support for handling dynamic tjmax")
which uses the Celsius tj_max for failure check only.
This may confuse the maintainer and the bug was introduced by commit
8ef0ca4a177d ("Merge back other thermal control material for 6.3."),
when addressing the conflicts with commit d3ecaf17b586
("thermal/drivers/intel: Use generic thermal_zone_get_trip() function").
---
drivers/thermal/intel/x86_pkg_temp_thermal.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/thermal/intel/x86_pkg_temp_thermal.c b/drivers/thermal/intel/x86_pkg_temp_thermal.c
index 4894a26b1e4e..3fc679b6f11b 100644
--- a/drivers/thermal/intel/x86_pkg_temp_thermal.c
+++ b/drivers/thermal/intel/x86_pkg_temp_thermal.c
@@ -330,6 +330,7 @@ static int pkg_temp_thermal_device_add(unsigned int cpu)
tj_max = intel_tcc_get_tjmax(cpu);
if (tj_max < 0)
return tj_max;
+ tj_max *= 1000;
zonedev = kzalloc(sizeof(*zonedev), GFP_KERNEL);
if (!zonedev)
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] thermal: intel: x86_pkg_temp_thermal: Fix bogus trip temperature
2025-05-19 7:09 [PATCH] thermal: intel: x86_pkg_temp_thermal: Fix bogus trip temperature Zhang Rui
@ 2025-05-19 19:10 ` Rafael J. Wysocki
0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2025-05-19 19:10 UTC (permalink / raw)
To: Zhang Rui
Cc: rafael.j.wysocki, zhangn1985, daniel.lezcano, linux-kernel,
linux-pm
On Mon, May 19, 2025 at 9:09 AM Zhang Rui <rui.zhang@intel.com> wrote:
>
> The tj_max value obtained from the Intel TCC library are in Celsius,
> whereas the thermal subsystem operates in milli-Celsius.
> This discrepancy leads to incorrect trip temperature calculations.
>
> Fix bogus trip temperature by converting tj_max to milli-Celsius Unit.
>
> Fixes: 8ef0ca4a177d ("Merge back other thermal control material for 6.3.")
> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
> Reported-by: zhang ning <zhangn1985@outlook.com>
> Closes: https://lore.kernel.org/all/TY2PR01MB3786EF0FE24353026293F5ACCD97A@TY2PR01MB3786.jpnprd01.prod.outlook.com/
> Tested-by: zhang ning <zhangn1985@outlook.com>
> ---
> Commit 983eb370cb87 ("thermal/x86_pkg_temp_thermal: Use Intel TCC
> library") converts tj_max to use the standard API without switching the
> Unit, which is a bug. This was mitigated by the next commit 58374a3970a0
> ("thermal/x86_pkg_temp_thermal: Add support for handling dynamic tjmax")
> which uses the Celsius tj_max for failure check only.
>
> This may confuse the maintainer and the bug was introduced by commit
> 8ef0ca4a177d ("Merge back other thermal control material for 6.3."),
> when addressing the conflicts with commit d3ecaf17b586
> ("thermal/drivers/intel: Use generic thermal_zone_get_trip() function").
> ---
> drivers/thermal/intel/x86_pkg_temp_thermal.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/thermal/intel/x86_pkg_temp_thermal.c b/drivers/thermal/intel/x86_pkg_temp_thermal.c
> index 4894a26b1e4e..3fc679b6f11b 100644
> --- a/drivers/thermal/intel/x86_pkg_temp_thermal.c
> +++ b/drivers/thermal/intel/x86_pkg_temp_thermal.c
> @@ -330,6 +330,7 @@ static int pkg_temp_thermal_device_add(unsigned int cpu)
> tj_max = intel_tcc_get_tjmax(cpu);
> if (tj_max < 0)
> return tj_max;
> + tj_max *= 1000;
>
> zonedev = kzalloc(sizeof(*zonedev), GFP_KERNEL);
> if (!zonedev)
> --
Applied as 6.15-rc material, thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-05-19 19:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-19 7:09 [PATCH] thermal: intel: x86_pkg_temp_thermal: Fix bogus trip temperature Zhang Rui
2025-05-19 19:10 ` Rafael J. Wysocki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox