pyamsoft / pstate-frequency

Easily control Intel p-state driver on Linux
https://pyamsoft.blogspot.com/
GNU General Public License v2.0
172 stars 19 forks source link

Can't set cpu_max to 100% #24

Closed slorber closed 8 years ago

slorber commented 8 years ago

Hi,

Thanks for your useful tool. I've upgraded from Ubuntu 12.04 to 16.04 and since then it's really slower. I suspect the cpu scaling does not kick in properly on heavy load.

I've tried increasing the max with your command-line tool but did not get any succes:

$ sudo pstate-frequency -S -m 100
pstate-frequency version 3.3.3
    pstate::CPU_DRIVER   -> intel_pstate
    pstate::CPU_GOVERNOR -> performance
    pstate::TURBO        -> 0 [ON]
    pstate::CPU_MIN      -> 24% [800000KHz]
    pstate::CPU_MAX      -> 40% [1320000KHz]

(Actually it did work once but after stopped working and the cpu_max did go back to 40% on its own)

I've tried various combinations, and your tool does have some ffect, but any cpu_max above like 40% or 60% gets ignored. It is like there's some process that constantly overrides value set in /sys/devices/system/cpu/intel_pstate/max_perf_pct

Any idea on what could happen? I have killed thermald and acpi_thermal_pm but it didn't have any effect Note that it's hot in Paris today and my CPU is around 85°. Can it be a cause of that unability to apply the max.

For more background: link

pyamsoft commented 8 years ago

Are you running thermald? If so, is the Processor line enabled in thermald?

Thermald does some magic to hard set CPU max bounds and even though it is killed, the hard set lock will remain. This may be what you are experiencing, especially if you are manually attempting to write to the pstate directory.

Please try booting your system once with thermald completely disabled. See if the problem still exists. Try also booting once with the Processor line in thermald's configuration commented out and see if your CPU is still limited.

slorber commented 8 years ago

wow thanks for the quick answer :) I have tried by killing thermald and it didn't change. I've not tried to edit the thermald conf or reboot. I'm kind of new to all this stuff but will try asap

pyamsoft commented 8 years ago

thermald also has an intel_pstate line in its configuration which will take over handling the intel_pstate driver and set CPU frequencies as it sees fit.

As such, if you are running thermald in its default configuration, pstate-frequency will not have any effect on your system. pstate-frequency is a oneshot script, while thermald is a daemon which constantly monitors the system.

You can either uncomment the intel_pstate line in thermald and manually set frequencies with pstate-frequency, or you may forgo using pstate-frequency and just use thermald to handle your system.

Do note that if performance is a concern, the lines in the thermald configuration that are enabled by default may make a noticeable impact on your system performance. The lines for intel_powerclamp and Processor in particular can make significant impact on your system performance. This is of course, expected, as the system will need to make adjustments to account for heat.

If you believe thermald is being too aggressive in throttling your system performance, you may wish to take a look at your thermald configuration file. Mine, for reference, is located here.

I am not a thermald developer and some of the information I have stated above about thermald may be inaccurate. I am just a user, and am noting my experiences with the tool.

slorber commented 8 years ago

I have totally uninstalled thermald for now. I'm actually pretty sure I installed it today as an attempt to fix my problem so... I may put it back afterward as my computer gets hot easily but first I'd like to have my CPU running fast like before :)

After system boot I get:

sebastien@sebastien-xps:Desktop$ pstate-frequency -G
pstate-frequency version 3.3.3
    pstate::CPU_DRIVER   -> intel_pstate
    pstate::CPU_GOVERNOR -> performance
    pstate::TURBO        -> 0 [ON]
    pstate::CPU_MIN      -> 100% [3300000KHz]
    pstate::CPU_MAX      -> 100% [3300000KHz]

After generating some load I get:

pstate-frequency version 3.3.3
    pstate::CPU_DRIVER   -> intel_pstate
    pstate::CPU_GOVERNOR -> performance
    pstate::TURBO        -> 0 [ON]
    pstate::CPU_MIN      -> 80% [2640000KHz]
    pstate::CPU_MAX      -> 80% [2640000KHz]

It seems I'm able to set new high values:

sebastien@sebastien-xps:Desktop$ sudo pstate-frequency -S -m 100 -n 100
pstate-frequency version 3.3.3
    pstate::CPU_DRIVER   -> intel_pstate
    pstate::CPU_GOVERNOR -> performance
    pstate::TURBO        -> 0 [ON]
    pstate::CPU_MIN      -> 99% [3267000KHz]
    pstate::CPU_MAX      -> 100% [3300000KHz]

Looks like something is still in control but does not set values lower than 80% unlike before. Any idea?

At least one part seems (almost) solved.

The next part is probably not related to pstate-frequency but actually my CPU didn't get faster after these changes. On heavy load I'm still getting very low CPU frequencies. If you have any idea what could be the problem please tell :'(

capture du 2016-07-20 17-10-02

pyamsoft commented 8 years ago

Your system may be throttling itself to combat the heat generated by the machine.

The low 80s are hot, for a server or a laptop or any other kind of machine. This problem appears to be out of the scope of pstate-frequency itself.

You can attempt to re-install thermald and give it full control over the CPU frequency scaling of your machine. Just know that it will most likely throttle your machine a whole lot.

You can try and see if the problem goes away by booting with the old acpi-cpufreq driver. pstate-frequency in its latest release stable version (3.4.0 as of a minute ago) provides support for acpi-cpufreq. If the problem goes away using acpi-cpufreq, then it may be an issue with the intel_pstate driver on your system.

Unfortunately, this issue is beginning to seem like it is out of the scope of what I can support for pstate-frequency. Your tests above show that the script should still be correctly working (you can run it with debug flags -d to check this), so it is something that is out of my control which is causing your issue.

I would recommend you take a look at the physical hardware on the machine, your fans may need a cleaning.

slorber commented 8 years ago

Thanks. I guess you can't do anything more for me :'( This is weird because the more load I add, the more the frequency seems to lower itself (while the proc temperature is not really different)

pyamsoft commented 8 years ago

One thing that is interesting to note is what you stated was the default state after machine startup:

Both your min and max CPU frequencies display as 100%. This should not be the case if they were set by pstate-frequency, as there should be checks to guarantee that the two values will never be the same number.

Something with your machine itself may not be playing nicely with the CPU scheduling driver, it is admittedly strange that the machine will boot itself running at 100% of its performance with Turbo Boost enabled. Perhaps you would have better luck with the acpi-cpufreq driver.