Skip to content

Commit 9926bbe

Browse files
lukaszluba-armrafaeljw
authored andcommitted
thermal: cooling: Check Energy Model type in cpufreq_cooling and devfreq_cooling
The Energy Model can now be artificial, which means the power values are mathematically generated to leverage EAS while not expected to be on an uniform scale with other devices providing power information. If this EM type is in use, the thermal governor IPA should not be allowed to operate, since the relation between cooling devices is not properly defined. Thus, it might be possible that big GPU has lower power values than a Little CPU. To mitigate a misbehaviour of the thermal control algorithm, simply do not register the cooling device as IPA's power actor. Signed-off-by: Lukasz Luba <lukasz.luba@arm.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Ionela Voinescu <ionela.voinescu@arm.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 015f569 commit 9926bbe

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

drivers/thermal/cpufreq_cooling.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ static inline bool em_is_sane(struct cpufreq_cooling_device *cpufreq_cdev,
328328
struct cpufreq_policy *policy;
329329
unsigned int nr_levels;
330330

331-
if (!em)
331+
if (!em || em_is_artificial(em))
332332
return false;
333333

334334
policy = cpufreq_cdev->policy;

drivers/thermal/devfreq_cooling.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@ of_devfreq_cooling_register_power(struct device_node *np, struct devfreq *df,
358358
struct thermal_cooling_device *cdev;
359359
struct device *dev = df->dev.parent;
360360
struct devfreq_cooling_device *dfc;
361+
struct em_perf_domain *em;
361362
char *name;
362363
int err, num_opps;
363364

@@ -367,8 +368,9 @@ of_devfreq_cooling_register_power(struct device_node *np, struct devfreq *df,
367368

368369
dfc->devfreq = df;
369370

370-
dfc->em_pd = em_pd_get(dev);
371-
if (dfc->em_pd) {
371+
em = em_pd_get(dev);
372+
if (em && !em_is_artificial(em)) {
373+
dfc->em_pd = em;
372374
devfreq_cooling_ops.get_requested_power =
373375
devfreq_cooling_get_requested_power;
374376
devfreq_cooling_ops.state2power = devfreq_cooling_state2power;
@@ -379,7 +381,7 @@ of_devfreq_cooling_register_power(struct device_node *np, struct devfreq *df,
379381
num_opps = em_pd_nr_perf_states(dfc->em_pd);
380382
} else {
381383
/* Backward compatibility for drivers which do not use IPA */
382-
dev_dbg(dev, "missing EM for cooling device\n");
384+
dev_dbg(dev, "missing proper EM for cooling device\n");
383385

384386
num_opps = dev_pm_opp_get_opp_count(dev);
385387

0 commit comments

Comments
 (0)