Re: [PATCH v5 11/23] PM: EM: Add API for updating the runtime modifiable EM

Dietmar Eggemann
2023-12-12T18:50:38Z

On 29/11/2023 12:08, Lukasz Luba wrote:

[...]

> diff --git a/kernel/power/energy_model.c b/kernel/power/energy_model.c
> index 489a358b9a00..614891fde8df 100644
> --- a/kernel/power/energy_model.c
> +++ b/kernel/power/energy_model.c
> @@ -221,6 +221,52 @@ static int em_allocate_perf_table(struct em_perf_domain *pd,
> return 0;
> }
>
> +/**
> + * em_dev_update_perf_domain() - Update runtime EM table for a device
> + * @dev : Device for which the EM is to be updated
> + * @table : The new EM table that is going to used from now

s/going to used/going to be used

> + *
> + * Update EM runtime modifiable table for the @dev using the privided @table.

s/privided/provided

> + *
> + * This function uses mutex to serialize writers, so it must not be called
> + * from non-sleeping context.
> + *
> + * Return 0 on success or a proper error in case of failure.
> + */
> +int em_dev_update_perf_domain(struct device *dev,
> + struct em_perf_table __rcu *new_table)
> +{
> + struct em_perf_table __rcu *old_table;
> + struct em_perf_domain *pd;
> +
> + /*
> + * The lock serializes update and unregister code paths. When the
> + * EM has been unregistered in the meantime, we should capture that
> + * when entering this critical section. It also makes sure that

What do you want to capture here? You want to block in this moment,
right? Don't understand the 2. sentence here. …