Skip to content

Commit fc3a9a9

Browse files
pierregondoisrafaeljw
authored andcommitted
PM: EM: Add artificial EM flag
The Energy Model (EM) can be used on platforms which are missing real power information. Those platforms would implement .get_cost() which populates needed values for the Energy Aware Scheduler (EAS). The EAS doesn't use 'power' fields from EM, but other frameworks might use them. Thus, to avoid miss-usage of this specific type of EM, introduce a new flags which can be checked by other frameworks. Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com> Signed-off-by: Lukasz Luba <lukasz.luba@arm.com> Reviewed-by: Ionela Voinescu <ionela.voinescu@arm.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent bdc21a4 commit fc3a9a9

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

include/linux/energy_model.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,16 @@ struct em_perf_domain {
6767
*
6868
* EM_PERF_DOMAIN_SKIP_INEFFICIENCIES: Skip inefficient states when estimating
6969
* energy consumption.
70+
*
71+
* EM_PERF_DOMAIN_ARTIFICIAL: The power values are artificial and might be
72+
* created by platform missing real power information
7073
*/
7174
#define EM_PERF_DOMAIN_MILLIWATTS BIT(0)
7275
#define EM_PERF_DOMAIN_SKIP_INEFFICIENCIES BIT(1)
76+
#define EM_PERF_DOMAIN_ARTIFICIAL BIT(2)
7377

7478
#define em_span_cpus(em) (to_cpumask((em)->cpus))
79+
#define em_is_artificial(em) ((em)->flags & EM_PERF_DOMAIN_ARTIFICIAL)
7580

7681
#ifdef CONFIG_ENERGY_MODEL
7782
#define EM_MAX_POWER 0xFFFF

kernel/power/energy_model.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,8 @@ int em_dev_register_perf_domain(struct device *dev, unsigned int nr_states,
384384

385385
if (milliwatts)
386386
dev->em_pd->flags |= EM_PERF_DOMAIN_MILLIWATTS;
387+
else if (cb->get_cost)
388+
dev->em_pd->flags |= EM_PERF_DOMAIN_ARTIFICIAL;
387389

388390
em_cpufreq_update_efficiencies(dev);
389391

0 commit comments

Comments
 (0)