xref: /linux/Documentation/admin-guide/thermal/intel_thermal_throttle.rst (revision 619f4edc8d4f785dcabf564786e787fa8108deb4)
1.. SPDX-License-Identifier: GPL-2.0
2.. include:: <isonum.txt>
3
4=======================================
5Intel thermal throttle events reporting
6=======================================
7
8:Author: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
9
10Introduction
11------------
12
13Intel processors have built in automatic and adaptive thermal monitoring
14mechanisms that force the processor to reduce its power consumption in order
15to operate within predetermined temperature limits.
16
17Refer to section "THERMAL MONITORING AND PROTECTION" in the "Intel® 64 and
18IA-32 Architectures Software Developer’s Manual Volume 3 (3A, 3B, 3C, & 3D):
19System Programming Guide" for more details.
20
21In general, there are two mechanisms to control the core temperature of the
22processor. They are called "Thermal Monitor 1 (TM1) and Thermal Monitor 2 (TM2)".
23
24The status of the temperature sensor that triggers the thermal monitor (TM1/TM2)
25is indicated through the "thermal status flag" and "thermal status log flag" in
26MSR_IA32_THERM_STATUS for core level and MSR_IA32_PACKAGE_THERM_STATUS for
27package level.
28
29Thermal Status flag, bit 0 — When set, indicates that the processor core
30temperature is currently at the trip temperature of the thermal monitor and that
31the processor power consumption is being reduced via either TM1 or TM2, depending
32on which is enabled. When clear, the flag indicates that the core temperature is
33below the thermal monitor trip temperature. This flag is read only.
34
35Thermal Status Log flag, bit 1 — When set, indicates that the thermal sensor has
36tripped since the last power-up or reset or since the last time that software
37cleared this flag. This flag is a sticky bit; once set it remains set until
38cleared by software or until a power-up or reset of the processor. The default
39state is clear.
40
41It is possible that when user reads MSR_IA32_THERM_STATUS or
42MSR_IA32_PACKAGE_THERM_STATUS, TM1/TM2 is not active. In this case,
43"Thermal Status flag" will read "0" and the "Thermal Status Log flag" will be set
44to show any previous "TM1/TM2" activation. But since it needs to be cleared by
45the software, it can't show the number of occurrences of "TM1/TM2" activations.
46
47Hence, Linux provides counters of how many times the "Thermal Status flag" was
48set. Also presents how long the "Thermal Status flag" was active in milliseconds.
49Using these counters, users can check if the performance was limited because of
50thermal events. It is recommended to read from sysfs instead of directly reading
51MSRs as the "Thermal Status Log flag" is reset by the driver to implement rate
52control.
53
54Sysfs Interface
55---------------
56
57Thermal throttling events are presented for each CPU under
58"/sys/devices/system/cpu/cpuX/thermal_throttle/", where "X" is the CPU number.
59
60All these counters are read-only. They can't be reset to 0. So, they can potentially
61overflow after reaching the maximum 64 bit unsigned integer.
62
63``core_throttle_count``
64	Shows the number of times "Thermal Status flag" changed from 0 to 1 for this
65	CPU since OS boot and thermal vector is initialized. This is a 64 bit counter.
66
67``package_throttle_count``
68	Shows the number of times "Thermal Status flag" changed from 0 to 1 for the
69	package containing this CPU since OS boot and thermal vector is initialized.
70	Package status is broadcast to all CPUs; all CPUs in the package increment
71	this count. This is a 64-bit counter.
72
73``core_throttle_max_time_ms``
74	Shows the maximum amount of time for which "Thermal Status flag" has been
75	set to 1 for this CPU at the core level since OS boot and thermal vector
76	is initialized.
77
78``package_throttle_max_time_ms``
79	Shows the maximum amount of time for which "Thermal Status flag" has been
80	set to 1 for the package containing this CPU since OS boot and thermal
81	vector is initialized.
82
83``core_throttle_total_time_ms``
84	Shows the cumulative time for which "Thermal Status flag" has been
85	set to 1 for this CPU for core level since OS boot and thermal vector
86	is initialized.
87
88``package_throttle_total_time_ms``
89	Shows the cumulative time for which "Thermal Status flag" has been set
90	to 1 for the package containing this CPU since OS boot and thermal vector
91	is initialized.
92