(Lenovo x260 with Kubuntu 20.04) CPU stuck at 400MHz randomly CPU load at 100% - current CPU frequency: 400 MHz (asserted by call to kernel)

After installing Kubuntu 20.04 on my laptop, I have the problem that after some time, the CPU randomly gets stuck at 400MHz and doesn't step up resulting in very slow respond times. Surfing, or even writing a document becomes a pain.

I checked many pages (some reporting it might be a kernel bug) and tried different things like:

  • reinstalling the computer 6-8 times in total now (happens again after some days)

  • disable thermald service:

    systemctl disable thermald.service
    
  • disable intel_pstate in /etc/default/grub:

    GRUB_CMDLINE_LINUX_DEFAULT="intel_pstate=disable"
    
  • set the cpu governor to performance:

    GOVERNOR="performance"
    
  • set all CPUs to max:

    cpupower frequency-set -d `cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq`
    

    or

    cpupower frequency-set -d 2.5GHz
    
  • I installed the "Intel P-State and CPUFreq Manager" KDE Widget to monitor and adjust everything to high performance with no effect

    Processor settings

Hard and Software info:

$ cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_driver
intel_pstate
intel_pstate
intel_pstate
intel_pstate


$ cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
performance
performance
performance
performance

$ 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 - 3.10 GHz
  available cpufreq governors: performance powersave
  current policy: frequency should be within 3.10 GHz and 3.10 GHz.
                  The governor "performance" may decide which speed to use
                  within this range.
  current CPU frequency: Unable to call hardware
  current CPU frequency: 400 MHz (asserted by call to kernel)
  boost state support:
    Supported: yes
    Active: yes

$ grep "model name" /proc/cpuinfo
model name      : Intel(R) Core(TM) i7-6500U CPU @ 2.50GHz
model name      : Intel(R) Core(TM) i7-6500U CPU @ 2.50GHz
model name      : Intel(R) Core(TM) i7-6500U CPU @ 2.50GHz
model name      : Intel(R) Core(TM) i7-6500U CPU @ 2.50GHz

$ uname -a
Linux kubu 5.4.0-42-generic #46-Ubuntu SMP Fri Jul 10 00:24:02 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

Please help. I tried It's getting really frustrating and I don't know what else I can try :(


Solution 1:

I had the same exact problem on a Dell Latitude 7490; frequency getting stuck/pinned at 400Mhz randomly, sometimes after resume from suspend on battery, or when unplugging AC adapter. The problem also doesn't disappear with a hot reboot. I must power off the machine completely and turn it back on, or re-plug in the AC adapter. When the problem occurred, I did a hot-reboot to windows (as I am dual booting Kubuntu 20.04 and Windows 10), and found that windows 10 was also stuck at 400mhz frequency.

Finally it became apparent that is a hardware or firmware related issue. Latest BIOS as of date (BIOS dated feb 2021)

Did an RTC reset (RealTime Clock reset) as recommended in another post by dell but the problem comes back occasionally when unplugging AC Adapter. disabled C-states and Intel Speed Shift (leaving only SpeedStep enabled) in the BIOS, also problem still happening occasionally, so I re-enabled them.

Finally, I was able to find a software based workaround that doesn't require re-plugging in of AC adapter or cold boot.

Create script called cpufix in your path:

$ sudo nano /usr/local/bin/cpufix

with the following content:

#!/bin/bash

# Determinate CPU capabilities
MAX_CPU=$(cpupower frequency-info -l | tail -n1 | cut -d' ' -f2)

# Disable "BD PROCHOT" 
wrmsr -a 0x1FC 262238;

# Set and apply frequencies
cpupower frequency-set \
  -d $(expr $MAX_CPU / 4) \
  -u $MAX_CPU \
  -r \
  -g powersave;

Then set it as executable:

$ sudo chmod +x /usr/local/bin/cpufix

You can also change "powersave" in the last line above to "performance" if you want higher performance rather than normal powersaving profile when on battery operation.

When the issue occurs and you're pinned at 400Mhz frequency, just run:

$ sudo cpufix

In Windows (if you also dual boot), you can do similar with "Throttlestop" program, and uncheck the "BD PROCHOT" checkbox if it is checked (which is likely what happens when your CPU gets pinned at 400Mhz due to manufacturer firmware issue)