PHC-intel not working after resume from suspend

If you have trouble with PHC you can ask and hope for help here.
Post Reply
Dreemz
Posts: 3
Joined: Tue 14. Apr 2015, 02:32

PHC-intel not working after resume from suspend

Post by Dreemz » Tue 14. Apr 2015, 03:14

I use Lubuntu 14.04 on Thinkpad T61 Core 2 Duo T7700 @ 2.40GHz.

Kernel 3.13.0-45-generic.

I use PHC-intel module together with TLP.

Code: Select all

$ uname -a
Linux dreemz 3.13.0-45-generic #74-Ubuntu SMP Tue Jan 13 19:37:48 UTC 2015 i686 i686 i686 GNU/Linux

$  cat /proc/cpuinfo | grep 'model name' | uniq
model name	: Intel(R) Core(TM)2 Duo CPU     T7700  @ 2.40GHz

$ cat /sys/devices/system/cpu/cpu*/cpufreq/phc_version
0.3.2:3
0.3.2:3

$ sudo tlp-stat
--- TLP 0.7 --------------------------------------------
Problem: PHC usually does NOT lower the temperature after I resume from suspend. It sometimes does, but I was not able to find some pattern for this behavior. It might be working properly more often when I don't connect the wired ethernet when I resume from suspend, and only after the computer is back from suspend I connect the ethernet. But this does not work 100% of the times.

I can clearly tell when PHC does affect the temperature, since the difference is about 20 degrees celsius.

After reboot, PHC always does lower the temperature.

The strange thing is that when PHC seems to not lower the temperature, the shell tells me that everything seems to be loaded properly:

Code: Select all

$ sudo tlp-stat | grep phc
/proc/cmdline  = BOOT_IMAGE=/boot/vmlinuz-3.13.0-45-generic root=UUID=cd89c919-88f1-42af-89ab-599964556ade ro persistent quiet splash cpufreq_driver=phc-intel vt.handoff=7
/sys/devices/system/cpu/cpu0/cpufreq/scaling_driver    = phc-intel
/sys/devices/system/cpu/cpu1/cpufreq/scaling_driver    = phc-intel
/sys/devices/system/cpu/cpu0/cpufreq/phc_controls          = 13:38 12:32 10:22 8:0 6:0 136:0 
/sys/devices/system/cpu/cpu0/cpufreq/phc_default_controls  = 13:47 12:43 10:37 8:30 6:23 136:15 
/sys/devices/system/cpu/cpu1/cpufreq/phc_controls          = 13:38 12:32 10:22 8:0 6:0 136:0 
/sys/devices/system/cpu/cpu1/cpufreq/phc_default_controls  = 13:47 12:43 10:37 8:30 6:23 136:15 

$ lsmod | grep phc
phc_intel              20069  1

$ cat /sys/devices/system/cpu/cpu*/cpufreq/phc_controls
13:38 12:32 10:22 8:0 6:0 136:0 
13:38 12:32 10:22 8:0 6:0 136:0

$ cat /sys/devices/system/cpu/cpu*/cpufreq/phc_vids
38 32 22 0 0 0 
38 32 22 0 0 0 
Any ideas what might go wrong here?

lio
Posts: 87
Joined: Wed 2. Mar 2011, 18:37

Re: PHC-intel not working after resume from suspend

Post by lio » Thu 16. Apr 2015, 21:39

Hi,

It's a known issue. See for example: http://www.linux-phc.org/forum/viewtopic.php?f=8&t=206 - Just reapply the voltage settings on resume.

leo

Dreemz
Posts: 3
Joined: Tue 14. Apr 2015, 02:32

Re: PHC-intel not working after resume from suspend

Post by Dreemz » Fri 17. Apr 2015, 03:07

Thanks,

First as I said, although after resume from suspend I do not see the temperature fall, still the shell shows that the values are correct (i.e. not the default values). In that case why would it help to reset the undervolted values?

Anyway I have just did

Code: Select all

$ sudo echo "38 32 22 0 0 0" > /sys/devices/system/cpu/cpu0/cpufreq/phc_vids && sudo echo "38 32 22 0 0 0" > /sys/devices/system/cpu/cpu1/cpufreq/phc_vids
And checked:

Code: Select all

$ cat /sys/devices/system/cpu/cpu*/cpufreq/phc_vids
38 32 22 0 0 0 
38 32 22 0 0 0 
No luck. No drop in the temperature.

Any other ideas or checks that I should do?

Is there any way to restart/reload the module without restarting the computer?

As I said, the module does work on this machine. But usually only after reboot.

lio
Posts: 87
Joined: Wed 2. Mar 2011, 18:37

Re: PHC-intel not working after resume from suspend

Post by lio » Sun 19. Apr 2015, 11:30

Dreemz wrote:First as I said, although after resume from suspend I do not see the temperature fall, still the shell shows that the values are correct (i.e. not the default values). In that case why would it help to reset the undervolted values?
Because the shell is a lie. At least in this case. On suspend, cores are put offline and when they are brought back online during resume, their settings are back to factory default. This includes changes made by phc. However, on suspend to RAM one core stays awake and so keeps its settings. After resume from suspend to RAM or disk you have to reapply phc-settings or the CPU will run on factory defaults until shutdown/reboot.

You can check the actual values e.g. with read_msr.py which you can find in the download section. http://www.linux-phc.org/forum/download/file.php?id=7 `modprobe msr` if it complains about not beeing able to do its job and run the script as root.

Code: Select all

$ sudo echo "38 32 22 0 0 0" > /sys/devices/system/cpu/cpu0/cpufreq/phc_vids && sudo echo "38 32 22 0 0 0" > /sys/devices/system/cpu/cpu1/cpufreq/phc_vids
Have you been root doing this? If yes: you don't need to sudo. if no: you should have seen a error message because the redirection to sysfs is not done through sudo but with you current shell. Which should not have permission to write to sysfs.
Is there any way to restart/reload the module without restarting the computer?
`modprobe -r phc-intel && modprobe phc-intel`

lio

Dreemz
Posts: 3
Joined: Tue 14. Apr 2015, 02:32

Re: PHC-intel not working after resume from suspend

Post by Dreemz » Sun 19. Apr 2015, 15:05

Thanks!

Here is a typical output of read_msr.py, when I run it after resuming from suspend (when I don't notice any drop in the temperature):

Code: Select all

# python read_msr.py 
MSRTOOL V0.1 started...

Displaying data for CPU cpu0
/---------------------------------------
| Current VID: 32
| Current FID: 12
| Target VID:  32
| Target FID:  12
| Highest VID: 43
| Highest FID: 12
| Lowest VID:  23
| Lowest FID:  6
\---------------------------------------



Displaying data for CPU cpu1
/---------------------------------------
| Current VID: 32
| Current FID: 12
| Target VID:  0
| Target FID:  136
| Highest VID: 43
| Highest FID: 12
| Lowest VID:  23
| Lowest FID:  6
\---------------------------------------

I am not sure how to interpret these numbers... what can I learn from them about the status of phc-intel?

Code: Select all

$ sudo echo "38 32 22 0 0 0" > /sys/devices/system/cpu/cpu0/cpufreq/phc_vids && sudo echo "38 32 22 0 0 0" > /sys/devices/system/cpu/cpu1/cpufreq/phc_vids
Have you been root doing this? If yes: you don't need to sudo.
You are correct. I ran it as root but forgot to mention this. And of course in this case sudo is not required.
But more importantly - is this what you meant by saying that after resuming from suspend, "I have to reapply phc-settings"?

And regarding trying to reload the phc-intel module (I ran it as root):

Code: Select all

# modprobe -r phc-intel && modprobe phc-intel
modprobe: FATAL: Module cpufreq_stats is builtin.
modprobe: FATAL: Error running remove command for phc_intel
This is something that I tried in the past but could not figure out what is going on. I do not try to remove cpufreq_stats. And why would phc_intel not be removed?

lio
Posts: 87
Joined: Wed 2. Mar 2011, 18:37

Re: PHC-intel not working after resume from suspend

Post by lio » Sun 19. Apr 2015, 17:16

Dreemz wrote:

Code: Select all

Displaying data for CPU cpu1
/---------------------------------------
| Target FID:  136
\---------------------------------------
I didn't see it before: a strange target FID of 136. You should try phc-0.4.0 and test again. And please try read_msr.py 0.2 http://www.linux-phc.org/forum/viewtopic.php?f=13&t=13
However it looks like the settings were applied after resume. If you didn't do it I would bet on TLP. It would be nice to have phc working without influence by TLP for the moment. Just to be sure.

Code: Select all

$ sudo echo "38 32 22 0 0 0" > /sys/devices/system/cpu/cpu0/cpufreq/phc_vids && sudo echo "38 32 22 0 0 0" > /sys/devices/system/cpu/cpu1/cpufreq/phc_vids
But more importantly - is this what you meant by saying that after resuming from suspend, "I have to reapply phc-settings"?
Exactly.
This is something that I tried in the past but could not figure out what is going on. I do not try to remove cpufreq_stats. And why would phc_intel not be removed?
Ah right, Ubuntu. They baked the cpufreq-stuff into the kernel. Off-hand I don't know another way.

lio

Post Reply