1. 10 8月, 2017 1 次提交
    • V
      cpufreq: Return 0 from ->fast_switch() on errors · 209887e6
      Viresh Kumar 提交于
      CPUFREQ_ENTRY_INVALID is a special symbol which is used to specify that
      an entry in the cpufreq table is invalid. But using it outside of the
      scope of the cpufreq table looks a bit incorrect.
      
      We can represent an invalid frequency by writing it as 0 instead if we
      need. Note that it is already done that way for the return value of the
      ->get() callback.
      
      Lets do the same for ->fast_switch() and not use CPUFREQ_ENTRY_INVALID
      outside of the scope of cpufreq table.
      
      Also update the comment over cpufreq_driver_fast_switch() to clearly
      mention what this returns.
      
      None of the drivers return CPUFREQ_ENTRY_INVALID as of now from
      ->fast_switch() callback and so we don't need to update any of those.
      Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      209887e6
  2. 01 8月, 2017 2 次提交
    • V
      cpufreq: Process remote callbacks from any CPU if the platform permits · 99d14d0e
      Viresh Kumar 提交于
      On many platforms, CPUs can do DVFS across cpufreq policies. i.e CPU
      from policy-A can change frequency of CPUs belonging to policy-B.
      
      This is quite common in case of ARM platforms where we don't
      configure any per-cpu register.
      
      Add a flag to identify such platforms and update
      cpufreq_can_do_remote_dvfs() to allow remote callbacks if this flag is
      set.
      
      Also enable the flag for cpufreq-dt driver which is used only on ARM
      platforms currently.
      Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
      Acked-by: NSaravana Kannan <skannan@codeaurora.org>
      Acked-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      99d14d0e
    • V
      sched: cpufreq: Allow remote cpufreq callbacks · 674e7541
      Viresh Kumar 提交于
      With Android UI and benchmarks the latency of cpufreq response to
      certain scheduling events can become very critical. Currently, callbacks
      into cpufreq governors are only made from the scheduler if the target
      CPU of the event is the same as the current CPU. This means there are
      certain situations where a target CPU may not run the cpufreq governor
      for some time.
      
      One testcase to show this behavior is where a task starts running on
      CPU0, then a new task is also spawned on CPU0 by a task on CPU1. If the
      system is configured such that the new tasks should receive maximum
      demand initially, this should result in CPU0 increasing frequency
      immediately. But because of the above mentioned limitation though, this
      does not occur.
      
      This patch updates the scheduler core to call the cpufreq callbacks for
      remote CPUs as well.
      
      The schedutil, ondemand and conservative governors are updated to
      process cpufreq utilization update hooks called for remote CPUs where
      the remote CPU is managed by the cpufreq policy of the local CPU.
      
      The intel_pstate driver is updated to always reject remote callbacks.
      
      This is tested with couple of usecases (Android: hackbench, recentfling,
      galleryfling, vellamo, Ubuntu: hackbench) on ARM hikey board (64 bit
      octa-core, single policy). Only galleryfling showed minor improvements,
      while others didn't had much deviation.
      
      The reason being that this patch only targets a corner case, where
      following are required to be true to improve performance and that
      doesn't happen too often with these tests:
      
      - Task is migrated to another CPU.
      - The task has high demand, and should take the target CPU to higher
        OPPs.
      - And the target CPU doesn't call into the cpufreq governor until the
        next tick.
      
      Based on initial work from Steve Muckle.
      Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
      Acked-by: NSaravana Kannan <skannan@codeaurora.org>
      Acked-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      674e7541
  3. 14 7月, 2017 1 次提交
    • S
      cpufreq: intel_pstate: Correct the busy calculation for KNL · 6e34e1f2
      Srinivas Pandruvada 提交于
      The busy percent calculated for the Knights Landing (KNL) platform
      is 1024 times smaller than the correct busy value.  This causes
      performance to get stuck at the lowest ratio.
      
      The scaling algorithm used for KNL is performance-based, but it still
      looks at the CPU load to set the scaled busy factor to 0 when the
      load is less than 1 percent.  In this case, since the computed load
      is 1024x smaller than it should be, the scaled busy factor will
      always be 0, irrespective of CPU business.
      
      This needs a fix similar to the turbostat one in commit b2b34dfe
      (tools/power turbostat: KNL workaround for %Busy and Avg_MHz).
      
      For this reason, add one more callback to processor-specific
      callbacks to specify an MPERF multiplier represented by a number of
      bit positions to shift the value of that register to the left to
      copmensate for its rate difference with respect to the TSC.  This
      shift value is used during CPU busy calculations.
      
      Fixes: ffb81056 (intel_pstate: Avoid getting stuck in high P-states when idle)
      Reported-and-tested-by: NArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
      Signed-off-by: NSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
      Cc: 4.6+ <stable@vger.kernel.org> # 4.6+
      [ rjw: Changelog ]
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      6e34e1f2
  4. 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
  5. 05 7月, 2017 2 次提交
  6. 30 6月, 2017 1 次提交
  7. 27 6月, 2017 4 次提交
    • P
      cpufreq / CPPC: Initialize policy->min to lowest nonlinear performance · 73808d0f
      Prakash, Prashanth 提交于
      Description of Lowest Perfomance in ACPI 6.1 specification states:
      "Lowest Performance is the absolute lowest performance level of
      the platform. Selecting a performance level lower than the lowest
      nonlinear performance level may actually cause an efficiency penalty,
      but should reduce the instantaneous power consumption of the processor.
      In traditional terms, this represents the T-state range of performance
      levels."
      
      Set the default value of policy->min to Lowest Nonlinear Performance
      to avoid any potential efficiency penalty.
      Signed-off-by: NPrashanth Prakash <pprakash@codeaurora.org>
      Acked-by: NViresh Kumar <viresh.kumar@linaro.org>
      Acked-by: NAlexey Klimov <alexey.klimov@arm.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      73808d0f
    • 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
  8. 24 6月, 2017 5 次提交
  9. 12 6月, 2017 1 次提交
  10. 05 6月, 2017 2 次提交
  11. 30 5月, 2017 2 次提交
  12. 28 5月, 2017 2 次提交
  13. 26 5月, 2017 1 次提交
  14. 23 5月, 2017 1 次提交
  15. 14 5月, 2017 1 次提交
  16. 12 5月, 2017 1 次提交
    • L
      intel_pstate: use updated msr-index.h HWP.EPP values · 3cedbc5a
      Len Brown 提交于
      intel_pstate exports sysfs attributes for setting and observing HWP.EPP.
      These attributes use strings to describe 4 operating states, and
      inside the driver, these strings are mapped to numerical register
      values.
      
      The authorative mapping between the strings and numerical HWP.EPP values
      are now globally defined in msr-index.h, replacing the out-dated
      mapping that were open-coded into intel_pstate.c
      
      new old string
      --- --- ------
        0   0 performance
      128  64 balance_performance
      192 128 balance_power
      255 192 power
      
      Note that the HW and BIOS default value on most system is 128,
      which intel_pstate will now call "balance_performance"
      while it used to call it "balance_power".
      Signed-off-by: NLen Brown <len.brown@intel.com>
      3cedbc5a
  17. 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
  18. 20 4月, 2017 5 次提交
  19. 18 4月, 2017 1 次提交
  20. 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