Merge tag 'pm-extra-4.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael...
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 14 Oct 2016 19:46:13 +0000 (12:46 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 14 Oct 2016 19:46:13 +0000 (12:46 -0700)
Pull more power management updates from Rafael Wysocki:
 "This includes a couple of fixes for cpufreq regressions introduced in
  4.8, a rework of the intel_pstate algorithm used on Atom processors
  (that took some time to test) plus a fix and a couple of cleanups in
  that driver, a CPPC cpufreq driver fix, and a some devfreq fixes and
  cleanups (core and exynos-nocp).

  Specifics:

   - Fix two cpufreq regressions causing undesirable changes in behavior
     to appear (one in the core and one in the conservative governor)
     introduced during the 4.8 cycle (Aaro Koskinen, Rafael Wysocki).

   - Fix the way the intel_pstate driver accesses MSRs related to the
     hardware-managed P-states (HWP) feature during the initialization
     which currently is unsafe and may cause the processor to generate a
     general protection fault (Srinivas Pandruvada).

   - Rework the intel_pstate's P-state selection algorithm used on Atom
     processors to avoid known problems with the current one and to make
     the computation more straightforward, which also happens to improve
     performance in multiple benchmarks a bit (Rafael Wysocki).

   - Improve two comments in the intel_pstate driver (Rafael Wysocki).

   - Fix the desired performance computation in the CPPC cpufreq driver
     (Hoan Tran).

   - Fix the devfreq core to avoid printing misleading error messages in
     some cases (Tobias Jakobi).

   - Fix the error code path in devfreq_add_device() to use proper
     locking around list modifications (Axel Lin).

   - Fix a build failure and remove a couple of redundant updates of
     variables in the exynos-nocp devfreq driver (Axel Lin)"

* tag 'pm-extra-4.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  cpufreq: CPPC: Correct desired_perf calculation
  cpufreq: conservative: Fix next frequency selection
  cpufreq: skip invalid entries when searching the frequency
  cpufreq: intel_pstate: Fix struct pstate_adjust_policy kerneldoc
  cpufreq: intel_pstate: Proportional algorithm for Atom
  PM / devfreq: Skip status update on uninitialized previous_freq
  PM / devfreq: Add proper locking around list_del()
  PM / devfreq: exynos-nocp: Remove redundant code
  PM / devfreq: exynos-nocp: Select REGMAP_MMIO
  cpufreq: intel_pstate: Clarify comment in get_target_pstate_use_performance()
  cpufreq: intel_pstate: Fix unsafe HWP MSR access

1  2 
drivers/cpufreq/cppc_cpufreq.c

@@@ -39,7 -39,7 +39,7 @@@
   * performance capabilities, desired performance level
   * requested etc.
   */
 -static struct cpudata **all_cpu_data;
 +static struct cppc_cpudata **all_cpu_data;
  
  /* Capture the max KHz from DMI */
  static u64 cppc_dmi_max_khz;
@@@ -78,13 -78,19 +78,19 @@@ static int cppc_cpufreq_set_target(stru
                unsigned int target_freq,
                unsigned int relation)
  {
 -      struct cpudata *cpu;
 +      struct cppc_cpudata *cpu;
        struct cpufreq_freqs freqs;
+       u32 desired_perf;
        int ret = 0;
  
        cpu = all_cpu_data[policy->cpu];
  
-       cpu->perf_ctrls.desired_perf = (u64)target_freq * policy->max / cppc_dmi_max_khz;
+       desired_perf = (u64)target_freq * cpu->perf_caps.highest_perf / cppc_dmi_max_khz;
+       /* Return if it is exactly the same perf */
+       if (desired_perf == cpu->perf_ctrls.desired_perf)
+               return ret;
+       cpu->perf_ctrls.desired_perf = desired_perf;
        freqs.old = policy->cur;
        freqs.new = target_freq;
  
@@@ -108,7 -114,7 +114,7 @@@ static int cppc_verify_policy(struct cp
  static void cppc_cpufreq_stop_cpu(struct cpufreq_policy *policy)
  {
        int cpu_num = policy->cpu;
 -      struct cpudata *cpu = all_cpu_data[cpu_num];
 +      struct cppc_cpudata *cpu = all_cpu_data[cpu_num];
        int ret;
  
        cpu->perf_ctrls.desired_perf = cpu->perf_caps.lowest_perf;
  
  static int cppc_cpufreq_cpu_init(struct cpufreq_policy *policy)
  {
 -      struct cpudata *cpu;
 +      struct cppc_cpudata *cpu;
        unsigned int cpu_num = policy->cpu;
        int ret = 0;
  
        policy->max = cppc_dmi_max_khz;
        policy->cpuinfo.min_freq = policy->min;
        policy->cpuinfo.max_freq = policy->max;
 +      policy->cpuinfo.transition_latency = cppc_get_transition_latency(cpu_num);
        policy->shared_type = cpu->shared_type;
  
        if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY)
@@@ -180,7 -185,7 +186,7 @@@ static struct cpufreq_driver cppc_cpufr
  static int __init cppc_cpufreq_init(void)
  {
        int i, ret = 0;
 -      struct cpudata *cpu;
 +      struct cppc_cpudata *cpu;
  
        if (acpi_disabled)
                return -ENODEV;
                return -ENOMEM;
  
        for_each_possible_cpu(i) {
 -              all_cpu_data[i] = kzalloc(sizeof(struct cpudata), GFP_KERNEL);
 +              all_cpu_data[i] = kzalloc(sizeof(struct cppc_cpudata), GFP_KERNEL);
                if (!all_cpu_data[i])
                        goto out;
  
@@@ -221,7 -226,7 +227,7 @@@ out
  
  static void __exit cppc_cpufreq_exit(void)
  {
 -      struct cpudata *cpu;
 +      struct cppc_cpudata *cpu;
        int i;
  
        cpufreq_unregister_driver(&cppc_cpufreq_driver);