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

Default plan on Arch installation causes bad CPU performance on laptops #31

Closed pecigonzalo closed 6 years ago

pecigonzalo commented 6 years ago

The default configuration of the service/udevd makes it so by default it uses 00-auto.plan which in term uses 01-powersave.plan. The problem is this plan sets PLAN_CPU_MAX=0 on many cases resulting on max Mhz being = to the min Mhz. I dont believe this is the desired configuration for anyone as in most systems it will make the laptop unresponsive.

pyamsoft commented 6 years ago

Hello,

Can you run the auto plan with debugging enabled so I can see the output of your machine?

pstate-frequency -dd -Sp auto

It could be a regression with automatic plan setting.

On Nov 11, 2017 06:51, "Gonzalo Peci" notifications@github.com wrote:

The default configuration of the service/udevd makes it so by default it uses 00-auto.plan which in term uses 01-powersave.plan. The problem is this plan sets PLAN_CPU_MAX=0 on many cases resulting on max Mhz being = to the min Mhz. I dont believe this is the desired configuration for anyone as in most systems it will make the laptop unresponsive.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/pyamsoft/pstate-frequency/issues/31, or mute the thread https://github.com/notifications/unsubscribe-auth/AG7kgvYmO8c5Ov4ozeoLUBBI5hfx-u4xks5s1bSCgaJpZM4Qag5e .

pecigonzalo commented 6 years ago
sudo pstate-frequency -dd -Sp auto
VERBOSE: parse short option: -d
DEBUG: __log_level more verbose
VERBOSE: parse short option: -S
DEBUG: Set operation exec_mode to SET
VERBOSE: parse short option: -p
DEBUG: Attempt to set plan
DEBUG: set_power_plan requires SET operation exec_mode
DEBUG: Search the config directory '/etc/pstate-frequency.d/' for power plan configrations
VERBOSE: Sourcing config from location: /etc/pstate-frequency.d//00-auto.plan
VERBOSE: Set power plan to: auto
VERBOSE: Sourcing config from location: /etc/pstate-frequency.d//01-powersave.plan
VERBOSE: Attempt manual plan setting: powersave
DEBUG: set_max requires SET operation exec_mode
VERBOSE: Set max_value to '0'
DEBUG: Check that '0' is all digits
DEBUG: '0' is all digits
VERBOSE: Bound value '0' between 11 and 100
DEBUG: __exec_set_max_arg: '11'
DEBUG: set_min requires SET operation exec_mode
VERBOSE: Set min_value to '0'
DEBUG: Check that '0' is all digits
DEBUG: '0' is all digits
VERBOSE: Bound value '0' between 10 and 99
DEBUG: __exec_set_min_arg: '10'
DEBUG: set_governor requires SET operation exec_mode
VERBOSE: Set governor_value to 'powersave'
DEBUG: Check that 'powersave' is not digits
DEBUG: 'powersave' is not digits
DEBUG: __exec_set_governor_arg: 'powersave'
DEBUG: set_turbo requires SET operation exec_mode
DEBUG: Check for special case arguments: on, off
VERBOSE: Argument was 'off' set to 1
DEBUG: Check that '1' is valid
DEBUG: '1' is valid digit
DEBUG: __exec_set_turbo_arg: '1'
VERBOSE: exec_mode: SET
set_max: 1 [11]
set_min: 1 [10]
set_turbo: 1 [1]
set_governor: 1 [powersave]
VERBOSE: YOU ARE ROOT
DEBUG: Check that we are setting something
DEBUG: Check if we are setting max
DEBUG: Set max to arg
DEBUG: Check if we are setting min
DEBUG: Set min to arg
DEBUG: Check if we are setting turbo
DEBUG: Set turbo to arg
DEBUG: Check if we are setting governor
DEBUG: Set governor to arg
DEBUG: Check that min is not >= max
DEBUG: Check that max is not <= min
VERBOSE: setting_cpu_max: 11
VERBOSE: setting_cpu_min: 10
VERBOSE: setting_cpu_turbo: 1
VERBOSE: setting_cpu_governor: powersave
DEBUG: Set actual values
VERBOSE: Write cpu_governor 'powersave' to all CPUs
VERBOSE: Write governor: 'powersave' to file: /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
DEBUG: Governor 'powersave' written to /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
VERBOSE: Write governor: 'powersave' to file: /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
DEBUG: Governor 'powersave' written to /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
VERBOSE: Write governor: 'powersave' to file: /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor
DEBUG: Governor 'powersave' written to /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor
VERBOSE: Write governor: 'powersave' to file: /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor
DEBUG: Governor 'powersave' written to /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor
VERBOSE: Write max_value '11' to intel_pstate file: /sys/devices/system/cpu/intel_pstate/max_perf_pct
DEBUG: Max value written to /sys/devices/system/cpu/intel_pstate/max_perf_pct
DEBUG: Bound 418000 between 400000 and 3800000
VERBOSE: Write freq: 418000KHz to file: /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
DEBUG: Max value written to /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
VERBOSE: Write freq: 418000KHz to file: /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq
DEBUG: Max value written to /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq
VERBOSE: Write freq: 418000KHz to file: /sys/devices/system/cpu/cpu2/cpufreq/scaling_max_freq
DEBUG: Max value written to /sys/devices/system/cpu/cpu2/cpufreq/scaling_max_freq
VERBOSE: Write freq: 418000KHz to file: /sys/devices/system/cpu/cpu3/cpufreq/scaling_max_freq
DEBUG: Max value written to /sys/devices/system/cpu/cpu3/cpufreq/scaling_max_freq
VERBOSE: Write min_value '10' to intel_pstate file: /sys/devices/system/cpu/intel_pstate/min_perf_pct
DEBUG: Min value written to /sys/devices/system/cpu/intel_pstate/min_perf_pct
DEBUG: Bound 380000 between 400000 and  3800000
VERBOSE: Write freq: 400000KHz to file: /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
DEBUG: Min value written to /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
VERBOSE: Write freq: 400000KHz to file: /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq
DEBUG: Min value written to /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq
VERBOSE: Write freq: 400000KHz to file: /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq
DEBUG: Min value written to /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq
VERBOSE: Write freq: 400000KHz to file: /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq
DEBUG: Min value written to /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq
VERBOSE: Write turbo_value '1' to intel_pstate file: /sys/devices/system/cpu/intel_pstate/no_turbo
DEBUG: Turbo value written to /sys/devices/system/cpu/intel_pstate/no_turbo
pstate-frequency version 3.9.2
    pstate::CPU_DRIVER   -> intel_pstate
    pstate::CPU_GOVERNOR -> powersave
    pstate::TURBO        -> 1 [OFF]
    pstate::CPU_MIN      -> 10% [400000KHz]
    pstate::CPU_MAX      -> 11% [418000KHz]
DEBUG: Exit: Success

CPU_MAX is set to 11% as you can see

I think its related to this file config: https://github.com/pyamsoft/pstate-frequency/blob/master/res/plans/01-powersave.plan

pyamsoft commented 6 years ago

Thanks for the update.

When you run the script, is your machine connected to the AC power adapter, or are you on battery power?

pyamsoft commented 6 years ago

The powersave plan by default sets everything to the lowest performance value, which for your machine is 11% of the max CPU frequency.

The plan is performing as expected, if the minimum value is too low for your purposes, you can edit the powersave plan to a more sane CPU_MAX value, such as 30 or 40%.

Alternatively, you can edit the auto plan to call the balanced plan on both AC and battey.

pecigonzalo commented 6 years ago

I understand I can change it, and that is what I did. I know its working as intended with those settings, im not saying its a bug of the software, but I dont think anyone wants a CPU at CPU_MAX=11% or similar. I dont see anyone wanting to run at 400 or 800 Mhz by default. Maybe the default for auto should be balanced or the powersave should set it to 30% by default.

Thoughts?

pyamsoft commented 6 years ago

The latest version which is 3.9.4 will default to the AC plan if no battery is found on the machine.

I will think about bumping the minimum

pyamsoft commented 6 years ago

Think I'll bump the shipped minimum to 50.

Now that modern processors have become so efficient, they are mostly able to handle themselves.

A minimum of 50 should give reasonale performance for a machine on battery where the general goal is to be as idle as possible to conserve energy.

Hope this will help.

pecigonzalo commented 6 years ago

That sounds great, in my experience anything that disabled turbo with balance_power p state profile is normally great for battery. 50 should keep the system responsive while providing good saving benefits

pyamsoft commented 6 years ago

3.9.6

powersave default CPU_MAX is now set as 50.

In the future I will try to add support for a syntax such as +n for example +30 which will mean 30 higher than the CPU_MIN. This should allow for more dynamic system configuration.