Procedure to optimize thermal performance for Intel® Core™ 7th Generation and later

This procedure outlines the steps required to tune a platform for optimal thermal performance.

Prerequisites
The latest release of dptfxtract tool from https://github.com/intel/dptfxtract
The latest release of Linux thermal daemon (thermald) from https://github.com/intel/thermal_daemon
(version 1.9 or later)
Linux kernel version 5.3 or later (Refer to workaround option for older kernels)

Step 1
Download the latest version of the tool "dptfxtract" from
https://github.com/intel/dptfxtract

Step 2
It is possible that your Linux distribution already enabled the Linux Thermal Daemon.
Check the version of the thermald:
# thermald --version
If it is 1.9 or later, you can skip Step 3.

Step 3
Clone or download the latest thermald from
https://github.com/intel/thermal_daemon
Follow the build procedure based on your distribution from
https://github.com/intel/thermal_daemon/blob/master/README.txt

It is possible that there is an existing older version of the thermald on your system; it is
better to rename that to something else before calling "make install".
# which thermald
This shows the current location of your thermald, if it exists.

Step 4
Check the status of the existing thermald service.
#systemctl status thermald.service
It may show that service is "Active and running". If it is, stop the service.
#systemctl stop thermald.service

Step 5
Run dptfxtract tool.
#./dptfxtract

This will print if any thermal configuration files are found.

For example, I see the following output on the test system.

#./dptfxtract

DPTF Tables Extraction Utility
Copyright (c) 2000 - 2019 Intel Corporation


Output file is /etc/thermald/thermal-conf.xml.0
Output file is /etc/thermald/thermal-conf.xml.1
Output file is /etc/thermald/thermal-conf.xml.2
Output file is /etc/thermald/thermal-conf.xml.3
Output file is /etc/thermald/thermal-conf.xml.4
Output file is /etc/thermald/thermal-conf.xml.auto

Step 6
Check the kernel version, using " uname -a".
If the kernel version is 5.3 or above, then check
#ls /sys/class/powercap/intel-rapl

If this folder is not present or kernel version is 5.2 or lower, then add option
"--workaround-enabled" to the thermald command line.

It is fine to leave the "--workaround-enabled" option for later kernels as it will be ignored.

But this option will only work on platforms with secure boot disabled and have
access to /dev/mem.

For some Lenovo systems, if the kernel version is less than 5.4 (best case for the kernel change to be accepted), also do
#modprobe msr

Step 7
Now run thermald from command line

#./thermald --no-daemon --loglevel=info --dbus-enable --workaround-enabled

It will print which configuration file is getting used. For example
"
[INFO]Using config file //etc/thermald/thermal-conf.xml.auto
"

Step 8
Run any workload you would like to, as long as it demands high performance. Or you can use "Stress".
#stress -c 8

Run it for a while.

If you don't get thermal shutdowns and if you are comfortable with the fan noise and heat it is generating, then the default configuration is right for you. If the default is not right for you, you have to manually find the best configuration file.
For example to pick a configuration file generated by the dptfxtrcat tool.

For example to pick " /etc/thermald/thermal-conf.xml.0":

#./thermald --no-daemon --loglevel=info --dbus-enable --config-file /etc/thermald/thermal-conf.xml.0

Repeat this step until you are satisfied with the thermal performance with the configuration file.

Step 9
If you want to monitor sensor temperatures in graphical display, there is a tool called "ThermalMonitor". This is submitted as part of the thermald.
https://github.com/intel/thermal_daemon/tree/master/tools/thermal_monitor
There is a procedure to build it in this folder. But since it involves Qt, this may be overwhelming for average users. So you can avoid this step.

Step 10
If you decided to change the default configuration file, then you need to edit the systemd unit file for the thermald service.
#systemctl status thermald.service
This shows the file location.
In my case
/usr/lib/systemd/system/thermald.service
You can add the --config-file with the desired config file to the line
ExecStart=

Then run
#systemctl daemon-reload

Then restart the thermald service and reboot.
#systemctl start thermald.service

