[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPDyKFpLDEzv7V-jJ-9xVZ=XqEHDdtLFYQQm=Ld7e1h=GJ8a8A@mail.gmail.com>
Date: Wed, 16 Feb 2022 17:24:35 +0100
From: Ulf Hansson <ulf.hansson@...aro.org>
To: Daniel Lezcano <daniel.lezcano@...aro.org>
Cc: rjw@...ysocki.net, heiko@...ech.de, lukasz.luba@....com,
linux-kernel@...r.kernel.org, linux-pm@...r.kernel.org,
Daniel Lezcano <daniel.lezcano@...nel.org>,
"Rafael J. Wysocki" <rafael@...nel.org>
Subject: Re: [PATCH v1 2/7] powercap/dtpm_cpu: Reset per_cpu variable in the
release function
On Sun, 30 Jan 2022 at 22:02, Daniel Lezcano <daniel.lezcano@...aro.org> wrote:
>
> The release function does not reset the per cpu variable when it is
> called. That will prevent creation again as the variable will be
> already from the previous creation.
>
> Fix it by resetting them.
>
> Signed-off-by: Daniel Lezcano <daniel.lezcano@...aro.org>
Reviewed-by: Ulf Hansson <ulf.hansson@...aro.org>
Kind regards
Uffe
> ---
> drivers/powercap/dtpm_cpu.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/powercap/dtpm_cpu.c b/drivers/powercap/dtpm_cpu.c
> index eed5ad688d46..71f45d2f5a60 100644
> --- a/drivers/powercap/dtpm_cpu.c
> +++ b/drivers/powercap/dtpm_cpu.c
> @@ -151,10 +151,17 @@ static int update_pd_power_uw(struct dtpm *dtpm)
> static void pd_release(struct dtpm *dtpm)
> {
> struct dtpm_cpu *dtpm_cpu = to_dtpm_cpu(dtpm);
> + struct cpufreq_policy *policy;
>
> if (freq_qos_request_active(&dtpm_cpu->qos_req))
> freq_qos_remove_request(&dtpm_cpu->qos_req);
>
> + policy = cpufreq_cpu_get(dtpm_cpu->cpu);
> + if (policy) {
> + for_each_cpu(dtpm_cpu->cpu, policy->related_cpus)
> + per_cpu(dtpm_per_cpu, dtpm_cpu->cpu) = NULL;
> + }
> +
> kfree(dtpm_cpu);
> }
>
> --
> 2.25.1
>
Powered by blists - more mailing lists