Re: [PATCH v7 22/23] PM: EM: Add em_dev_compute_costs()

From: Dietmar Eggemann
Date: Mon Jan 29 2024 - 13:16:02 EST


On 17/01/2024 10:57, Lukasz Luba wrote:

[...]

> diff --git a/kernel/power/energy_model.c b/kernel/power/energy_model.c
> index e91c8efb5361..104cc2e2aa84 100644
> --- a/kernel/power/energy_model.c
> +++ b/kernel/power/energy_model.c
> @@ -276,6 +276,24 @@ static int em_compute_costs(struct device *dev, struct em_perf_state *table,
> return 0;
> }
>
> +/**
> + * em_dev_compute_costs() - Calculate cost values for new runtime EM table
> + * @dev : Device for which the EM table is to be updated
> + * @table : The new EM table that is going to get the costs calculated
> + *
> + * Calculate the em_perf_state::cost values for new runtime EM table. The
> + * values are used for EAS during task placement. It also calculates and sets
> + * the efficiency flag for each performance state. When the function finish
> + * successfully the EM table is ready to be updated and used by EAS.
> + *
> + * Return 0 on success or a proper error in case of failure.
> + */
> +int em_dev_compute_costs(struct device *dev, struct em_perf_state *table,
> + int nr_states)
> +{
> + return em_compute_costs(dev, table, NULL, nr_states, 0);
> +}
> +

Still no user of this function in this patch-set so it could be
introduced with the follow-up patch 'OPP: Add API to update EM after
adjustment of voltage for OPPs'. Especially now since Viresh and you
have agreed that this should be part of the EM code as well:

https://lkml.kernel.org/r/a42ae8dd-383c-43c0-88b4-101303d6f548@xxxxxxx