1. 05 11月, 2021 3 次提交
  2. 26 10月, 2021 1 次提交
  3. 08 10月, 2021 1 次提交
  4. 05 10月, 2021 4 次提交
    • V
      cpufreq: Use CPUFREQ_RELATION_E in DVFS governors · b894d20e
      Vincent Donnefort 提交于
      Let the governors schedutil, conservative and ondemand to work, if possible
      on efficient frequencies only.
      Signed-off-by: NVincent Donnefort <vincent.donnefort@arm.com>
      Acked-by: NViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      b894d20e
    • V
      cpufreq: Introducing CPUFREQ_RELATION_E · 1f39fa0d
      Vincent Donnefort 提交于
      This newly introduced flag can be applied by a governor to a CPUFreq
      relation, when looking for a frequency within the policy table. The
      resolution would then only walk through efficient frequencies.
      
      Even with the flag set, the policy max limit will still be honoured. If no
      efficient frequencies can be found within the limits of the policy, an
      inefficient one would be returned.
      Signed-off-by: NVincent Donnefort <vincent.donnefort@arm.com>
      Acked-by: NViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      1f39fa0d
    • V
      cpufreq: Make policy min/max hard requirements · 15171769
      Vincent Donnefort 提交于
      When applying the policy min/max limits, the requested frequency is
      simply clamped to not be out of range. It means, however, if one of the
      boundaries isn't an available frequency, the frequency resolution can
      return a value out of those limits, depending on the relation used.
      
      e.g. freq{0,1,2} being available frequencies.
      
                freq0  policy->min  freq1  policy->max   freq2
                  |        |          |        |           |
                17kHz     18kHz     19kHz     20kHz      21kHz
      
           __resolve_freq(21kHz, CPUFREQ_RELATION_L) -> 21kHz (out of bounds)
           __resolve_freq(17kHz, CPUFREQ_RELATION_H) -> 17kHz (out of bounds)
      
      If, during the policy init, we resolve the requested min/max to existing
      frequencies, we ensure that any CPUFREQ_RELATION_* would resolve to a
      frequency which is inside the policy min/max range.
      
      Making the policy limits rigid helps to introduce the inefficient
      frequencies support. Resolving an inefficient frequency to an efficient
      one should not transgress policy->max (which can be set for thermal
      reason) and having a value we can trust simplify this comparison.
      Signed-off-by: NVincent Donnefort <vincent.donnefort@arm.com>
      Acked-by: NViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      15171769
    • S
      cpufreq: intel_pstate: Process HWP Guaranteed change notification · 57577c99
      Srinivas Pandruvada 提交于
      It is possible that HWP guaranteed ratio is changed in response to
      change in power and thermal limits. For example when Intel Speed Select
      performance profile is changed or there is change in TDP, hardware can
      send notifications. It is possible that the guaranteed ratio is
      increased. This creates an issue when turbo is disabled, as the old
      limits set in MSR_HWP_REQUEST are still lower and hardware will clip
      to older limits.
      
      This change enables HWP interrupt and process HWP interrupts. When
      guaranteed is changed, calls cpufreq_update_policy() so that driver
      callbacks are called to update to new HWP limits. This callback
      is called from a delayed workqueue of 10ms to avoid frequent updates.
      
      Although the scope of IA32_HWP_INTERRUPT is per logical cpu, on some
      plaforms interrupt is generated on all CPUs. This is particularly a
      problem during initialization, when the driver didn't allocated
      data for other CPUs. So this change uses a cpumask of enabled CPUs and
      process interrupts on those CPUs only.
      
      When the cpufreq offline() or suspend() callback is called, HWP interrupt
      is disabled on those CPUs and also cancels any pending work item.
      
      Spin lock is used to protect data and processing shared with interrupt
      handler. Here READ_ONCE(), WRITE_ONCE() macros are used to designate
      shared data, even though spin lock act as an optimization barrier here.
      Signed-off-by: NSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
      Tested-by: pablomh@gmail.com
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      57577c99
  5. 04 10月, 2021 4 次提交
  6. 17 9月, 2021 1 次提交
  7. 15 9月, 2021 1 次提交
    • J
      cpufreq: schedutil: Destroy mutex before kobject_put() frees the memory · cdef1196
      James Morse 提交于
      Since commit e5c6b312 ("cpufreq: schedutil: Use kobject release()
      method to free sugov_tunables") kobject_put() has kfree()d the
      attr_set before gov_attr_set_put() returns.
      
      kobject_put() isn't the last user of attr_set in gov_attr_set_put(),
      the subsequent mutex_destroy() triggers a use-after-free:
      | BUG: KASAN: use-after-free in mutex_is_locked+0x20/0x60
      | Read of size 8 at addr ffff000800ca4250 by task cpuhp/2/20
      |
      | CPU: 2 PID: 20 Comm: cpuhp/2 Not tainted 5.15.0-rc1 #12369
      | Hardware name: ARM LTD ARM Juno Development Platform/ARM Juno Development
      | Platform, BIOS EDK II Jul 30 2018
      | Call trace:
      |  dump_backtrace+0x0/0x380
      |  show_stack+0x1c/0x30
      |  dump_stack_lvl+0x8c/0xb8
      |  print_address_description.constprop.0+0x74/0x2b8
      |  kasan_report+0x1f4/0x210
      |  kasan_check_range+0xfc/0x1a4
      |  __kasan_check_read+0x38/0x60
      |  mutex_is_locked+0x20/0x60
      |  mutex_destroy+0x80/0x100
      |  gov_attr_set_put+0xfc/0x150
      |  sugov_exit+0x78/0x190
      |  cpufreq_offline.isra.0+0x2c0/0x660
      |  cpuhp_cpufreq_offline+0x14/0x24
      |  cpuhp_invoke_callback+0x430/0x6d0
      |  cpuhp_thread_fun+0x1b0/0x624
      |  smpboot_thread_fn+0x5e0/0xa6c
      |  kthread+0x3a0/0x450
      |  ret_from_fork+0x10/0x20
      
      Swap the order of the calls.
      
      Fixes: e5c6b312 ("cpufreq: schedutil: Use kobject release() method to free sugov_tunables")
      Cc: 4.7+ <stable@vger.kernel.org> # 4.7+
      Signed-off-by: NJames Morse <james.morse@arm.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      cdef1196
  8. 14 9月, 2021 1 次提交
  9. 08 9月, 2021 1 次提交
    • R
      cpufreq: intel_pstate: hybrid: Rework HWP calibration · 46573fd6
      Rafael J. Wysocki 提交于
      The current HWP calibration for hybrid processors in intel_pstate is
      fragile, because it depends too much on the information provided by
      the platform firmware via CPPC which may not be reliable enough.  It
      also need not be so complicated.
      
      In order to improve that mechanism and make it more resistant to
      platform firmware issues, make it only use the CPPC nominal_perf
      values to compute the HWP-to-frequency scaling factors for all
      CPUs and possibly use the HWP_CAP highest_perf values to recompute
      them if the ones derived from the CPPC nominal_perf values alone
      appear to be too high.
      
      Namely, fetch CPC.nominal_perf for all CPUs present in the system,
      find the minimum one and use it as a reference for computing all of
      the CPUs' scaling factors (using the observation that for the CPUs
      having the minimum CPC.nominal_perf the HWP range of available
      performance levels should be the same as the range of available
      "legacy" P-states and so the HWP-to-frequency scaling factor for
      them should be the same as the corresponding scaling factor used
      for representing the P-state values in kHz).
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Tested-by: NZhang Rui <rui.zhang@intel.com>
      46573fd6
  10. 07 9月, 2021 1 次提交
  11. 06 9月, 2021 1 次提交
  12. 03 9月, 2021 3 次提交
  13. 30 8月, 2021 6 次提交
  14. 26 8月, 2021 1 次提交
    • S
      cpufreq: intel_pstate: Process HWP Guaranteed change notification · d0e936ad
      Srinivas Pandruvada 提交于
      It is possible that HWP guaranteed ratio is changed in response to
      change in power and thermal limits. For example when Intel Speed Select
      performance profile is changed or there is change in TDP, hardware can
      send notifications. It is possible that the guaranteed ratio is
      increased. This creates an issue when turbo is disabled, as the old
      limits set in MSR_HWP_REQUEST are still lower and hardware will clip
      to older limits.
      
      This change enables HWP interrupt and process HWP interrupts. When
      guaranteed is changed, calls cpufreq_update_policy() so that driver
      callbacks are called to update to new HWP limits. This callback
      is called from a delayed workqueue of 10ms to avoid frequent updates.
      Signed-off-by: NSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      d0e936ad
  15. 13 8月, 2021 1 次提交
  16. 12 8月, 2021 7 次提交
  17. 09 8月, 2021 1 次提交
    • M
      cpufreq: armada-37xx: forbid cpufreq for 1.2 GHz variant · 484f2b7c
      Marek Behún 提交于
      The 1.2 GHz variant of the Armada 3720 SOC is unstable with DVFS: when
      the SOC boots, the WTMI firmware sets clocks and AVS values that work
      correctly with 1.2 GHz CPU frequency, but random crashes occur once
      cpufreq driver starts scaling.
      
      We do not know currently what is the reason:
      - it may be that the voltage value for L0 for 1.2 GHz variant provided
        by the vendor in the OTP is simply incorrect when scaling is used,
      - it may be that some delay is needed somewhere,
      - it may be something else.
      
      The most sane solution now seems to be to simply forbid the cpufreq
      driver on 1.2 GHz variant.
      Signed-off-by: NMarek Behún <kabel@kernel.org>
      Fixes: 92ce45fb ("cpufreq: Add DVFS support for Armada 37xx")
      Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
      484f2b7c
  18. 05 8月, 2021 2 次提交