[PATCH 01/17] PM: EM: Refactor em_cpufreq_update_efficiencies() arguments

Lukasz Luba posted 17 patches 2 years, 11 months ago
There is a newer version of this series
[PATCH 01/17] PM: EM: Refactor em_cpufreq_update_efficiencies() arguments
Posted by Lukasz Luba 2 years, 11 months ago
In order to prepare the code for the modifiable EM perf_state table,
refactor existing function em_cpufreq_update_efficiencies().

Signed-off-by: Lukasz Luba <lukasz.luba@arm.com>
---
 kernel/power/energy_model.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/kernel/power/energy_model.c b/kernel/power/energy_model.c
index f82111837b8d..265d51a948d4 100644
--- a/kernel/power/energy_model.c
+++ b/kernel/power/energy_model.c
@@ -240,10 +240,10 @@ static int em_create_pd(struct device *dev, int nr_states,
 	return 0;
 }
 
-static void em_cpufreq_update_efficiencies(struct device *dev)
+static void
+em_cpufreq_update_efficiencies(struct device *dev, struct em_perf_state *table)
 {
 	struct em_perf_domain *pd = dev->em_pd;
-	struct em_perf_state *table;
 	struct cpufreq_policy *policy;
 	int found = 0;
 	int i;
@@ -257,8 +257,6 @@ static void em_cpufreq_update_efficiencies(struct device *dev)
 		return;
 	}
 
-	table = pd->table;
-
 	for (i = 0; i < pd->nr_perf_states; i++) {
 		if (!(table[i].flags & EM_PERF_STATE_INEFFICIENT))
 			continue;
@@ -400,7 +398,7 @@ int em_dev_register_perf_domain(struct device *dev, unsigned int nr_states,
 
 	dev->em_pd->flags |= flags;
 
-	em_cpufreq_update_efficiencies(dev);
+	em_cpufreq_update_efficiencies(dev, dev->em_pd->table);
 
 	em_debug_create_pd(dev);
 	dev_info(dev, "EM: created perf domain\n");
-- 
2.17.1
Re: [PATCH 01/17] PM: EM: Refactor em_cpufreq_update_efficiencies() arguments
Posted by Rafael J. Wysocki 2 years, 10 months ago
On Tue, Mar 14, 2023 at 11:34 AM Lukasz Luba <lukasz.luba@arm.com> wrote:
>
> In order to prepare the code for the modifiable EM perf_state table,
> refactor existing function em_cpufreq_update_efficiencies().
>
> Signed-off-by: Lukasz Luba <lukasz.luba@arm.com>

Quite obviously, this series needs ACKs from the Energy Model people.

> ---
>  kernel/power/energy_model.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/kernel/power/energy_model.c b/kernel/power/energy_model.c
> index f82111837b8d..265d51a948d4 100644
> --- a/kernel/power/energy_model.c
> +++ b/kernel/power/energy_model.c
> @@ -240,10 +240,10 @@ static int em_create_pd(struct device *dev, int nr_states,
>         return 0;
>  }
>
> -static void em_cpufreq_update_efficiencies(struct device *dev)
> +static void
> +em_cpufreq_update_efficiencies(struct device *dev, struct em_perf_state *table)
>  {
>         struct em_perf_domain *pd = dev->em_pd;
> -       struct em_perf_state *table;
>         struct cpufreq_policy *policy;
>         int found = 0;
>         int i;
> @@ -257,8 +257,6 @@ static void em_cpufreq_update_efficiencies(struct device *dev)
>                 return;
>         }
>
> -       table = pd->table;
> -
>         for (i = 0; i < pd->nr_perf_states; i++) {
>                 if (!(table[i].flags & EM_PERF_STATE_INEFFICIENT))
>                         continue;
> @@ -400,7 +398,7 @@ int em_dev_register_perf_domain(struct device *dev, unsigned int nr_states,
>
>         dev->em_pd->flags |= flags;
>
> -       em_cpufreq_update_efficiencies(dev);
> +       em_cpufreq_update_efficiencies(dev, dev->em_pd->table);
>
>         em_debug_create_pd(dev);
>         dev_info(dev, "EM: created perf domain\n");
> --
> 2.17.1
>
Re: [PATCH 01/17] PM: EM: Refactor em_cpufreq_update_efficiencies() arguments
Posted by Lukasz Luba 2 years, 9 months ago
Hi Rafael,

On 3/27/23 18:16, Rafael J. Wysocki wrote:
> On Tue, Mar 14, 2023 at 11:34 AM Lukasz Luba <lukasz.luba@arm.com> wrote:
>>
>> In order to prepare the code for the modifiable EM perf_state table,
>> refactor existing function em_cpufreq_update_efficiencies().
>>
>> Signed-off-by: Lukasz Luba <lukasz.luba@arm.com>
> 
> Quite obviously, this series needs ACKs from the Energy Model people.
> 

My apologies, I have missed your email. Sure thing, we are going to
discuss this patch set on OSPM23. So hopefully that would help bring
some attention here and people would look at it or give it a try.

Regards,
Lukasz
Re: [PATCH 01/17] PM: EM: Refactor em_cpufreq_update_efficiencies() arguments
Posted by Pierre Gondois 2 years, 10 months ago

On 3/27/23 19:16, Rafael J. Wysocki wrote:
> On Tue, Mar 14, 2023 at 11:34 AM Lukasz Luba <lukasz.luba@arm.com> wrote:
>>
>> In order to prepare the code for the modifiable EM perf_state table,
>> refactor existing function em_cpufreq_update_efficiencies().
>>
>> Signed-off-by: Lukasz Luba <lukasz.luba@arm.com>
> 
> Quite obviously, this series needs ACKs from the Energy Model people.

FWIW, I tried the patch-set and everything was working well. I had
some small comments for some patches,

Regards,
Pierre
Re: [PATCH 01/17] PM: EM: Refactor em_cpufreq_update_efficiencies() arguments
Posted by Lukasz Luba 2 years, 9 months ago

On 4/11/23 16:43, Pierre Gondois wrote:
> 
> 
> On 3/27/23 19:16, Rafael J. Wysocki wrote:
>> On Tue, Mar 14, 2023 at 11:34 AM Lukasz Luba <lukasz.luba@arm.com> wrote:
>>>
>>> In order to prepare the code for the modifiable EM perf_state table,
>>> refactor existing function em_cpufreq_update_efficiencies().
>>>
>>> Signed-off-by: Lukasz Luba <lukasz.luba@arm.com>
>>
>> Quite obviously, this series needs ACKs from the Energy Model people.
> 
> FWIW, I tried the patch-set and everything was working well. I had
> some small comments for some patches,

Thanks Pierre!

> 
> Regards,
> Pierre