I installed Ubuntu 20.04 and have the following cpu:
grep -E '^model name|^cpu MHz' /proc/cpuinfo
model name : Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
cpu MHz : 3000.025
model name : Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
cpu MHz : 2721.680
model name : Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
cpu MHz : 2999.579
model name : Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
cpu MHz : 3000.027
model name : Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
cpu MHz : 2993.468
model name : Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
cpu MHz : 3000.568
model name : Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
cpu MHz : 2989.114
model name : Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
cpu MHz : 3001.278
I use the following command to set governor and frequency range:
sudo cpupower frequency-set --governor performance --min 2600000 --max 3000000
And the following command to verify it:
cpupower frequency-info
analyzing CPU 0:
driver: intel_pstate
CPUs which run at the same hardware frequency: 0
CPUs which need to have their frequency coordinated by software: 0
maximum transition latency: Cannot determine or is not supported.
hardware limits: 400 MHz - 4.00 GHz
available cpufreq governors: performance powersave
current policy: frequency should be within 2.60 GHz and 3.00 GHz.
The governor "performance" may decide which speed to use
within this range.
current CPU frequency: Unable to call hardware
current CPU frequency: 3.00 GHz (asserted by call to kernel)
boost state support:
Supported: yes
Active: yes
Current frequency is in specified range, this is true under no-load conditions.
However, after I start program (gmic) that loads cpu, current frequency drops below specified range:
cpupower frequency-info
analyzing CPU 0:
driver: intel_pstate
CPUs which run at the same hardware frequency: 0
CPUs which need to have their frequency coordinated by software: 0
maximum transition latency: Cannot determine or is not supported.
hardware limits: 400 MHz - 4.00 GHz
available cpufreq governors: performance powersave
current policy: frequency should be within 2.60 GHz and 3.00 GHz.
The governor "performance" may decide which speed to use
within this range.
current CPU frequency: Unable to call hardware
current CPU frequency: 1.80 GHz (asserted by call to kernel)
boost state support:
Supported: yes
Active: yes
Under Windows I run the same application and achieve much higher performance. Under no-load conditions frequency is around 1GHz, and under load frequency jumps to 2.6GHz. So I don't think it is hardware or bios related issue.
I rebooted Ubuntu to discard my cpu frequency changes (so they are defaults again). I will monitor cpu frequency and other important info with turbostat utility.
Here is turbostat output:
sudo turbostat --Summary --quiet --show Busy%,Bzy_MHz,IRQ,PkgWatt,PkgTmp,RAMWatt,GFXWatt --interval 5
Busy% Bzy_MHz IRQ PkgTmp PkgWatt GFXWatt RAMWatt
0.85 703 1663 45 1.22 0.00 0.00
0.81 654 1565 46 1.22 0.00 0.00
0.63 656 1338 45 1.19 0.00 0.00
0.74 664 1440 45 1.20 0.00 0.00
2.71 1650 2587 46 1.76 0.00 0.00
4.44 842 4362 46 1.53 0.00 0.00
5.35 1667 4806 46 2.45 0.00 0.00
5.47 831 4510 46 1.53 0.00 0.00
5.50 991 5130 47 1.68 0.00 0.00
2.73 1093 3055 48 1.48 0.00 0.00
2.49 1025 2780 57 1.47 0.00 0.00
2.28 2651 2098 47 2.53 0.00 0.00
1.35 1908 1685 47 1.63 0.00 0.00
1.03 1063 1823 47 1.29 0.00 0.00
1.41 995 2057 47 1.37 0.00 0.00
1.00 1003 1628 46 1.29 0.00 0.00
1.48 1132 1946 46 1.36 0.00 0.00
0.88 935 1488 46 1.25 0.00 0.00
1.13 957 1740 46 1.30 0.00 0.00
1.07 904 1660 46 1.28 0.00 0.00
2.85 895 3249 46 1.52 0.00 0.00
1.19 755 1686 46 1.25 0.00 0.00
2.25 1224 2992 70 1.57 0.00 0.00
# the moment program that loads cpu started
82.89 3703 13909 71 23.55 0.00 0.00
99.70 2589 11348 54 14.88 0.00 0.00
99.64 1960 11179 53 6.04 0.00 0.00
99.67 2122 11149 53 6.37 0.00 0.00
98.61 1851 11558 54 6.59 0.00 0.00
99.71 1577 11087 53 6.38 0.00 0.00
99.72 1546 11028 54 6.37 0.00 0.00
99.70 1740 11231 54 6.28 0.00 0.00
99.63 1945 11376 54 6.45 0.00 0.00
99.56 1939 11804 52 6.51 0.00 0.00
99.60 1949 11816 52 6.46 0.00 0.00
99.63 1971 11599 54 6.49 0.00 0.00
99.74 1833 11475 52 6.51 0.00 0.00
99.76 1711 11436 53 6.45 0.00 0.00
99.74 1800 11383 52 6.28 0.00 0.00
99.71 2117 11446 53 6.45 0.00 0.00
99.45 2031 11728 55 6.64 0.00 0.00
99.61 1646 11629 53 6.54 0.00 0.00
99.74 1562 11550 53 6.37 0.00 0.00
99.74 1599 11559 53 6.45 0.00 0.00
99.69 1670 11379 52 6.37 0.00 0.00
99.67 1866 11664 52 6.40 0.00 0.00
99.62 1963 11871 53 6.44 0.00 0.00
99.60 1961 11956 54 6.53 0.00 0.00
99.64 1919 11791 52 6.41 0.00 0.00
99.72 1831 11575 54 6.54 0.00 0.00
99.74 1794 11408 54 6.40 0.00 0.00
99.74 1802 11737 53 6.44 0.00 0.00
99.71 1991 11491 52 6.38 0.00 0.00
99.70 2005 11542 53 6.61 0.00 0.00
97.88 1706 11697 53 6.51 0.00 0.00
99.73 1571 12302 53 6.38 0.00 0.00
99.72 1550 12159 54 6.47 0.00 0.00
94.27 1650 12576 50 6.04 0.00 0.00
# the moment program that loads cpu terminated
3.03 827 3706 48 1.49 0.00 0.00
1.73 789 2349 47 1.32 0.00 0.00
2.88 818 3389 47 1.38 0.00 0.00
1.82 777 2359 46 1.27 0.00 0.00
1.74 730 2233 47 1.25 0.00 0.00
2.28 756 2906 46 1.31 0.00 0.00
2.59 813 2916 45 1.34 0.00 0.00
2.59 909 3089 46 1.39 0.00 0.00
2.32 752 3077 46 1.33 0.00 0.00
2.09 899 2738 45 1.31 0.00 0.00
1.79 808 2245 45 1.27 0.00 0.00
1.73 818 2126 44 1.26 0.00 0.00
1.78 808 2231 44 1.26 0.00 0.00
1.88 870 2320 45 1.31 0.00 0.00
Now I will execute the following command again:
sudo cpupower frequency-set --governor performance --min 2600000 --max 3000000
Let's see turbostat output under these conditions:
sudo turbostat --Summary --quiet --show Busy%,Bzy_MHz,IRQ,PkgWatt,PkgTmp,RAMWatt,GFXWatt --interval 5
Busy% Bzy_MHz IRQ PkgTmp PkgWatt GFXWatt RAMWatt
0.67 2999 2148 45 1.44 0.00 0.00
0.74 2999 2251 45 1.44 0.00 0.00
0.69 2999 2130 45 1.42 0.00 0.00
1.81 2998 3719 45 2.01 0.00 0.00
2.76 2993 5245 45 2.49 0.00 0.00
0.96 2997 3300 45 1.62 0.00 0.00
0.99 2996 3248 45 1.63 0.00 0.00
1.56 2988 4440 46 1.93 0.00 0.00
0.61 2999 2106 45 1.41 0.00 0.00
0.60 2998 2200 45 1.40 0.00 0.00
0.60 2974 2105 45 1.42 0.00 0.00
0.69 2958 2280 45 1.45 0.00 0.00
0.73 2976 2829 45 1.46 0.00 0.00
0.69 3000 2127 45 1.43 0.00 0.00
0.67 2998 2071 45 1.43 0.00 0.00
0.89 3000 2709 45 1.61 0.00 0.00
1.27 2997 3685 45 1.85 0.00 0.00
# the moment program that loads cpu started
11.67 3000 4679 58 3.48 0.00 0.00
99.74 3000 12823 70 14.83 0.00 0.00
99.69 3000 11618 64 16.38 0.00 0.00
99.69 2623 11406 54 9.63 0.00 0.00
95.83 1975 11912 56 6.35 0.00 0.00
99.02 1650 11763 53 6.36 0.00 0.00
99.73 1525 11397 54 6.34 0.00 0.00
99.73 1593 12664 53 6.32 0.00 0.00
99.67 1812 13476 52 6.40 0.00 0.00
99.63 1913 13013 53 6.39 0.00 0.00
99.51 1934 11901 54 6.48 0.00 0.00
99.62 1973 11892 52 6.44 0.00 0.00
99.70 1899 11586 54 6.59 0.00 0.00
99.76 1775 11497 54 6.45 0.00 0.00
99.76 1702 11638 54 6.40 0.00 0.00
99.71 1975 11709 53 6.28 0.00 0.00
99.69 2134 11636 53 6.52 0.00 0.00
99.37 1841 11991 53 6.66 0.00 0.00
99.66 1577 11541 53 6.43 0.00 0.00
99.69 1580 11430 53 6.38 0.00 0.00
99.73 1576 11357 53 6.43 0.00 0.00
99.69 1759 11356 52 6.34 0.00 0.00
99.62 1934 11787 53 6.46 0.00 0.00
99.49 1955 11894 52 6.50 0.00 0.00
99.63 1939 11815 52 6.48 0.00 0.00
99.70 1938 11668 53 6.48 0.00 0.00
99.75 1751 11530 54 6.47 0.00 0.00
99.75 1734 11578 53 6.45 0.00 0.00
44.89 1778 8422 49 3.88 0.00 0.00
# the moment program that loads cpu terminated
0.61 2997 2309 48 1.49 0.00 0.00
0.88 2999 4576 47 1.54 0.00 0.00
0.68 3000 1906 47 1.43 0.00 0.00
0.85 2995 2237 46 1.54 0.00 0.00
0.89 2987 2430 46 1.53 0.00 0.00
0.61 2989 2091 46 1.41 0.00 0.00
0.66 2934 1990 46 1.46 0.00 0.00
1.58 2980 4030 46 2.05 0.00 0.00
1.49 2995 4678 46 2.01 0.00 0.00
1.46 2991 4713 45 1.97 0.00 0.00
0.74 2994 2481 46 1.49 0.00 0.00
0.82 2999 3804 45 1.48 0.00 0.00
0.69 2997 2095 45 1.44 0.00 0.00
0.75 2997 2688 45 1.49 0.00 0.00
0.59 3000 1957 45 1.39 0.00 0.00
0.67 2996 2041 45 1.43 0.00 0.00
1.11 2999 3236 45 1.68 0.00 0.00
1.31 2997 3892 46 1.79 0.00 0.00
So it looks like Ubuntu is throttling cpu power consumption. Since it's not possible to stay under high load and within specified frequency range (when power consumption is cut), frequency drops to satisfy power constraint.
Now I reboot Ubuntu again, so cpu frequency goes to defaults.
I indeed was running thermald:
sudo service thermald status
● thermald.service - Thermal Daemon Service
Loaded: loaded (/lib/systemd/system/thermald.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2021-04-09 09:11:43 EEST; 9h ago
Main PID: 889 (thermald)
Tasks: 2 (limit: 19017)
Memory: 6.7M
CGroup: /system.slice/thermald.service
└─889 /usr/sbin/thermald --no-daemon --dbus-enable
кві 09 09:11:43 igor-HP-ProBook-450-G5 thermald[889]: [WARN]sensor id 16 : No temp sysfs for reading raw temp
кві 09 09:11:43 igor-HP-ProBook-450-G5 systemd[1]: Started Thermal Daemon Service.
кві 09 09:11:43 igor-HP-ProBook-450-G5 thermald[889]: [WARN]sensor id 16 : No temp sysfs for reading raw temp
кві 09 09:11:43 igor-HP-ProBook-450-G5 thermald[889]: I/O warning : failed to load external entity "/etc/thermald/thermal-conf.xml"
кві 09 09:11:43 igor-HP-ProBook-450-G5 thermald[889]: [WARN]error: could not parse file /etc/thermald/thermal-conf.xml
кві 09 09:11:43 igor-HP-ProBook-450-G5 thermald[889]: [WARN]sysfs open failed
кві 09 09:11:43 igor-HP-ProBook-450-G5 thermald[889]: I/O warning : failed to load external entity "/etc/thermald/thermal-conf.xml"
кві 09 09:11:43 igor-HP-ProBook-450-G5 thermald[889]: [WARN]error: could not parse file /etc/thermald/thermal-conf.xml
кві 09 09:11:43 igor-HP-ProBook-450-G5 thermald[889]: I/O warning : failed to load external entity "/etc/thermald/thermal-conf.xml"
кві 09 09:11:43 igor-HP-ProBook-450-G5 thermald[889]: [WARN]error: could not parse file /etc/thermald/thermal-conf.xml
So I stopped it (it did not solve cpu throttling issue):
sudo service thermald stop
And verified it's no longer active:
sudo service thermald status
● thermald.service - Thermal Daemon Service
Loaded: loaded (/lib/systemd/system/thermald.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Fri 2021-04-09 18:37:15 EEST; 2s ago
Process: 889 ExecStart=/usr/sbin/thermald --no-daemon --dbus-enable (code=exited, status=0/SUCCESS)
Main PID: 889 (code=exited, status=0/SUCCESS)
кві 09 09:11:43 igor-HP-ProBook-450-G5 thermald[889]: [WARN]sysfs open failed
кві 09 09:11:43 igor-HP-ProBook-450-G5 thermald[889]: I/O warning : failed to load external entity "/etc/thermald/thermal-conf.xml"
кві 09 09:11:43 igor-HP-ProBook-450-G5 thermald[889]: [WARN]error: could not parse file /etc/thermald/thermal-conf.xml
кві 09 09:11:43 igor-HP-ProBook-450-G5 thermald[889]: I/O warning : failed to load external entity "/etc/thermald/thermal-conf.xml"
кві 09 09:11:43 igor-HP-ProBook-450-G5 thermald[889]: [WARN]error: could not parse file /etc/thermald/thermal-conf.xml
кві 09 18:37:13 igor-HP-ProBook-450-G5 systemd[1]: Stopping Thermal Daemon Service...
кві 09 18:37:13 igor-HP-ProBook-450-G5 thermald[889]: [WARN]Terminating ...
кві 09 18:37:14 igor-HP-ProBook-450-G5 thermald[889]: [WARN]terminating on user request ..
кві 09 18:37:15 igor-HP-ProBook-450-G5 systemd[1]: thermald.service: Succeeded.
кві 09 18:37:15 igor-HP-ProBook-450-G5 systemd[1]: Stopped Thermal Daemon Service.
To collect the following data:
1. turbostat header
2. rdmsr (MSR_CORE_PERF_LIMIT_REASONS)
3. params in /sys/devices/system/cpu/intel_pstate directory
4. params in /sys/class/powercap/intel-rapl/intel-rapl:0 directory
5. scaling limits in /sys/devices/system/cpu/cpu*/cpufreq directory
I wrote the following script (collect_cpu_info.sh):
#!/bin/bash
exec_turbostat()
{
echo "turbostat --Summary --show Busy%,Bzy_MHz,IRQ,PkgWatt,PkgTmp,RAMWatt,GFXWatt --interval 0.001 --num_iterations 1"
turbostat --Summary --show Busy%,Bzy_MHz,IRQ,PkgWatt,PkgTmp,RAMWatt,GFXWatt --interval 0.001 --num_iterations 1
}
exec_rdmsr()
{
echo "rdmsr 0x64f"
rdmsr 0x64f
}
watch_intel_pstate()
{
echo "grep . /sys/devices/system/cpu/intel_pstate/*"
grep . /sys/devices/system/cpu/intel_pstate/*
}
watch_intel_rapl()
{
echo "grep . /sys/class/powercap/intel-rapl/intel-rapl:0/*"
grep . /sys/class/powercap/intel-rapl/intel-rapl:0/*
}
watch_cpufreq()
{
echo "grep . /sys/devices/system/cpu/cpu*/cpufreq/scaling_m*"
grep . /sys/devices/system/cpu/cpu*/cpufreq/scaling_m*
}
while sleep 5
do
echo "------------------------------------------------------------------------------------------------"
exec_turbostat
echo ""
exec_rdmsr
echo ""
watch_intel_pstate
echo ""
watch_intel_rapl
echo ""
watch_cpufreq
done
Let's run it (full log is not provided due to its size, I just will show load - no_load transition points):
<<< see log below in my next post, because post size is limited >>>
My laptop stays plugged in all the time, so on-battery related power limitations should not occur.
Do you know how to turn off cpu power constraint on Ubuntu? So cpu will consume max amount of power it needs to stay on high frequency. Any comments will be appreciated. Thank you.
grep . /sys/devices/system/cpu/intel_pstate/*
andgrep . /sys/devices/system/cpu/cpu*/cpufreq/scaling_m*
during these events also. I'll be back later.