1 |
From 4f3085f87b51a551a0647f218d4f324796ecb703 Mon Sep 17 00:00:00 2001 |
2 |
From: Perry Yuan <perry.yuan@amd.com> |
3 |
Date: Tue, 10 Jan 2023 23:10:29 +0800 |
4 |
Subject: cpufreq: amd-pstate: fix kernel hang issue while amd-pstate unregistering |
5 |
|
6 |
From: Perry Yuan <perry.yuan@amd.com> |
7 |
|
8 |
commit 4f3085f87b51a551a0647f218d4f324796ecb703 upstream. |
9 |
|
10 |
In the amd_pstate_adjust_perf(), there is one cpufreq_cpu_get() call to |
11 |
increase increments the kobject reference count of policy and make it as |
12 |
busy. Therefore, a corresponding call to cpufreq_cpu_put() is needed to |
13 |
decrement the kobject reference count back, it will resolve the kernel |
14 |
hang issue when unregistering the amd-pstate driver and register the |
15 |
`amd_pstate_epp` driver instance. |
16 |
|
17 |
Fixes: 1d215f0319 ("cpufreq: amd-pstate: Add fast switch function for AMD P-State") |
18 |
Acked-by: Huang Rui <ray.huang@amd.com> |
19 |
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com> |
20 |
Tested-by: Wyes Karny <wyes.karny@amd.com> |
21 |
Signed-off-by: Perry Yuan <perry.yuan@amd.com> |
22 |
Cc: 5.17+ <stable@vger.kernel.org> # 5.17+ |
23 |
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> |
24 |
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
25 |
--- |
26 |
drivers/cpufreq/amd-pstate.c | 1 + |
27 |
1 file changed, 1 insertion(+) |
28 |
|
29 |
--- a/drivers/cpufreq/amd-pstate.c |
30 |
+++ b/drivers/cpufreq/amd-pstate.c |
31 |
@@ -307,6 +307,7 @@ static void amd_pstate_adjust_perf(unsig |
32 |
max_perf = min_perf; |
33 |
|
34 |
amd_pstate_update(cpudata, min_perf, des_perf, max_perf, true); |
35 |
+ cpufreq_cpu_put(policy); |
36 |
} |
37 |
|
38 |
static int amd_get_min_freq(struct amd_cpudata *cpudata) |