1. 24 3月, 2017 1 次提交
    • R
      cpufreq: intel_pstate: Support HWP processors in all operation modes · eb5139d1
      Rafael J. Wysocki 提交于
      Currently, some processors supporting HWP are only supported by
      intel_pstate if HWP is actually going to be used and not supported
      otherwise which is confusing.
      
      Specifically, they are not supported if "intel_pstate=no_hwp" is
      passed to the kernel in the command line or if the driver is started
      in the passive mode ("intel_pstate=passive").
      
      There is no real reason for that, because everything about those
      processor is known anyway and the driver can work with them in all
      modes, so make that happen, but use the load-based P-state selection
      algorithm for the active mode "powersave" policy with them.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      eb5139d1
  2. 22 3月, 2017 1 次提交
    • R
      cpufreq: intel_pstate: Fix policy data management in passive mode · 64897b20
      Rafael J. Wysocki 提交于
      The policy->cpuinfo.max_freq and policy->max updates in
      intel_cpufreq_turbo_update() are excessive as they are done for no
      good reason and may lead to problems in principle, so they should be
      dropped.  However, after dropping them intel_cpufreq_turbo_update()
      becomes almost entirely pointless, because the check made by it is
      made again down the road in intel_pstate_prepare_request().  The
      only thing in it that still needs to be done is the call to
      update_turbo_state(), so drop intel_cpufreq_turbo_update() altogether
      and make its callers invoke update_turbo_state() directly instead of
      it.
      
      In addition to that, fix intel_cpufreq_verify_policy() so that it
      checks global.no_turbo in addition to global.turbo_disabled when
      updating policy->cpuinfo.max_freq to make it consistent with
      intel_pstate_verify_policy().
      
      Fixes: 001c76f0 (cpufreq: intel_pstate: Generic governors support)
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      64897b20
  3. 18 3月, 2017 1 次提交
    • R
      cpufreq: intel_pstate: One set of global limits in active mode · 7de32556
      Rafael J. Wysocki 提交于
      In the active mode intel_pstate currently uses two sets of global
      limits, each associated with one of the possible scaling_governor
      settings in that mode: "powersave" or "performance".
      
      The driver switches over from one of those sets to the other
      depending on the scaling_governor setting for the last CPU whose
      per-policy cpufreq interface in sysfs was last used to change
      parameters exposed in there.  That obviously leads to no end of
      issues when the scaling_governor settings differ between CPUs.
      
      The most recent issue was introduced by commit a240c4aa (cpufreq:
      intel_pstate: Do not reinit performance limits in ->setpolicy)
      that eliminated the reinitialization of "performance" limits in
      intel_pstate_set_policy() preventing the max limit from being set
      to anything below 100, among other things.
      
      Namely, an undesirable side effect of commit a240c4aa is that
      now, after setting scaling_governor to "performance" in the active
      mode, the per-policy limits for the CPU in question go to the highest
      level and stay there even when it is switched back to "powersave"
      later.
      
      As it turns out, some distributions set scaling_governor to
      "performance" temporarily for all CPUs to speed-up system
      initialization, so that change causes them to misbehave later.
      
      To fix that, get rid of the performance/powersave global limits
      split and use just one set of global limits for everything.
      
      From the user's persepctive, after this modification, when
      scaling_governor is switched from "performance" to "powersave"
      or the other way around on one CPU, the limits settings (ie. the
      global max/min_perf_pct and per-policy scaling_max/min_freq for
      any CPUs) will not change.  Still, switching from "performance"
      to "powersave" or the other way around changes the way in which
      P-states are selected and in particular "performance" causes the
      driver to always request the highest P-state it is allowed to ask
      for for the given CPU.
      
      Fixes: a240c4aa (cpufreq: intel_pstate: Do not reinit performance limits in ->setpolicy)
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      7de32556
  4. 15 3月, 2017 1 次提交
    • R
      cpufreq: intel_pstate: Avoid percentages in limits-related computations · e4c204ce
      Rafael J. Wysocki 提交于
      Currently, intel_pstate_update_perf_limits() first converts the
      policy minimum and maximum limits into percentages of the maximum
      turbo frequency (rounding up to an integer) and then converts these
      percentages to fractions (by using fixed-point arithmetic to divide
      them by 100).
      
      That introduces a rounding error unnecessarily, because the fractions
      can be obtained by carrying out fixed-point divisions directly on the
      input numbers.
      
      Rework the computations in intel_pstate_hwp_set() to use fractions
      instead of percentages (and drop redundant local variables from
      there) and modify intel_pstate_update_perf_limits() to compute the
      fractions directly and percentages out of them.
      
      While at it, introduce percent_ext_fp() for converting percentages
      to fractions (with extended number of fraction bits) and use it in
      the computations.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      e4c204ce
  5. 14 3月, 2017 2 次提交
    • S
      cpufreq: intel_pstate: Correct frequency setting in the HWP mode · 3f8ed54a
      Srinivas Pandruvada 提交于
      In the functions intel_pstate_hwp_set(), min/max range from HWP capability
      MSR along with max_perf_pct and min_perf_pct, is used to set the HWP
      request MSR. In some cases this doesn't result in the correct HWP max/min
      in HWP request.
      
      For example: In the following case:
      
      HWP capabilities from MSR 0x771
      0x70a1220
      
      Here cpufreq min/max frequencies from above MSR dump are 700MHz and 3.2GHz
      respectively.
      
      This will result in
      hwp_min = 0x07
      hwp_max = 0x20
      
      To limit max frequency to 2GHz:
      
      perf_limits->max_perf_pct = 63 (2GHz as a percent of 3.2GHz rounded up)
      
      With the current calculation:
      adj_range = max_perf_pct * range / 100;
      adj_range = 63 * (32 - 7) / 100
      adj_range = 15
      
      max = hw_min + adj_range;
      max = 7 + 15 = 22
      
      This will result in HWP request of 0x160f, which will result in a
      frequency cap of 2.2GHz not 2GHz.
      
      The problem with the above calculation is that hwp_min of 7 is treated
      as 0% in the range. But max_perf_pct is calculated with respect to minimum
      as 0 and max as 3.2GHz or hwp_max, so adding hwp_min to it will result in
      more than the desired.
      
      Since the min_perf_pct and max_perf_pct is already a percent of max
      frequency or hwp_max, this min/max HWP request value can be calculated
      directly applying these percentage to hwp_max.
      Signed-off-by: NSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      3f8ed54a
    • R
      cpufreq: intel_pstate: Update pid_params.sample_rate_ns in pid_param_set() · 6e7408ac
      Rafael J. Wysocki 提交于
      Fix the debugfs interface for PID tuning to actually update
      pid_params.sample_rate_ns on PID parameters updates, as changing
      pid_params.sample_rate_ms via debugfs has no effect now.
      
      Fixes: a4675fbc (cpufreq: intel_pstate: Replace timers with utilization update callbacks)
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NViresh Kumar <viresh.kumar@linaro.org>
      6e7408ac
  6. 13 3月, 2017 1 次提交
  7. 10 3月, 2017 15 次提交
  8. 09 3月, 2017 18 次提交