1. 21 Oct, 2019 2 commits
    • Rafael J. Wysocki's avatar
      cpufreq: Use per-policy frequency QoS · 3000ce3c
      Rafael J. Wysocki authored
      Replace the CPU device PM QoS used for the management of min and max
      frequency constraints in cpufreq (and its users) with per-policy
      frequency QoS to avoid problems with cpufreq policies covering
      more then one CPU.
      
      Namely, a cpufreq driver is registered with the subsys interface
      which calls cpufreq_add_dev() for each CPU, starting from CPU0, so
      currently the PM QoS notifiers are added to the first CPU in the
      policy (i.e. CPU0 in the majority of cases).
      
      In turn, when the cpufreq driver is unregistered, the subsys interface
      doing that calls cpufreq_remove_dev() for each CPU, starting from CPU0,
      and the PM QoS notifiers are only removed when cpufreq_remove_dev() is
      called for the last CPU in the policy, say CPUx, which as a rule is
      not CPU0 if the policy covers more than one CPU.  Then, the PM QoS
      notifiers cannot be removed, because CPUx does not have them, and
      they are still there in the device PM QoS notifiers list of CPU0,
      which prevents new PM QoS notifiers from being registered for CPU0
      on the next attempt to register the cpufreq driver.
      
      The same issue occurs when the first CPU in the policy goes offline
      before unregistering the driver.
      
      After this change it does not matter which CPU is the policy CPU at
      the driver registration time and whether or not it is online all the
      time, because the frequency QoS is per policy and not per CPU.
      
      Fixes: 67d874c3 ("cpufreq: Register notifiers with the PM QoS framework")
      Reported-by: default avatarDmitry Osipenko <digetx@gmail.com>
      Tested-by: default avatarDmitry Osipenko <digetx@gmail.com>
      Reported-by: default avatarSudeep Holla <sudeep.holla@arm.com>
      Tested-by: default avatarSudeep Holla <sudeep.holla@arm.com>
      Diagnosed-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Link: https://lore.kernel.org/linux-pm/5ad2624194baa2f53acc1f1e627eb7684c577a19.1562210705.git.viresh.kumar@linaro.org/T/#md2d89e95906b8c91c15f582146173dce2e86e99f
      Link: https://lore.kernel.org/linux-pm/20191017094612.6tbkwoq4harsjcqv@vireshk-i7/T/#m30d48cc23b9a80467fbaa16e30f90b3828a5a29bSigned-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      3000ce3c
    • Rafael J. Wysocki's avatar
      PM: QoS: Introduce frequency QoS · 77751a46
      Rafael J. Wysocki authored
      Introduce frequency QoS, based on the "raw" low-level PM QoS, to
      represent min and max frequency requests and aggregate constraints.
      
      The min and max frequency requests are to be represented by
      struct freq_qos_request objects and the aggregate constraints are to
      be represented by struct freq_constraints objects.  The latter are
      expected to be initialized with the help of freq_constraints_init().
      
      The freq_qos_read_value() helper is defined to retrieve the aggregate
      constraints values from a given struct freq_constraints object and
      there are the freq_qos_add_request(), freq_qos_update_request() and
      freq_qos_remove_request() helpers to manipulate the min and max
      frequency requests.  It is assumed that the the helpers will not
      run concurrently with each other for the same struct freq_qos_request
      object, so if that may be the case, their uses must ensure proper
      synchronization between them (e.g. through locking).
      
      In addition, freq_qos_add_notifier() and freq_qos_remove_notifier()
      are provided to add and remove notifiers that will trigger on aggregate
      constraint changes to and from a given struct freq_constraints object,
      respectively.
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      77751a46
  2. 20 Oct, 2019 6 commits
  3. 19 Oct, 2019 32 commits