mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v1] PM: EM: Decrement policy counter
@ 2022-04-26 14:44 Pierre Gondois
  2022-04-26 15:40 ` Vincent Donnefort
  0 siblings, 1 reply; 3+ messages in thread
From: Pierre Gondois @ 2022-04-26 14:44 UTC (permalink / raw)
  To: linux-kernel
  Cc: cristian.marussi, Ionela.Voinescu, Dietmar.Eggemann,
	Pierre Gondois, Pierre Gondois, Rafael J. Wysocki, Pavel Machek,
	Len Brown, Viresh Kumar, Vincent Donnefort, linux-pm

From: Pierre Gondois <Pierre.Gondois@arm.com>

Fixes: e458716a92b57 ("PM: EM: Mark inefficiencies in CPUFreq")
In the above commit, cpufreq_cpu_get() is called without
a cpufreq_cpu_put(), permanently increasing the reference counts
of the policy struct.
Decrement the reference count once the policy struct is not used
anymore.

Tested-by: Cristian Marussi <cristian.marussi@arm.com>
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
---
 kernel/power/energy_model.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/power/energy_model.c b/kernel/power/energy_model.c
index 0153b0ca7b23..6219aaa454b5 100644
--- a/kernel/power/energy_model.c
+++ b/kernel/power/energy_model.c
@@ -259,6 +259,8 @@ static void em_cpufreq_update_efficiencies(struct device *dev)
 			found++;
 	}
 
+	cpufreq_cpu_put(policy);
+
 	if (!found)
 		return;
 
-- 
2.25.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] PM: EM: Decrement policy counter
  2022-04-26 14:44 [PATCH v1] PM: EM: Decrement policy counter Pierre Gondois
@ 2022-04-26 15:40 ` Vincent Donnefort
  2022-05-11 17:17   ` Rafael J. Wysocki
  0 siblings, 1 reply; 3+ messages in thread
From: Vincent Donnefort @ 2022-04-26 15:40 UTC (permalink / raw)
  To: Pierre Gondois, linux-kernel
  Cc: cristian.marussi, Ionela.Voinescu, Dietmar.Eggemann,
	Rafael J. Wysocki, Pavel Machek, Len Brown, Viresh Kumar,
	linux-pm

On 26/04/2022 15:44, Pierre Gondois wrote:
> From: Pierre Gondois <Pierre.Gondois@arm.com>
> 
> Fixes: e458716a92b57 ("PM: EM: Mark inefficiencies in CPUFreq")
> In the above commit, cpufreq_cpu_get() is called without
> a cpufreq_cpu_put(), permanently increasing the reference counts
> of the policy struct.
> Decrement the reference count once the policy struct is not used
> anymore.


Not sure if the tag there will be caught properly. Usually it goes on
top of the Signed-off-by.

While at it:

Reviewed-by: Vincent Donnefort <vincent.donnefort@arm.com>

Thanks for fixing this.

> 
> Tested-by: Cristian Marussi <cristian.marussi@arm.com>
> Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
> ---
>   kernel/power/energy_model.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/kernel/power/energy_model.c b/kernel/power/energy_model.c
> index 0153b0ca7b23..6219aaa454b5 100644
> --- a/kernel/power/energy_model.c
> +++ b/kernel/power/energy_model.c
> @@ -259,6 +259,8 @@ static void em_cpufreq_update_efficiencies(struct device *dev)
>   			found++;
>   	}
>   
> +	cpufreq_cpu_put(policy);
> +
>   	if (!found)
>   		return;
>   

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] PM: EM: Decrement policy counter
  2022-04-26 15:40 ` Vincent Donnefort
@ 2022-05-11 17:17   ` Rafael J. Wysocki
  0 siblings, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2022-05-11 17:17 UTC (permalink / raw)
  To: Vincent Donnefort, Pierre Gondois
  Cc: Linux Kernel Mailing List, Cristian Marussi, Ionela Voinescu,
	Dietmar Eggemann, Rafael J. Wysocki, Pavel Machek, Len Brown,
	Viresh Kumar, Linux PM

On Tue, Apr 26, 2022 at 5:40 PM Vincent Donnefort
<vincent.donnefort@arm.com> wrote:
>
> On 26/04/2022 15:44, Pierre Gondois wrote:
> > From: Pierre Gondois <Pierre.Gondois@arm.com>
> >
> > Fixes: e458716a92b57 ("PM: EM: Mark inefficiencies in CPUFreq")
> > In the above commit, cpufreq_cpu_get() is called without
> > a cpufreq_cpu_put(), permanently increasing the reference counts
> > of the policy struct.
> > Decrement the reference count once the policy struct is not used
> > anymore.
>
>
> Not sure if the tag there will be caught properly. Usually it goes on
> top of the Signed-off-by.
>
> While at it:
>
> Reviewed-by: Vincent Donnefort <vincent.donnefort@arm.com>
>
> Thanks for fixing this.

Applied as 5.19 material, thanks!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-05-11 17:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-26 14:44 [PATCH v1] PM: EM: Decrement policy counter Pierre Gondois
2022-04-26 15:40 ` Vincent Donnefort
2022-05-11 17:17   ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®