Skip to content
  1. Dec 16, 2020
    • Rafael J. Wysocki's avatar
      cpufreq: intel_pstate: Implement the ->adjust_perf() callback · a365ab6b
      Rafael J. Wysocki authored
      
      
      Make intel_pstate expose the ->adjust_perf() callback when it
      operates in the passive mode with HWP enabled which causes the
      schedutil governor to use that callback instead of ->fast_switch().
      
      The minimum and target performance-level values passed by the
      governor to ->adjust_perf() are converted to HWP.REQ.MIN and
      HWP.REQ.DESIRED, respectively, which allows the processor to
      adjust its configuration to maximize energy-efficiency while
      providing sufficient capacity.
      
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: default avatarSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
      Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      a365ab6b
    • Rafael J. Wysocki's avatar
      cpufreq: Add special-purpose fast-switching callback for drivers · ee2cc427
      Rafael J. Wysocki authored
      
      
      First off, some cpufreq drivers (eg. intel_pstate) can pass hints
      beyond the current target frequency to the hardware and there are no
      provisions for doing that in the cpufreq framework.  In particular,
      today the driver has to assume that it should not allow the frequency
      to fall below the one requested by the governor (or the required
      capacity may not be provided) which may not be the case and which may
      lead to excessive energy usage in some scenarios.
      
      Second, the hints passed by these drivers to the hardware need not be
      in terms of the frequency, so representing the utilization numbers
      coming from the scheduler as frequency before passing them to those
      drivers is not really useful.
      
      Address the two points above by adding a special-purpose replacement
      for the ->fast_switch callback, called ->adjust_perf, allowing the
      governor to pass abstract performance level (rather than frequency)
      values for the minimum (required) and target (desired) performance
      along with the CPU capacity to compare them to.
      
      Also update the schedutil governor to use the new callback instead
      of ->fast_switch if present and if the utilization mertics are
      frequency-invariant (that is requisite for the direct mapping
      between the utilization and the CPU performance levels to be a
      reasonable approximation).
      
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      ee2cc427
    • Rafael J. Wysocki's avatar
      cpufreq: schedutil: Add util to struct sg_cpu · ca6827de
      Rafael J. Wysocki authored
      
      
      Instead of passing util and max between functions while computing the
      utilization and capacity, store the former in struct sg_cpu (along
      with the latter and bw_dl).
      
      This will allow the current utilization value to be compared with the
      one obtained previously (which is requisite for some code changes to
      follow this one), but also it causes the code to look slightly more
      consistent and cleaner.
      
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      ca6827de
    • Ionela Voinescu's avatar
      cppc_cpufreq: replace per-cpu data array with a list · a28b2bfc
      Ionela Voinescu authored
      
      
      The cppc_cpudata per-cpu storage was inefficient (1) additional to causing
      functional issues (2) when CPUs are hotplugged out, due to per-cpu data
      being improperly initialised.
      
      (1) The amount of information needed for CPPC performance control in its
          cpufreq driver depends on the domain (PSD) coordination type:
      
          ANY:    One set of CPPC control and capability data (e.g desired
                  performance, highest/lowest performance, etc) applies to all
                  CPUs in the domain.
      
          ALL:    Same as ANY. To be noted that this type is not currently
                  supported. When supported, information about which CPUs
                  belong to a domain is needed in order for frequency change
                  requests to be sent to each of them.
      
          HW:     It's necessary to store CPPC control and capability
                  information for all the CPUs. HW will then coordinate the
                  performance state based on their limitations and requests.
      
          NONE:   Same as HW. No HW coordination is expected.
      
          Despite this, the previous initialisation code would indiscriminately
          allocate memory for all CPUs (all_cpu_data) and unnecessarily
          duplicate performance capabilities and the domain sharing mask and type
          for each possible CPU.
      
      (2) With the current per-cpu structure, when having ANY coordination,
          the cppc_cpudata cpu information is not initialised (will remain 0)
          for all CPUs in a policy, other than policy->cpu. When policy->cpu is
          hotplugged out, the driver will incorrectly use the uninitialised (0)
          value of the other CPUs when making frequency changes. Additionally,
          the previous values stored in the perf_ctrls.desired_perf will be
          lost when policy->cpu changes.
      
      Therefore replace the array of per cpu data with a list. The memory for
      each structure is allocated at policy init, where a single structure
      can be allocated per policy, not per cpu. In order to accommodate the
      struct list_head node in the cppc_cpudata structure, the now unused cpu
      and cur_policy variables are removed.
      
      For example, on a arm64 Juno platform with 6 CPUs: (0, 1, 2, 3) in PSD1,
      (4, 5) in PSD2 - ANY coordination, the memory allocation comparison shows:
      
      Before patch:
      
       - ANY coordination:
         total    slack      req alloc/free  caller
             0        0        0     0/1     _kernel_size_le_hi32+0x0xffff800008ff7810
             0        0        0     0/6     _kernel_size_le_hi32+0x0xffff800008ff7808
           128       80       48     1/0     _kernel_size_le_hi32+0x0xffff800008ffc070
           768        0      768     6/0     _kernel_size_le_hi32+0x0xffff800008ffc0e4
      
      After patch:
      
       - ANY coordination:
          total    slack      req alloc/free  caller
           256        0      256     2/0     _kernel_size_le_hi32+0x0xffff800008fed410
             0        0        0     0/2     _kernel_size_le_hi32+0x0xffff800008fed274
      
      Additional notes:
       - A pointer to the policy's cppc_cpudata is stored in policy->driver_data
       - Driver registration is skipped if _CPC entries are not present.
      
      Signed-off-by: default avatarIonela Voinescu <ionela.voinescu@arm.com>
      Tested-by: default avatarMian Yousaf Kaukab <ykaukab@suse.de>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      a28b2bfc
    • Ionela Voinescu's avatar
      cppc_cpufreq: expose information on frequency domains · cfdc589f
      Ionela Voinescu authored
      
      
      Use the existing sysfs attribute "freqdomain_cpus" to expose
      information to userspace about CPUs in the same frequency domain.
      
      Signed-off-by: default avatarIonela Voinescu <ionela.voinescu@arm.com>
      Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Tested-by: default avatarMian Yousaf Kaukab <ykaukab@suse.de>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      cfdc589f
    • Ionela Voinescu's avatar
      cppc_cpufreq: clarify support for coordination types · bf76bb20
      Ionela Voinescu authored
      
      
      The previous coordination type handling in the cppc_cpufreq init code
      created some confusion: the comment mentioned "Support only SW_ANY for
      now" while only the SW_ALL/ALL case resulted in a failure. The other
      coordination types (HW_ALL/HW, NONE) were silently supported.
      
      Clarify support for coordination types while describing in comments the
      intended behavior.
      
      Signed-off-by: default avatarIonela Voinescu <ionela.voinescu@arm.com>
      Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Tested-by: default avatarMian Yousaf Kaukab <ykaukab@suse.de>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      bf76bb20
    • Ionela Voinescu's avatar
      cppc_cpufreq: use policy->cpu as driver of frequency setting · d2641a5c
      Ionela Voinescu authored
      
      
      Considering only the currently supported coordination types (ANY, HW,
      NONE), this change only makes a difference for the ANY type, when
      policy->cpu is hotplugged out. In that case the new policy->cpu will
      be different from ((struct cppc_cpudata *)policy->driver_data)->cpu.
      
      While in this case the controls of *ANY* CPU could be used to drive
      frequency changes, it's more consistent to use policy->cpu as the
      leading CPU, as used in all other cppc_cpufreq functions. Additionally,
      the debug prints in cppc_set_perf() would no longer create confusion
      when referring to a CPU that is hotplugged out.
      
      Signed-off-by: default avatarIonela Voinescu <ionela.voinescu@arm.com>
      Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Tested-by: default avatarMian Yousaf Kaukab <ykaukab@suse.de>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      d2641a5c
    • Rafael J. Wysocki's avatar
    • Ionela Voinescu's avatar
      ACPI: processor: fix NONE coordination for domain mapping failure · bca3e43c
      Ionela Voinescu authored
      
      
      For errors parsing the _PSD domains, a separate domain is returned for
      each CPU in the failed _PSD domain with no coordination (as per previous
      comment). But contrary to the intention, the code was setting
      CPUFREQ_SHARED_TYPE_ALL as coordination type.
      
      Change shared_type to CPUFREQ_SHARED_TYPE_NONE in case of errors parsing
      the domain information. The function still returns the error and the caller
      is free to bail out the domain initialisation altogether in that case.
      
      Given that both functions return domains with a single CPU, this change
      does not affect the functionality, but clarifies the intention.
      
      Signed-off-by: default avatarIonela Voinescu <ionela.voinescu@arm.com>
      Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      [ rjw: Subject edit ]
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      bca3e43c
  2. Dec 15, 2020
    • Rafael J. Wysocki's avatar
      Merge branch 'cpufreq/arm/linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm · 30c76882
      Rafael J. Wysocki authored
      Pull ARM cpufreq updates for 5.11-rc1 from Viresh Kumar:
      
      "This contains the following updates:
      
       - Fix imx's NVMEM_IMX_OCOTP dependency (Arnd Bergmann).
      
       - Add support for mt8167 and blacklist mt8516 (Fabien Parent).
      
       - Some ->get() callback related cleanups to the tegra194 driver and
         some optimizations in tegra186 driver (Jon Hunter and Sumit Gupta).
      
       - Power scale improvements to arm_scmi driver (Lukasz Luba).
      
       - Add missing MODULE_DEVICE_TABLE and MODULE_ALIAS to several drivers
         (Pali Rohár).
      
       - Fix error path in mediatek driver (Qinglang Miao).
      
       - Fix memleak in ST's cpufreq driver (Yangtao Li)."
      
      * 'cpufreq/arm/linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm: (22 commits)
        cpufreq: arm_scmi: Discover the power scale in performance protocol
        firmware: arm_scmi: Add power_scale_mw_get() interface
        cpufreq: tegra194: Rename tegra194_get_speed_common function
        cpufreq: tegra194: Remove unnecessary frequency calculation
        cpufreq: tegra186: Simplify cluster information lookup
        cpufreq: tegra186: Fix sparse 'incorrect type in assignment' warning
        cpufreq: imx: fix NVMEM_IMX_OCOTP dependency
        cpufreq: vexpress-spc: Add missing MODULE_ALIAS
        cpufreq: scpi: Add missing MODULE_ALIAS
        cpufreq: loongson1: Add missing MODULE_ALIAS
        cpufreq: sun50i: Add missing MODULE_DEVICE_TABLE
        cpufreq: st: Add missing MODULE_DEVICE_TABLE
        cpufreq: qcom: Add missing MODULE_DEVICE_TABLE
        cpufreq: mediatek: Add missing MODULE_DEVICE_TABLE
        cpufreq: highbank: Add missing MODULE_DEVICE_TABLE
        cpufreq: ap806: Add missing MODULE_DEVICE_TABLE
        cpufreq: mediatek: add missing platform_driver_unregister() on error in mtk_cpufreq_driver_init
        cpufreq: tegra194: get consistent cpuinfo_cur_freq
        cpufreq: blacklist mt8516 in cpufreq-dt-platdev
        cpufreq: mediatek: Add support for mt8167
        ...
      30c76882
  3. Dec 12, 2020
  4. Dec 08, 2020
  5. Dec 07, 2020
  6. Nov 25, 2020
  7. Nov 23, 2020