What do the different thermal zones actually correspond to?
I've just finished building a new machine with a i9 9900k CPU, a CPU with 1 socket, 8 cores and 16 threads. I installed Ubuntu Bionic on it, and I am just about to add checks to the CPU temperatures.
However, when I run cat /sys/class/thermal/thermal_zone*/temp
(as recommended by https://askubuntu.com/a/15834/822289) I get 3 results:
27800
40000
28000
Edit 1: The "correct" CPU-temperature is the one shown at thermal_zone2.
I thought maybe a 3rd-party program like acpi might help:
# acpi -t
Thermal 0: ok, 27.8 degrees C
But that one only gives me what's on thermal_zone0
. What do the other ones represent, especially thermal_zone1, and how can I find more information about that?
Edit 2: The answer to what do the other ones represent can be found by running the following command:
cat /sys/class/thermal/thermal_zone*/type
Which gives me, in this case, the following output:
acpitz
pch_cannonlake
x86_pkg_temp
The exact definition of what a given thermal zone represents is defined by the driver for the given zone. Different processors and motherboards make different thermometers available to linux, and so every one has it's own name. Each of the different zones is a different thermometer on the system: the "acpitz" one is the one made available through ACPI, and the x86_pkg_temp is the temperature exported by the core x86 spec. The ACPI one is a motherboard sensor that is near the CPU socket, and the x86_pkg_temp is within the CPU itself
Based on a git grep through the kernel source tree, the 2nd one (pch_cannonlake) specifies the thermomemter output of an intel-specific thermocouple, used for thermal throttling. However, determining it's exact location (as with the others) is at best an educated guess: it will vary by chipset and manufacturer, so you would need to consult the detailed specification and layout of your chip.