Skip to contentSkip to conversation

cpufreq: amd-pstate: fix kernel hang issue while amd-pstate unregistering

PATCH Superseded Perry Yuan 2 participants 2 messages Jan 6, 2023 – Jan 9, 2023

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Perry Yuan

author reviewer
#0 lore raw

PATCH 1/1 cpufreq: amd-pstate: fix kernel hang issue while amd-pstate unregistering

In the amd_pstate_adjust_perf(), there is one cpufreq_cpu_get() call to increase increments the kobject reference count of policy and make it as busy. Therefore, a corresponding call to cpufreq_cpu_put() is needed to decrement the kobject reference count back, it will resolve the kernel hang issue when unregistering the amd-pstate driver and register the amd_pstate_epp driver instance.

---
 drivers/cpufreq/amd-pstate.c | 1 +
 1 file changed, 1 insertion(+)
drivers/cpufreq/amd-pstate.c +1 -0
index 204e39006dda..c17bd845f5fc 100644
@@ -307,6 +307,7 @@ static void amd_pstate_adjust_perf(unsigned int cpu,
 		max_perf = min_perf;
 
 	amd_pstate_update(cpudata, min_perf, des_perf, max_perf, true);
+	cpufreq_cpu_put(policy);
 }
 
 static int amd_get_min_freq(struct amd_cpudata *cpudata)
Signature · 1 line
2.34.1
Tested-by on v1 1/1
#1 lore raw
Quoted 10 lines · Perry Yuan

In the amd_pstate_adjust_perf(), there is one cpufreq_cpu_get() call to increase increments the kobject reference count of policy and make it as busy. Therefore, a corresponding call to cpufreq_cpu_put() is needed to decrement the kobject reference count back, it will resolve the kernel hang issue when unregistering the amd-pstate driver and register the amd_pstate_epp driver instance.

Quoted 17 lines
---
 drivers/cpufreq/amd-pstate.c | 1 +
 1 file changed, 1 insertion(+)
drivers/cpufreq/amd-pstate.c +1 -0
index 204e39006dda..c17bd845f5fc 100644
@@ -307,6 +307,7 @@ static void amd_pstate_adjust_perf(unsigned int cpu,
 		max_perf = min_perf;
 
 	amd_pstate_update(cpudata, min_perf, des_perf, max_perf, true);
+	cpufreq_cpu_put(policy);
 }
 
 static int amd_get_min_freq(struct amd_cpudata *cpudata)
Signature · 2 lines
Thanks & Regards,
Wyes