Skip to contentSkip to conversation

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

PATCH Superseded Perry Yuan 2 participants 3 messages Jan 10, 2023

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Perry Yuan

author reviewer
#0 lore raw

PATCH v2 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
#1 lore raw
Quoted 8 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 5 lines

Can you provide a Fixes tag, please?

Also, what's the difference between this and the previous version?

Quoted 19 lines
---
 drivers/cpufreq/amd-pstate.c | 1 +
 1 file changed, 1 insertion(+)
drivers/cpufreq/amd-pstate.c +1 -1
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)
--

2.34.1

author reviewer
#2 lore raw

[AMD Official Use Only - General]

Hi Rafael:

Quoted 24 lines

-----Original Message-----
From: Rafael J. Wysocki <[email protected]>
Sent: Tuesday, January 10, 2023 8:58 PM
To: Yuan, Perry <[email protected]>
Cc: [email protected]; Limonciello, Mario <[email protected]>; Huang, Ray <[email protected]>; [email protected]; Sharma, Deepak <[email protected]>; Fontenot, Nathan <[email protected]>; Deucher, Alexander <[email protected]>; Huang, Shimmer <[email protected]>; Du, Xiaojian <[email protected]>; Meng, Li (Jassmine) <[email protected]>; Karny, Wyes <[email protected]>; [email protected]; [email protected]
Subject: Re: [PATCH v2] cpufreq: amd-pstate: fix kernel hang issue while amd-pstate unregistering

Quoted 8 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 7 lines
Quoted 5 lines

Can you provide a Fixes tag, please?

Sure, let me add the Fixes tag in v3

Quoted 2 lines

Also, what's the difference between this and the previous version?

Just add the "Tested-by: Wyes Karny <[email protected]>" in v2.

Quoted 22 lines

drivers/cpufreq/amd-pstate.c static void amd_pstate_adjust_perf(unsigned int

Quoted 10 lines
---
 drivers/cpufreq/amd-pstate.c | 1 +
 1 file changed, 1 insertion(+)
(quoted diff) +0 -0

b/drivers/cpufreq/amd-pstate.c index 204e39006dda..c17bd845f5fc 100644

drivers/cpufreq/amd-pstate.c +0 -0
@@ -307,6 +307,7 @@ static void amd_pstate_adjust_perf(unsigned int

cpu,

Quoted 11 lines
drivers/cpufreq/amd-pstate.c +1 -0
                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)
--
2.34.1