5

Sometimes after putting my laptop to sleep it's CPU is locked to the slowest frequency - about 600-700MHz.

My laptop is Dell E6420 with i5-2520m.
Kernel version: 4.6.0-040600-generic.
I first came across this bug in 14.04 release. And now we have 16.04 and it's still there.

I am working on my laptop, everything is fine, quick and smooth. I close the lid, putting my laptop to sleep, disconnect power, it is sleeping on it's battery. I come back after some time, open the lid. And everything is slow as hell;D
I check cpu frequency using

watch -n 1 'cat /proc/cpuinfo | grep MHz'

and I see all my cores working on ~600Mgz frequency.

I check scaling governors

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

And I see 'powersave'.

To 'fix' this I have to do something like this

echo 'performance' > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo 'performance' > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
echo 'performance' > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor
echo 'performance' > /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor

After that everything is quick as before.

CPU scaling driver is intel_pstate checked with

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

I'm tired that I always have run this script. It's like I cannot rely on Ubuntu or my laptop(I don't know whose fault it is) anymore.

Why CPU is slow after sleep. Why does this happen? How to resolve this bug?

edwinksl
  • 23,789
justmatt
  • 111
  • 1
  • 1
  • 5

2 Answers2

4

The issue you have with your LapTop is a known problem with some Dell LapTops. When you resume from suspend on battery power, the Dell bios will set Clock Modulation to be used as a way to limit performance a little to save battery power. The problem is that the intel_pstate CPU frequency scaling driver, in its current form, is incompatible with Clock Modulation, and instead of limiting performance a little it drivers the CPU frequency hard down to below its normal lower limit.

The suggested solution for you is that you disable the intel_pstate driver, and use the acpi-cpufreq CPU frequency scaling driver instead. The acpi-cpufreq driver responds "properly" to Clock Modulation.

If you are using grub, then edit /etc/default/grub and change the GRUB_CMDLINE_LINUX_DEFAULT line. Example, where I have something else on that line:

GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1 intel_pstate=disable"

Be sure to run sudo update-grub afterwards. It is also good practice to save a copy of the original file before you edit it. Edit as sudo.

Doug Smythies
  • 15,448
  • 5
  • 44
  • 61
  • 1
    Thanks for explanation. I could change to acpi but with acpi I can't use full power of my CPU. On acpi it works ~2500MHz and on intel_pstate ~3000MHz. It seems like acpi can't utilize CPU's turbo funcionality. – justmatt Jun 22 '16 at 14:52
  • Yes, it uses turbo. The difference is that the acpi-cpufreq driver shows you the frequency that was asked for whereas the intel_pstate driver shows you the actual average frequency over the last sample interval. The only way to know for sure is to use turbostat. – Doug Smythies Jun 22 '16 at 16:01
0

In ubuntu 20.04 this bug is still here! I can restore normal operation by removing external power and plug it in again until cpufreq-info says a different than lowest cpu frequency.