7

I'm running kubuntu 15.10 on a Lenovo Y50-70, and I have a very annoying problem with the CPU clock: Whenever the computer resumes from sleep, the CPU clock has a lower maximum, and this does not happen only once, but after every resume the clock is slower, until it's down from initially 3.6 GHz to ~600 MHz.

alain@alain-Y50-70:~$ sudo -i
[sudo] password for alain: 
root@alain-Y50-70:~# 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: 0.97 ms.
  hardware limits: 800 MHz - 3.60 GHz
  available cpufreq governors: performance, powersave
  current policy: frequency should be within 800 MHz and 3.60 GHz.
                  The governor "powersave" may decide which speed to use
                  within this range.
  current CPU frequency is 817 MHz (asserted by call to hardware).
  boost state support:
    Supported: yes
    Active: yes
root@alain-Y50-70:~# cat /sys/devices/system/cpu/intel_pstate/max_perf_pct
100
root@alain-Y50-70:~# 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: 0.97 ms.
  hardware limits: 800 MHz - 3.60 GHz
  available cpufreq governors: performance, powersave
  current policy: frequency should be within 800 MHz and 2.88 GHz.
                  The governor "powersave" may decide which speed to use
                  within this range.
  current CPU frequency is 800 MHz (asserted by call to hardware).
  boost state support:
    Supported: yes
    Active: yes
root@alain-Y50-70:~# cat /sys/devices/system/cpu/intel_pstate/max_perf_pct
80
root@alain-Y50-70:~# cat /sys/devices/system/cpu/intel_pstate/max_perf_pct
60
root@alain-Y50-70:~# cat /sys/devices/system/cpu/intel_pstate/max_perf_pct
40
root@alain-Y50-70:~# cat /sys/devices/system/cpu/intel_pstate/max_perf_pct                                 
40                                                                                                         
root@alain-Y50-70:~# 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: 0.97 ms.                                                                     
  hardware limits: 800 MHz - 3.60 GHz                                                                      
  available cpufreq governors: performance, powersave                                                      
  current policy: frequency should be within 800 MHz and 1.44 GHz.                                         
                  The governor "powersave" may decide which speed to use                                   
                  within this range.                                                                       
  current CPU frequency is 699 MHz (asserted by call to hardware).                                         
  boost state support:                                                                                     
    Supported: yes                                                                                         
    Active: yes                                                                                            
root@alain-Y50-70:~# cat /sys/devices/system/cpu/intel_pstate/max_perf_pct                                 
40                                                                                                         
root@alain-Y50-70:~# 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: 0.97 ms.                                                                     
  hardware limits: 800 MHz - 3.60 GHz                                                                      
  available cpufreq governors: performance, powersave                                                      
  current policy: frequency should be within 800 MHz and 1.44 GHz.                                         
                  The governor "powersave" may decide which speed to use                                   
                  within this range.                                                                       
  current CPU frequency is 605 MHz (asserted by call to hardware).                                         
  boost state support:                                                                                     
    Supported: yes                                                                                         
    Active: yes                                                                                            
root@alain-Y50-70:~#                                                                                       

I put the computer asleep between the commands above. As you can see, first the max_perf_pct is reduced in steps until it reaches 40, then it stays 40 but the clock speed continues to be reduced. It doesn't matter if the laptop is plugged in or not, and the temperature is normal.

I think it may be related to this bug: https://bugzilla.kernel.org/show_bug.cgi?id=90421


The biggest problem is that I can't find a way to manually set the max clock back to 3.6 GHz. First I tried cpupower frequency-set -u 3.60GHz:

root@alain-Y50-70:~# cpupower frequency-set -u 3.60GHz
Setting cpu: 0
Setting cpu: 1
Setting cpu: 2
Setting cpu: 3
Setting cpu: 4
Setting cpu: 5
Setting cpu: 6
Setting cpu: 7
root@alain-Y50-70:~# 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: 0.97 ms.
  hardware limits: 800 MHz - 3.60 GHz
  available cpufreq governors: performance, powersave
  current policy: frequency should be within 800 MHz and 1.44 GHz.
                  The governor "powersave" may decide which speed to use
                  within this range.
  current CPU frequency is 699 MHz (asserted by call to hardware).
  boost state support:
    Supported: yes
    Active: yes
root@alain-Y50-70:~# cat /sys/devices/system/cpu/intel_pstate/max_perf_pct
40

but that seems to be the wrong way because the Intel P-State driver is used, so I tried echo 100 >/sys/devices/system/cpu/intel_pstate/max_perf_pct with no effect:

root@alain-Y50-70:~# echo 100 >/sys/devices/system/cpu/intel_pstate/max_perf_pct
root@alain-Y50-70:~# 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: 0.97 ms.
  hardware limits: 800 MHz - 3.60 GHz
  available cpufreq governors: performance, powersave
  current policy: frequency should be within 800 MHz and 1.44 GHz.
                  The governor "powersave" may decide which speed to use
                  within this range.
  current CPU frequency is 700 MHz (asserted by call to hardware).
  boost state support:
    Supported: yes
    Active: yes
root@alain-Y50-70:~# cat /sys/devices/system/cpu/intel_pstate/max_perf_pct
40

I also tried the performance governor, with no success.

How can I set the maximum clock frequency back to 3.6 GHz?

alain
  • 215
  • 1
  • 6
  • Weird, I'm having the exact same issue on Arch Linux on my Lenovo Y50-70! It has been working fine up until a week or so ago. I thought that it is something with the kernel because I use Liquorix patchset (I have encountered the issue on 4.4.3 kernel and it is still present in 4.4.4). Which kernel do you use? Actually, I don't believe I am affected by the bug you point in the bugzilla since it used to work fine two weeks ago and before that. – Vlad Frolov Mar 12 '16 at 13:59
  • I use 4.2.0-30-generic #36-Ubuntu SMP Fri Feb 26 00:58:07 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux. I'm not sure when this problem started. – alain Mar 12 '16 at 14:04
  • One the second read, it seems that the issue on the bugtracker and the mentioned precedent issue https://bugzilla.kernel.org/show_bug.cgi?id=66581 are exactly what I see on my end. Have you tried to do wrmsr 0x19a 0 as described in this thread https://bbs.archlinux.org/viewtopic.php?id=199922 ? (It haven't helped me, but some people report that it worked for them.) – Vlad Frolov Mar 12 '16 at 14:39
  • Thanks for the suggestion @VladFrolov rdmsr returned 8, after wrmsrit's 0, but the frequencies are still the same unfortunately. – alain Mar 12 '16 at 17:09
  • Reading 8 from that register means clock modulation is not enabled. – Doug Smythies Mar 13 '16 at 00:13
  • There is a kernel bugreport now: https://bugzilla.kernel.org/show_bug.cgi?id=114551 – Vlad Frolov Mar 15 '16 at 06:07
  • See also here, which @VladFrolov has been posting to. – Doug Smythies Mar 15 '16 at 07:07

2 Answers2

6

The issue you are experiencing has been reported many times.
Please refer to this bugzilla bug report.

The issue has been isolated to a particular commit in the kernel tree. That commit has also been backported to some previous stable kernel versions.
However, the actual real root cause is a Lenovo BIOS problem. Quoting from the linux-pm e-mail thread:

BIOS reports bogus passive trip point value, which is 0 degree Celsius ... In order to workaround this bogus BIOS, we should disable those invalid trip points by checking the trip point value,

If you go back a version of or two, your Lenovo will work properly (4.2.0-19 is known to work properly).

Your issue is not clock modulation (register 0x19A) related, unless your battery is below 30% (unproven, but suspected).

References:
http://ubuntuforums.org/showthread.php?t=2316101
Strange cpufreq scaling issues: regardless of governor, max cpufreq drops incrementally on wake
i3 throttled at 500Mhz when battery under 30%
http://marc.info/?t=145816738700001&r=1&w=2

Doug Smythies
  • 15,448
  • 5
  • 44
  • 61
  • I have tested 4.4.5 and 4.5.0-rc7 kernel on my Arch Linux on Lenovo Y50-70. The issue is still there. I'm going to try 4.4.0 since I haven't seen this issue a week ago, and if it doesn't help, I will try 4.3.0 and 4.2.0. – Vlad Frolov Mar 13 '16 at 03:31
  • Yes, I understand the issue persists through kernel 4.5-rc7. See the Ubuntu forums reference. – Doug Smythies Mar 13 '16 at 05:48
  • Thanks, yes, older kernels seem to work. I tested 4.2.0-19, 4.2.0-21 and even 4.2.0-27 is ok, so it seems to have been introduced with 4.2.0-30. Do you know if there is a bug report already? – alain Mar 13 '16 at 10:27
  • For me, 4.4.0, 4.4.1, 4.4.2, and 4.4.3 are working fine! The regression appears in 4.4.4, and lives on in 4.4.5 and 4.5-rc7 for me. I guess, that Ubuntu backported something from 4.4.4 patchset... – Vlad Frolov Mar 13 '16 at 12:30
  • @alain According to Ubuntu changelog http://changelogs.ubuntu.com/changelogs/pool/main/l/linux/linux_4.2.0-30.36/changelog, there were just a few patches in 4.2.0-30.36, 4.2.0-30.35, and 4.2.0-29, but there is a long list of patches in 4.2.0-28. It would be great if you could try two of those left (4.2.0-28 and 4.2.0.-29). I have tried to revert some patches from 4.4.4 patchset, but I haven't succeeded in guessing. Once you find the specific Ubuntu patchset causing troubles, we can compare mainline 4.4.4 and Ubuntu backports patchsets to find the black sheep. – Vlad Frolov Mar 13 '16 at 14:43
  • @VladFrolov There is only 4.2.0-30 and 4.2.0-27 in the ubuntu repos, do I need to add a ppa to get 4.2.0-28? (Sorry I'm a noob on linux) – alain Mar 13 '16 at 15:03
  • I am not aware of an existing bug report, and I have looked. @VladFrolov: Thanks for narrowing it down somewhat, and yes I suspect the original issue has been backported. – Doug Smythies Mar 13 '16 at 15:04
  • If not changing to a full git bisect of the kernel, then consider to try the mainline PPA to attempt to isolate the issue further. However, in the end there is no way to avoid having to do a bisect, although sometimes help for that is available via the bug report. – Doug Smythies Mar 13 '16 at 15:11
0

Try switching the governor and using 'performance'.
Instructions on this page: https://www.perl.com/article/fixing-a-sluggish-linux-after-suspend-resume/