dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/4] Add support for devices in the Energy Model
@ 2020-03-09 13:41 Lukasz Luba
  2020-03-09 13:41 ` [PATCH v4 1/4] PM / EM: add devices to " Lukasz Luba
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Lukasz Luba @ 2020-03-09 13:41 UTC (permalink / raw)
  To: linux-kernel, linux-pm, linux-arm-kernel, dri-devel, linux-omap,
	linux-mediatek, linux-arm-msm, linux-imx
  Cc: nm, juri.lelli, peterz, viresh.kumar, liviu.dudau,
	bjorn.andersson, bsegall, Morten.Rasmussen, amit.kucheria,
	lorenzo.pieralisi, vincent.guittot, khilman, daniel.lezcano,
	steven.price, cw00.choi, mingo, mgorman, rui.zhang,
	alyssa.rosenzweig, orjan.eide, b.zolnierkie, s.hauer, rostedt,
	matthias.bgg, Dietmar.Eggemann, airlied, javi.merino,
	tomeu.vizoso, qperret, sboyd, rdunlap, rjw, agross, kernel,
	sudeep.holla, patrick.bellasi, shawnguo, lukasz.luba

Hi all,

This patch set introduces support for devices in the Energy Model (EM)
framework. It will unify the power model for thermal subsystem and make it
simpler. The 1st patch refactors EM framework and adds support for devices.
The 2nd patch changes dev_pm_opp_of_register_em() in OPP/OF which now should
take as an argument struct device pointer. It touches a few trees
(OMAP, NXP, Mediatek) updating their CPUfreq drivers to the new interface.
Patch 3/4 changes thermal devfreq cooling removing old code for calculating
local power table. It simplifies the code and uses EM for requested power
calculation. Last patch 4/4 adds EM to Panfrost driver.

The patch set is based on linux-next tag next-20200306.

- devfreq cooling: added two new registration functions, which will take care
  of registering EM for the device and simplify drivers code
  (suggested by Robin and Rob)
- Energy Model: changed unregistering code, added kref to track usage, added
  code freeing tables, added helper function
- added return value to function dev_pm_opp_of_register_em() and updated
  CPUFreq drivers code, added debug prints in case of failure (which might
  help in case CPU cooling was expecting EM)
- updated comments in devfreq cooling removing statement that only
  simple_ondemand devfreq governor is supported to work with power extensions
- fixed spelling in the documentation (reported by Randy)
v3 [3]:
- added back the cpumask 'cpus' in the em_perf_domain due potential cache misses
- removed _is_cpu_em() since there is no need for it
- changed function name from em_pd_energy() to em_cpu_energy(), which is
  optimized for usage from the scheduler making some assumptions and not
  validating arguments to speed-up, there is a comment stressing that it should
  be used only for CPUs em_perf_domain
- changed em_get_pd() to em_pd_get() which is now aligned with em_cpu_get()
- Energy Model: add code which checks if the EM is already registered for the
  devfreq device
- extended comment in em_cpu_get() describing the need for this function
- fixed build warning reported on x86 by kbuild test robot in devfreq_cooling.c
- updated documentation in the energy-model.rst
- changed print messages from 'energy_model' to 'EM'
- changed dev_warn to dev_dbg, should calm down test scripts in case the
  platform has OPPs less efficient in the OPP table (some of them are there for
  cooling reasons, we shouldn't warn in this case, debug info is enough)
v2 [2]:
- changed EM API em_register_perf_domain() adding cpumask_t pointer
  as last argument (which was discussed with Dietmar and Quentin)
- removed dependency on PM_OPP, thanks to the cpumask_t argument
- removed enum em_type and em->type dependent code
- em_get_pd() can handle CPU device as well as devfreq device
- updated EM documentation
- in devfreq cooling added code which prevents from race condition with
  devfreq governors which are trying to use OPPs while thermal is in the middle
  of disabling them.
- in devfreq cooling added code which updates state of the devfreq device to
  avoid working on stale data when governor has not updated it for a long time
- in devfreq cooling added backward compatibility frequency table for drivers
  which did not provide EM
- added Steven's Reviewed-by to trace code in thermal
- added another CPUFreq driver which needs to be updated to the new API

The v1 can be found here [1].

Lukasz Luba

[1] https://lkml.org/lkml/2020/1/16/619
[2] https://lkml.org/lkml/2020/2/6/377
[3] https://lkml.org/lkml/2020/2/21/1910

Lukasz Luba (4):
  PM / EM: add devices to Energy Model
  OPP: change parameter to device pointer in dev_pm_opp_of_register_em()
  thermal: devfreq_cooling: Refactor code and switch to use Energy Model
  drm/panfrost: Register devfreq cooling and attempt to add Energy Model

 Documentation/power/energy-model.rst        | 133 ++---
 Documentation/scheduler/sched-energy.rst    |   2 +-
 drivers/cpufreq/cpufreq-dt.c                |   4 +-
 drivers/cpufreq/imx6q-cpufreq.c             |   7 +-
 drivers/cpufreq/mediatek-cpufreq.c          |   5 +-
 drivers/cpufreq/omap-cpufreq.c              |   6 +-
 drivers/cpufreq/qcom-cpufreq-hw.c           |   4 +-
 drivers/cpufreq/scmi-cpufreq.c              |  13 +-
 drivers/cpufreq/scpi-cpufreq.c              |   4 +-
 drivers/cpufreq/vexpress-spc-cpufreq.c      |   4 +-
 drivers/gpu/drm/panfrost/panfrost_devfreq.c |   2 +-
 drivers/opp/of.c                            |  57 ++-
 drivers/thermal/cpufreq_cooling.c           |  10 +-
 drivers/thermal/devfreq_cooling.c           | 506 +++++++++++---------
 include/linux/devfreq_cooling.h             |  39 +-
 include/linux/energy_model.h                | 111 +++--
 include/linux/pm_opp.h                      |  15 +-
 include/trace/events/thermal.h              |  19 +-
 kernel/power/energy_model.c                 | 463 ++++++++++++++----
 kernel/sched/fair.c                         |   2 +-
 kernel/sched/topology.c                     |   4 +-
 21 files changed, 909 insertions(+), 501 deletions(-)


dri-devel mailing list

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2020-03-15 23:20 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-09 13:41 [PATCH v4 0/4] Add support for devices in the Energy Model Lukasz Luba
2020-03-09 13:41 ` [PATCH v4 1/4] PM / EM: add devices to " Lukasz Luba
2020-03-13 10:04   ` Quentin Perret
2020-03-13 10:05     ` Quentin Perret
2020-03-13 16:49     ` Lukasz Luba
2020-03-13 17:15       ` Quentin Perret
2020-03-09 13:41 ` [PATCH v4 2/4] OPP: change parameter to device pointer in dev_pm_opp_of_register_em() Lukasz Luba
2020-03-13 10:15   ` Quentin Perret
2020-03-13 17:11     ` Lukasz Luba
2020-03-13 17:16       ` Quentin Perret
2020-03-09 13:41 ` [PATCH v4 3/4] thermal: devfreq_cooling: Refactor code and switch to use Energy Model Lukasz Luba
2020-03-09 13:41 ` [PATCH v4 4/4] drm/panfrost: Register devfreq cooling and attempt to add " Lukasz Luba
2020-03-09 14:15   ` Steven Price
2020-03-13 16:51     ` Lukasz Luba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).