Re: [PATCH] powercap: DTPM: Fix the missing cpufreq_cpu_put() calls

From: Lukasz Luba
Date: Fri Dec 01 2023 - 09:01:44 EST


Hi Greg,

On 12/1/23 12:44, Greg KH wrote:
On Fri, Dec 01, 2023 at 12:32:05PM +0000, Lukasz Luba wrote:
The policy returned by cpufreq_cpu_get() has to be released with
the help of cpufreq_cpu_put() to balance its kobject reference counter
properly.

Add the missing calls to cpufreq_cpu_put() in the code.

Fixes: 0aea2e4ec2a2 ("powercap/dtpm_cpu: Reset per_cpu variable in the release function")
Fixes: 0e8f68d7f048 ("powercap/drivers/dtpm: Add CPU energy model based support")
Cc: <stable@xxxxxxxxxxxxxxx> # v5.10+

But the Fixes: tags are for commits that are only in 5.12 and newer, how
can this be relevant for 5.10?

My apologies, you're right. Somehow I checked that this dtpm_cpu.c
was introduced in v5.10. It was in v5.12 indeed. I messed that up.

Also, the code in that v5.12 had different implementation and there was
a function cpuhp_dtpm_cpu_offline() which had the cpufreq_cpu_get().

I can craft for that v5.12 special extra patch fix addressing it and
send directly to stable list. Would that make sense?

So this patch would only be applicable for v5.16+ AFAICS.

Regards,
Lukasz