[PATCH v3 0/5] Thermal devfreq cooling improvements with Energy Model

From: Lukasz Luba
Date: Wed Dec 09 2020 - 05:32:02 EST


Hi all,

This patch set is a continuation of my previous work, which aimed
to add Energy Model to all devices [1]. This series is a follow up
for the patches which got merged to v5.9-rc1. It aims to change
the thermal devfreq cooling and use the Energy Model instead of
private power table and structures. The power model is now simplified,
static power and dynamic power are removed. The new registration interface
in the patch 3/5 helps to register devfreq cooling and the EM in one call.
There is also small improvement, patch 2/5 is changing the way how
thermal gets the device status (now uses a copy) and normalize the values.
The last patch is here for consistency and will probably go through drm tree.

The patch set is based on current next-20201208, because it depends on EM
API change which is queued in the pm/linux-next tree as v5.11 material.

changes:
v3:
- dropped direct check of device status and used just a copy of 'status';
a separate patch set will be proposed to address this issue
- modified _normalize_load() and used 1024 scale to handle ms, us, ns
- removed 'em_registered' and called em_dev_unregister_perf_domain()
unconditionally, so the drivers will have to make sure the right order of
all unregister calls to frameworks which might use EM; this call must be last
one; a proper comment added
- removed 'em' pointer from struct devfreq_cooling_device, 'dev->em_pd' is used
- removed of_node_get/put(), since the code can handle it
- removed dfc_em_get_requested_power() (as missed to do it in v2)
- collected all Reviewed-by tags
v2 [3]:
- renamed freq_get_state() and related to perf_idx pattern as
suggested by Ionela
v1 [2]

Regards,
Lukasz Luba

[1] https://lkml.org/lkml/2020/5/11/326
[2] https://lore.kernel.org/linux-pm/20200921122007.29610-1-lukasz.luba@xxxxxxx/
[3] https://lore.kernel.org/linux-pm/20201118120358.17150-1-lukasz.luba@xxxxxxx/

Lukasz Luba (5):
thermal: devfreq_cooling: change tracing function and arguments
thermal: devfreq_cooling: use a copy of device status
thermal: devfreq_cooling: add new registration functions with Energy
Model
thermal: devfreq_cooling: remove old power model and use EM
drm/panfrost: Register devfreq cooling and attempt to add Energy Model

drivers/gpu/drm/panfrost/panfrost_devfreq.c | 2 +-
drivers/thermal/devfreq_cooling.c | 420 ++++++++++----------
include/linux/devfreq_cooling.h | 40 +-
include/trace/events/thermal.h | 19 +-
4 files changed, 240 insertions(+), 241 deletions(-)

--
2.17.1