• Pali Rohár's avatar
    cpufreq: intel_pstate: Fix setting max_perf_pct in performance policy · 36b4bed5
    Pali Rohár authored
    Code which changes policy to powersave changes also max_policy_pct based on
    max_freq. Code which change max_perf_pct has upper limit base on value
    max_policy_pct. When policy is changing from powersave back to performance
    then max_policy_pct is not changed. Which means that changing max_perf_pct is
    not possible to high values if max_freq was too low in powersave policy.
    
    Test case:
    
    $ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
    800000
    $ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
    3300000
    $ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
    performance
    $ cat /sys/devices/system/cpu/intel_pstate/max_perf_pct
    100
    
    $ echo powersave > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
    $ echo 800000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
    $ echo 20 > /sys/devices/system/cpu/intel_pstate/max_perf_pct
    
    $ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
    powersave
    $ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
    800000
    $ cat /sys/devices/system/cpu/intel_pstate/max_perf_pct
    20
    
    $ echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
    $ echo 3300000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
    $ echo 100 > /sys/devices/system/cpu/intel_pstate/max_perf_pct
    
    $ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
    performance
    $ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
    3300000
    $ cat /sys/devices/system/cpu/intel_pstate/max_perf_pct
    24
    
    And now intel_pstate driver allows to set maximal value for max_perf_pct based
    on max_policy_pct which is 24 for previous powersave max_freq 800000.
    
    This patch will set default value for max_policy_pct when setting policy to
    performance so it will allow to set also max value for max_perf_pct.
    Signed-off-by: default avatarPali Rohár <pali.rohar@gmail.com>
    Cc: All applicable <stable@vger.kernel.org>
    Acked-by: default avatarDirk Brandewie <dirk.j.brandewie@intel.com>
    Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
    36b4bed5
intel_pstate.c 22.4 KB