7

I spent hours searching for an answer in Internet. All I could find doesn't help. I have Intel i9-9980HK, running under Ubuntu 20.04, kernel 5.4.0-33.

The problem is that under the full load the CPU lowers the frequency to 2.7 GHZ, I guess in order to stay under low power budget. Whatever I try I can't make it run faster. It stays under 65C, quietly and slowly crunching numbers. For comparison the same machine under Windows runs from 3 to 4+ GHz under the full load.

What I tried:

  • Change the governor to performance. No effect.
  • Set /sys/devices/system/cpu/cpufreq/policyX/energy_performance_preference to performance. No effect.
  • sudo service thermald stop. No effect.
  • Increase /sys/devices/system/cpu/intel_pstate/turbo_pct. Access denied even for root.
  • Increase /sys/devices/system/cpu/cpufreq/policyX/scaling_min_freq. No effect.

I am lost. What does it want? Btw, /sys/devices/system/cpu/intel_pstate/status is active.

Update. I think I know the reason. When intel_pstate is active, it ignores all the settings (like governor, everything under /sys/devices/system/cpu/cpufreq). Tools like cpupower cannot control intel_pstate. So the question pretty much boils down to how control intel_pstate driver.

facetus
  • 218
  • 2
  • 10
  • did you check BIOS for overclocking? also take a look at ```tlp-stat``` command... – Akhil Jun 19 '20 at 03:57
  • Most settings in BIOS are locked, as usual for laptops. Settings in BIOS would have influenced Windows as well, right? In Windows I can easily adjust the performance. So the reason is not in BIOS settings. Besides, it's not overclocking, I cannot set the regular modes. – facetus Jun 19 '20 at 06:43
  • I am using ```tlp``` service for this.give it a try. ```CPU_SCALING_GOVERNOR_ON_AC=performance``` – Akhil Jun 19 '20 at 06:54
  • 1
    https://askubuntu.com/questions/1021748/set-cpu-governor-to-performance-in-18-04 – Akhil Jun 19 '20 at 07:04
  • Note that your processor's base frequency is 2.4 GHz. Anything over that is burst frequency. [See here](https://ark.intel.com/content/www/us/en/ark/products/192990/intel-core-i9-9980hk-processor-16m-cache-up-to-5-00-ghz.html). So this higher power is only used when there is thermal headroom. Does it *sound* like it's working hard, does the CPU fan spin up to fully? What temp does it get to under Windows at max usage? – Philip Couling Jun 19 '20 at 07:05
  • @AkhilJ I saw that. I mentioned in the message that changing the governor doesn't help. – facetus Jun 19 '20 at 08:31
  • @PhilipCouling It doesn't work fully. The temperature is just 65 degree C. `turbo_pct` is just 60. The fan noise is moderately quiet. It works much faster in Windows. – facetus Jun 19 '20 at 08:34
  • CPU base frequency is just a frequency where the TDP is defined. It's just a point on a frequency curve for a particular p-state. Base frequency doesn't mean that frequencies higher are somewhat overclocking, unusual, untypical use, should be avoided, etc. – facetus Jun 19 '20 at 08:41
  • @facetus I believe you I was just wondering if somehow the fan wasn't kicking in enough to cool the CPU enough. You say "only" 65 but that gives nothing to compare to what it is in windows. I don't know what your CPU should be limited to. – Philip Couling Jun 19 '20 at 08:46
  • Throttle temperature is the same for all CPUs and is slightly below 100. 65 means way below the available budget. – facetus Jun 19 '20 at 08:48
  • Also since it is quiet stable at 65, I believe it's some software or hardware piece that specifically stabilizes the CPU at this level. – facetus Jun 19 '20 at 08:52

2 Answers2

4

The solution turned out to be to pass intel_pstate=passive to kernel. Then intel_pstate relinquishes control back to CPUFreq. The latter still uses intel_pstate to govern the CPU, but intel_pstate has no say in what to do. After that, you can finally set performance policies. Your laptop can be either completely quiet or you can make it very noisy, but powerful. When intel_pstate is active, the machine is neither quiet nor well performing, but rather always slow and noisy.

Two years later update

It turned out there is more to the story. The computer in question was a Gigabyte laptop. When I got a new laptop, also from Gigabyte, a trick with intel_pstate=passive didn't help. I started digging deeper and found out that (i) Gigabyte's firmware limits the performance if the laptop is running on anything but Windows. ACPI knows the OS it is running on via _OSI. Not only that, but you see, usually laptop manufacturers contribute to the Linux kernel and write a small driver, specific to the vendor, that helps to monitor the system and manage the performance. If you look in the kernel source code, you will find a lot of them in drivers/platform/x86, for Dell, HP, ASUS, Lenovo, Fujitsu... Well, (ii) Gigabyte has done nothing on this front. The first problem can be solved by passing acpi_os_name="Windows 2015" to the kernel. The performance will become better. However, to really make a Gigabyte laptop usable on Linux, somebody has to write a kernel driver for it. There is a user-space workaround, used in this project, that utilizes a debug feature of the kernel and writes value directly to the embedded controller registers. It's dangerous and requires undocumented information about the EC. What one should do instead is to call WMI's ACPI methods from the firmware.

facetus
  • 218
  • 2
  • 10
0

As mentioned on the comment this question have a lot of information on how to change the CPU settings.

Why is it called "ondemand", but it sets other governors (for example with the intel_pstate driver it will set the powersave governor)? Because this tool pre-dates the intel_pstate driver, back to a time when, by far, the dominant frequency scaling driver was the acpi-cpufreq driver, and "ondemand" was the preferred Ubuntu default governor.

Intel Pstate: is a part of the CPU performance scaling subsystem in the Linux kernel (CPUFreq). It is a scaling driver for the Sandy Bridge and later generations of Intel processors. Note, however, that some of those processors may not be supported. To understand intel_pstate it is necessary to know how CPUFreq works in general, so this is the time to read CPU Performance Scaling if you have not done that yet.

You can add intel_pstate=disable in your kernel book parameter to disable it, more details here.

Marc
  • 11
  • 9
  • "this is the time to read CPU Performance Scaling if you have not done that yet" — I read all of this and tried everything suggested, except turning off `intel_pstate`. – facetus Jun 20 '20 at 07:08