1. 12 7月, 2017 1 次提交
    • S
      cpufreq: intel_pstate: Fix ratio setting for min_perf_pct · d4436c0d
      Srinivas Pandruvada 提交于
      When the minimum performance limit percentage is set to the power-up
      default, it is possible that minimum performance ratio is off by one.
      
      In the set_policy() callback the minimum ratio is calculated by
      applying global.min_perf_pct to turbo_ratio and rounding up, but the
      power-up default global.min_perf_pct is already rounded up to the
      next percent in min_perf_pct_min().  That results in two round up
      operations, so for the default min_perf_pct one of them is not
      required.
      
      It is better to remove rounding up in min_perf_pct_min() as this
      matches the displayed min_perf_pct prior to commit c5a2ee7d
      (cpufreq: intel_pstate: Active mode P-state limits rework) in 4.12.
      
      For example on a platform with max turbo ratio of 37 and minimum
      ratio of 10, the min_perf_pct resulted in 28 with the above commit.
      Before this commit it was 27 and it will be the same after this
      change.
      
      Fixes: 1a4fe38a (cpufreq: intel_pstate: Remove max/min fractions to limit performance)
      Reported-by: NArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
      Signed-off-by: NSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      d4436c0d
  2. 30 6月, 2017 1 次提交
  3. 27 6月, 2017 3 次提交
    • L
      intel_pstate: skip scheduler hook when in "performance" mode · 82b4e03e
      Len Brown 提交于
      When the governor is set to "performance", intel_pstate does not
      need the scheduler hook for doing any calculations.  Under these
      conditions, its only purpose is to continue to maintain
      cpufreq/scaling_cur_freq.
      
      The cpufreq/scaling_cur_freq sysfs attribute is now provided by
      shared x86 cpufreq code on modern x86 systems, including
      all systems supported by the intel_pstate driver.
      
      So in "performance" governor mode, the scheduler hook can be skipped.
      This applies to both in Software and Hardware P-state control modes.
      Suggested-by: NSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
      Signed-off-by: NLen Brown <len.brown@intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      82b4e03e
    • L
      intel_pstate: delete scheduler hook in HWP mode · 62611cb9
      Len Brown 提交于
      The cpufreq/scaling_cur_freq sysfs attribute is now provided by
      shared x86 cpufreq code on modern x86 systems, including
      all systems supported by the intel_pstate driver.
      
      In HWP mode, maintaining that value was the sole purpose of
      the scheduler hook, intel_pstate_update_util_hwp(),
      so it can now be removed.
      Signed-off-by: NLen Brown <len.brown@intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      62611cb9
    • L
      x86: use common aperfmperf_khz_on_cpu() to calculate KHz using APERF/MPERF · f8475cef
      Len Brown 提交于
      The goal of this change is to give users a uniform and meaningful
      result when they read /sys/...cpufreq/scaling_cur_freq
      on modern x86 hardware, as compared to what they get today.
      
      Modern x86 processors include the hardware needed
      to accurately calculate frequency over an interval --
      APERF, MPERF, and the TSC.
      
      Here we provide an x86 routine to make this calculation
      on supported hardware, and use it in preference to any
      driver driver-specific cpufreq_driver.get() routine.
      
      MHz is computed like so:
      
      MHz = base_MHz * delta_APERF / delta_MPERF
      
      MHz is the average frequency of the busy processor
      over a measurement interval.  The interval is
      defined to be the time between successive invocations
      of aperfmperf_khz_on_cpu(), which are expected to to
      happen on-demand when users read sysfs attribute
      cpufreq/scaling_cur_freq.
      
      As with previous methods of calculating MHz,
      idle time is excluded.
      
      base_MHz above is from TSC calibration global "cpu_khz".
      
      This x86 native method to calculate MHz returns a meaningful result
      no matter if P-states are controlled by hardware or firmware
      and/or if the Linux cpufreq sub-system is or is-not installed.
      
      When this routine is invoked more frequently, the measurement
      interval becomes shorter.  However, the code limits re-computation
      to 10ms intervals so that average frequency remains meaningful.
      
      Discerning users are encouraged to take advantage of
      the turbostat(8) utility, which can gracefully handle
      concurrent measurement intervals of arbitrary length.
      Signed-off-by: NLen Brown <len.brown@intel.com>
      Reviewed-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      f8475cef
  4. 24 6月, 2017 1 次提交
    • S
      cpufreq: intel_pstate: Remove max/min fractions to limit performance · 1a4fe38a
      Srinivas Pandruvada 提交于
      In the current model the max/min perf limits are a fraction of current
      user space limits to the allowed max_freq or 100% for global limits.
      This results in wrong ratio limits calculation because of rounding
      issues for some user space limits.
      
      Initially we tried to solve this issue by issue by having more shift
      bits to increase precision. Still there are isolated cases where we still
      have error.
      
      This can be avoided by using ratios all together. Since the way we get
      cpuinfo.max_freq is by multiplying scaling factor to max ratio, we can
      easily keep the max/min ratios in terms of ratios and not fractions.
      
      For example:
      if the max ratio = 36
      cpuinfo.max_freq = 36 * 100000 = 3600000
      
      Suppose user space sets a limit of 1200000, then we can calculate
      max ratio limit as
      = 36 * 1200000 / 3600000
      = 12
      This will be correct for any user limits.
      
      The other advantage is that, we don't need to do any calculation in the
      fast path as ratio limit is already calculated via set_policy() callback.
      Signed-off-by: NSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      1a4fe38a
  5. 12 6月, 2017 1 次提交
  6. 05 6月, 2017 1 次提交
  7. 30 5月, 2017 2 次提交
  8. 14 5月, 2017 1 次提交
  9. 09 5月, 2017 2 次提交
    • K
      format-security: move static strings to const · 06324664
      Kees Cook 提交于
      While examining output from trial builds with -Wformat-security enabled,
      many strings were found that should be defined as "const", or as a char
      array instead of char pointer.  This makes some static analysis easier,
      by producing fewer false positives.
      
      As these are all trivial changes, it seemed best to put them all in a
      single patch rather than chopping them up per maintainer.
      
      Link: http://lkml.kernel.org/r/20170405214711.GA5711@beastSigned-off-by: NKees Cook <keescook@chromium.org>
      Acked-by: Jes Sorensen <jes@trained-monkey.org>	[runner.c]
      Cc: Tony Lindgren <tony@atomide.com>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: "Maciej W. Rozycki" <macro@linux-mips.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
      Cc: Viresh Kumar <viresh.kumar@linaro.org>
      Cc: Daniel Vetter <daniel.vetter@intel.com>
      Cc: Jani Nikula <jani.nikula@linux.intel.com>
      Cc: Sean Paul <seanpaul@chromium.org>
      Cc: David Airlie <airlied@linux.ie>
      Cc: Yisen Zhuang <yisen.zhuang@huawei.com>
      Cc: Salil Mehta <salil.mehta@huawei.com>
      Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
      Cc: Jiri Slaby <jslaby@suse.com>
      Cc: Patrice Chotard <patrice.chotard@st.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: James Hogan <james.hogan@imgtec.com>
      Cc: Paul Burton <paul.burton@imgtec.com>
      Cc: Matt Redfearn <matt.redfearn@imgtec.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
      Cc: Mugunthan V N <mugunthanvnm@ti.com>
      Cc: Felipe Balbi <felipe.balbi@linux.intel.com>
      Cc: Jarod Wilson <jarod@redhat.com>
      Cc: Florian Westphal <fw@strlen.de>
      Cc: Antonio Quartulli <a@unstable.cc>
      Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
      Cc: Kejian Yan <yankejian@huawei.com>
      Cc: Daode Huang <huangdaode@hisilicon.com>
      Cc: Qianqian Xie <xieqianqian@huawei.com>
      Cc: Philippe Reynes <tremyfr@gmail.com>
      Cc: Colin Ian King <colin.king@canonical.com>
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: Christian Gromm <christian.gromm@microchip.com>
      Cc: Andrey Shvetsov <andrey.shvetsov@k2l.de>
      Cc: Jason Litzinger <jlitzingerdev@gmail.com>
      Cc: WANG Cong <xiyou.wangcong@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      06324664
    • S
      scripts/spelling.txt: add regsiter -> register spelling mistake · ad61dd30
      Stephen Boyd 提交于
      This typo is quite common.  Fix it and add it to the spelling file so
      that checkpatch catches it earlier.
      
      Link: http://lkml.kernel.org/r/20170317011131.6881-2-sboyd@codeaurora.orgSigned-off-by: NStephen Boyd <sboyd@codeaurora.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      ad61dd30
  10. 20 4月, 2017 5 次提交
  11. 18 4月, 2017 1 次提交
  12. 15 4月, 2017 4 次提交
    • T
      cpufreq/sparc-us2e: Replace racy task affinity logic · 12699ac5
      Thomas Gleixner 提交于
      The access to the HBIRD_ESTAR_MODE register in the cpu frequency control
      functions must happen on the target CPU. This is achieved by temporarily
      setting the affinity of the calling user space thread to the requested CPU
      and reset it to the original affinity afterwards.
      
      That's racy vs. CPU hotplug and concurrent affinity settings for that
      thread resulting in code executing on the wrong CPU and overwriting the
      new affinity setting.
      
      Replace it by a straight forward smp function call. 
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Acked-by: NViresh Kumar <viresh.kumar@linaro.org>
      Cc: Fenghua Yu <fenghua.yu@intel.com>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Herbert Xu <herbert@gondor.apana.org.au>
      Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Sebastian Siewior <bigeasy@linutronix.de>
      Cc: linux-pm@vger.kernel.org
      Cc: Lai Jiangshan <jiangshanlai@gmail.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Len Brown <lenb@kernel.org>
      Link: http://lkml.kernel.org/r/alpine.DEB.2.20.1704131020280.2408@nanosSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      12699ac5
    • T
      cpufreq/sparc-us3: Replace racy task affinity logic · 9fe24c4e
      Thomas Gleixner 提交于
      The access to the safari config register in the CPU frequency functions
      must be executed on the target CPU. This is achieved by temporarily setting
      the affinity of the calling user space thread to the requested CPU and
      reset it to the original affinity afterwards.
      
      That's racy vs. CPU hotplug and concurrent affinity settings for that
      thread resulting in code executing on the wrong CPU and overwriting the
      new affinity setting.
      
      Replace it by a straight forward smp function call. 
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Acked-by: NViresh Kumar <viresh.kumar@linaro.org>
      Cc: Fenghua Yu <fenghua.yu@intel.com>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Herbert Xu <herbert@gondor.apana.org.au>
      Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Sebastian Siewior <bigeasy@linutronix.de>
      Cc: linux-pm@vger.kernel.org
      Cc: Lai Jiangshan <jiangshanlai@gmail.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Len Brown <lenb@kernel.org>
      Link: http://lkml.kernel.org/r/20170412201043.047558840@linutronix.deSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      9fe24c4e
    • T
      cpufreq/sh: Replace racy task affinity logic · 205dcc1e
      Thomas Gleixner 提交于
      The target() callback must run on the affected cpu. This is achieved by
      temporarily setting the affinity of the calling thread to the requested CPU
      and reset it to the original affinity afterwards.
      
      That's racy vs. concurrent affinity settings for that thread resulting in
      code executing on the wrong CPU.
      
      Replace it by work_on_cpu(). All call pathes which invoke the callbacks are
      already protected against CPU hotplug.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Acked-by: NViresh Kumar <viresh.kumar@linaro.org>
      Cc: Fenghua Yu <fenghua.yu@intel.com>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Herbert Xu <herbert@gondor.apana.org.au>
      Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Sebastian Siewior <bigeasy@linutronix.de>
      Cc: linux-pm@vger.kernel.org
      Cc: Lai Jiangshan <jiangshanlai@gmail.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Len Brown <lenb@kernel.org>
      Link: http://lkml.kernel.org/r/20170412201042.958216363@linutronix.deSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      205dcc1e
    • T
      cpufreq/ia64: Replace racy task affinity logic · 38f05ed0
      Thomas Gleixner 提交于
      The get() and target() callbacks must run on the affected cpu. This is
      achieved by temporarily setting the affinity of the calling thread to the
      requested CPU and reset it to the original affinity afterwards.
      
      That's racy vs. concurrent affinity settings for that thread resulting in
      code executing on the wrong CPU and overwriting the new affinity setting.
      
      Replace it by work_on_cpu(). All call pathes which invoke the callbacks are
      already protected against CPU hotplug.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Acked-by: NViresh Kumar <viresh.kumar@linaro.org>
      Cc: Fenghua Yu <fenghua.yu@intel.com>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Herbert Xu <herbert@gondor.apana.org.au>
      Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Sebastian Siewior <bigeasy@linutronix.de>
      Cc: linux-pm@vger.kernel.org
      Cc: Lai Jiangshan <jiangshanlai@gmail.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Len Brown <lenb@kernel.org>
      Link: http://lkml.kernel.org/r/alpine.DEB.2.20.1704122231100.2548@nanosSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      38f05ed0
  13. 13 4月, 2017 1 次提交
    • C
      cpufreq: Bring CPUs up even if cpufreq_online() failed · c4a3fa26
      Chen Yu 提交于
      There is a report that after commit 27622b06 ("cpufreq: Convert
      to hotplug state machine"), the normal CPU offline/online cycle
      fails on some platforms.
      
      According to the ftrace result, this problem was triggered on
      platforms using acpi-cpufreq as the default cpufreq driver,
      and due to the lack of some ACPI freq method (eg. _PCT),
      cpufreq_online() failed and returned a negative value, so the CPU
      hotplug state machine rolled back the CPU online process.  Actually,
      from the user's perspective, the failure of cpufreq_online() should
      not prevent that CPU from being brought up, although cpufreq might
      not work on that CPU.
      
      BTW, during system startup cpufreq_online() is not invoked via CPU
      online but by the cpufreq device creation process, so the APs can be
      brought up even though cpufreq_online() fails in that stage.
      
      This patch ignores the return value of cpufreq_online/offline() and
      lets the cpufreq framework deal with the failure.  cpufreq_online()
      itself will do a proper rollback in that case and if _PCT is missing,
      the ACPI cpufreq driver will print a warning if the corresponding
      debug options have been enabled.
      
      Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=194581
      Fixes: 27622b06 ("cpufreq: Convert to hotplug state machine")
      Reported-and-tested-by: NTomasz Maciej Nowak <tmn505@gmail.com>
      Signed-off-by: NChen Yu <yu.c.chen@intel.com>
      Acked-by: NViresh Kumar <viresh.kumar@linaro.org>
      Cc: 4.9+ <stable@vger.kernel.org> # 4.9+
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      c4a3fa26
  14. 12 4月, 2017 1 次提交
  15. 30 3月, 2017 1 次提交
  16. 29 3月, 2017 14 次提交
    • R
      cpufreq: intel_pstate: Eliminate intel_pstate_get_min_max() · b02aabe8
      Rafael J. Wysocki 提交于
      Some computations in intel_pstate_get_min_max() are not necessary
      and one of its two callers doesn't even use the full result.
      
      First off, the fixed-point value of cpu->max_perf represents a
      non-negative number between 0 and 1 inclusive and cpu->min_perf
      cannot be greater than cpu->max_perf.  It is not necessary to check
      those conditions every time the numbers in question are used.
      
      Moreover, since intel_pstate_max_within_limits() only needs the
      upper boundary, it doesn't make sense to compute the lower one in
      there and returning min and max from intel_pstate_get_min_max()
      via pointers doesn't look particularly nice.
      
      For the above reasons, drop intel_pstate_get_min_max(), add a helper
      to get the base P-state for min/max computations and carry out them
      directly in the previous callers of intel_pstate_get_min_max().
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      b02aabe8
    • R
      cpufreq: intel_pstate: Do not walk policy->cpus · 2bfc4cbb
      Rafael J. Wysocki 提交于
      intel_pstate_hwp_set() is the only function walking policy->cpus
      in intel_pstate.  The rest of the code simply assumes one CPU per
      policy, including the initialization code.
      
      Therefore it doesn't make sense for intel_pstate_hwp_set() to
      walk policy->cpus as it is guaranteed to have only one bit set
      for policy->cpu.
      
      For this reason, rearrange intel_pstate_hwp_set() to take the CPU
      number as the argument and drop the loop over policy->cpus from it.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      2bfc4cbb
    • R
      cpufreq: intel_pstate: Introduce pid_in_use() · 8ca6ce37
      Rafael J. Wysocki 提交于
      Add a new function pid_in_use() to return the information on whether
      or not the PID-based P-state selection algorithm is in use.
      
      That allows a couple of complicated conditions in the code to be
      reduced to simple checks against the new function's return value.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      8ca6ce37
    • R
      cpufreq: intel_pstate: Drop struct cpu_defaults · 2f49afc2
      Rafael J. Wysocki 提交于
      The cpu_defaults structure is redundant, because it only contains
      one member of type struct pstate_funcs which can be used directly
      instead of struct cpu_defaults.
      
      For this reason, drop struct cpu_defaults, use struct pstate_funcs
      directly instead of it where applicable and rename all of the
      variables of that type accordingly.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      2f49afc2
    • R
      cpufreq: intel_pstate: Move cpu_defaults definitions · de4a76cb
      Rafael J. Wysocki 提交于
      Move the definitions of the cpu_defaults structures after the
      definitions of utilization update callback routines to avoid
      extra declarations of the latter.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      de4a76cb
    • R
      cpufreq: intel_pstate: Add update_util callback to pstate_funcs · 67dd9bf4
      Rafael J. Wysocki 提交于
      Avoid using extra function pointers during P-state selection by
      dropping the get_target_pstate member from struct pstate_funcs,
      adding a new update_util callback to it (to be registered with
      the CPU scheduler as the utilization update callback in the active
      mode) and reworking the utilization update callback routines to
      invoke specific P-state selection functions directly.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      67dd9bf4
    • R
      cpufreq: intel_pstate: Use different utilization update callbacks · eabd22c6
      Rafael J. Wysocki 提交于
      Notice that some overhead in the utilization update callbacks
      registered by intel_pstate in the active mode can be avoided if
      those callbacks are tailored to specific configurations of the
      driver.  For example, the utilization update callback for the HWP
      enabled case only needs to update the average CPU performance
      periodically whereas the utilization update callback for the
      PID-based algorithm does not need to take IO-wait boosting into
      account and so on.
      
      With that in mind, define three utilization update callbacks for
      three different use cases: HWP enabled, the CPU load "powersave"
      P-state selection algorithm and the PID-based "powersave" P-state
      selection algorithm and modify the driver initialization to
      choose the callback matching its current configuration.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      eabd22c6
    • R
      cpufreq: intel_pstate: Modify check in intel_pstate_update_status() · 0042b2c0
      Rafael J. Wysocki 提交于
      One of the checks in intel_pstate_update_status() implicitly relies
      on the information that there are only two struct cpufreq_driver
      objects available, but it is better to do it directly against the
      value it really is about (to make the code easier to follow if
      nothing else).
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      0042b2c0
    • R
      cpufreq: intel_pstate: Drop driver_registered variable · ee8df89a
      Rafael J. Wysocki 提交于
      The driver_registered variable in intel_pstate is used for checking
      whether or not the driver has been registered, but intel_pstate_driver
      can be used for that too (with the rule that the driver is not
      registered as long as it is NULL).
      
      That is a bit more straightforward and the code may be simplified
      a bit this way, so modify the driver accordingly.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      ee8df89a
    • R
      cpufreq: intel_pstate: Skip unnecessary PID resets on init · 694cb173
      Rafael J. Wysocki 提交于
      PID controller parameters only need to be initialized if the
      get_target_pstate_use_performance() P-state selection routine
      is going to be used.  It is not necessary to initialize them
      otherwise, so don't do that.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      694cb173
    • R
      cpufreq: intel_pstate: Set HWP sampling interval once · 7aec5b50
      Rafael J. Wysocki 提交于
      In the HWP enabled case pid_params.sample_rate_ns only needs to be
      updated once, because it is global, so do that when setting hwp_active
      instead of doing it during the initialization of every CPU.
      
      Moreover, pid_params.sample_rate_ms is never used if HWP is enabled,
      so do not update it at all then.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      7aec5b50
    • R
      cpufreq: intel_pstate: Clean up intel_pstate_busy_pid_reset() · ff35f02e
      Rafael J. Wysocki 提交于
      intel_pstate_busy_pid_reset() is the only caller of pid_reset(),
      pid_p_gain_set(), pid_i_gain_set(), and pid_d_gain_set().  Moreover,
      it passes constants as two parameters of pid_reset() and all of
      the other routines above essentially contain the same code, so
      fold all of them into the caller and drop unnecessary computations.
      
      Introduce percent_fp() for converting integer values in percent
      to fixed-point fractions and use it in the above code cleanup.
      
      Finally, rename intel_pstate_busy_pid_reset() to
      intel_pstate_pid_reset() as it also is used for the
      initialization of PID parameters for every CPU and the
      meaning of the "busy" part of the name is not particularly
      clear.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      ff35f02e
    • R
      cpufreq: intel_pstate: Fold intel_pstate_reset_all_pid() into the caller · 4ddd0146
      Rafael J. Wysocki 提交于
      There is only one caller of intel_pstate_reset_all_pid(), which is
      pid_param_set() used in the debugfs interface only, and having that
      code split does not make it particularly convenient to follow.
      
      For this reason, move the body of intel_pstate_reset_all_pid() into
      its caller and drop that function.
      
      Also change the loop from for_each_online_cpu() (which is obviously
      racy with respect to CPU offline/online) to for_each_possible_cpu(),
      so that all PID parameters are reset for all CPUs regardless of their
      online/offline status (to prevent, for example, a previously offline
      CPU from going online with a stale set of PID parameters).
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      4ddd0146
    • R
      cpufreq: intel_pstate: Initialize pid_params statically · 5c439053
      Rafael J. Wysocki 提交于
      Notice that both the existing struct cpu_defaults instances in which
      PID parameters are actually initialized use the same values of those
      parameters, so it is not really necessary to copy them over to
      pid_params dynamically.
      
      Instead, initialize pid_params statically with those values and
      drop the unused pid_policy member from struct cpu_defaults along
      with copy_pid_params() used for initializing it.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      5c439053