Skip to contentSkip to conversation

cpufreq: amd_pstate: map desired perf into pstate scope for powersave governor

PATCH Superseded Perry Yuan 2 participants 3 messages Jul 9, 2022 – Jul 12, 2022

Subsystems (2)

v2 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Perry Yuan

author reviewer
#0 lore raw

PATCH v2 7/14 cpufreq: amd_pstate: map desired perf into pstate scope for powersave governor

The patch will fix the invalid desired perf value for powersave governor. This issue is found when testing on one AMD EPYC system, the actual des_perf is smaller than the min_perf value, that is invalid value. because the min_perf is the lowest_perf system can support in idle state.

---
 drivers/cpufreq/amd-pstate.c | 1 +
 1 file changed, 1 insertion(+)
drivers/cpufreq/amd-pstate.c +1 -0
index 7c51f4125263..8a2b6ad9b8c0 100644
@@ -265,6 +265,7 @@ static void amd_pstate_update(struct amd_cpudata *cpudata, u32 min_perf,
 	u64 prev = READ_ONCE(cpudata->cppc_req_cached);
 	u64 value = prev;
 
+	des_perf = clamp_t(unsigned long, des_perf, min_perf, max_perf);
 	value &= ~AMD_CPPC_MIN_PERF(~0L);
 	value |= AMD_CPPC_MIN_PERF(min_perf);
 
Signature · 1 line
2.25.1
#1 lore raw
Quoted 16 lines · Perry Yuan

The patch will fix the invalid desired perf value for powersave governor. This issue is found when testing on one AMD EPYC system, the actual des_perf is smaller than the min_perf value, that is invalid value. because the min_perf is the lowest_perf system can support in idle state.

---
 drivers/cpufreq/amd-pstate.c | 1 +
 1 file changed, 1 insertion(+)
drivers/cpufreq/amd-pstate.c +0 -0
index 7c51f4125263..8a2b6ad9b8c0 100644

drivers/cpufreq/amd-pstate.c static void amd_pstate_update(struct amd_cpudata *cpudata, u32 min_perf, · line 268

Quoted 4 lines
drivers/cpufreq/amd-pstate.c +1 -0
@@ -265,6 +265,7 @@ static void amd_pstate_update(struct amd_cpudata *cpudata, u32 min_perf,
 	u64 prev = READ_ONCE(cpudata->cppc_req_cached);
 	u64 value = prev;
 
+	des_perf = clamp_t(unsigned long, des_perf, min_perf, max_perf);

You should also update amd_pstate_adjust_perf() to remove the clamp_t() call now that it is done here.

-Nathan

Quoted 3 lines
drivers/cpufreq/amd-pstate.c +0 -0
 	value &= ~AMD_CPPC_MIN_PERF(~0L);
 	value |= AMD_CPPC_MIN_PERF(min_perf);
 
author reviewer
#2 lore raw

[AMD Official Use Only - General]

Hi Nathan.

Quoted 37 lines

-----Original Message-----
From: Fontenot, Nathan <[email protected]>
Sent: Tuesday, July 12, 2022 3:34 AM
To: Yuan, Perry <[email protected]>; [email protected]; [email protected]; Huang, Ray <[email protected]>
Cc: Sharma, Deepak <[email protected]>; Limonciello, Mario <[email protected]>; Fontenot, Nathan <[email protected]>; Deucher, Alexander <[email protected]>; Su, Jinzhou (Joe) <[email protected]>; Huang, Shimmer <[email protected]>; Du, Xiaojian <[email protected]>; Meng, Li (Jassmine) <[email protected]>; linux- [email protected]; [email protected]
Subject: Re: [PATCH v2 07/14] cpufreq: amd_pstate: map desired perf into pstate scope for powersave governor

Quoted 6 lines · Perry Yuan

The patch will fix the invalid desired perf value for powersave governor. This issue is found when testing on one AMD EPYC system, the actual des_perf is smaller than the min_perf value, that is invalid value. because the min_perf is the lowest_perf system can support in idle state.

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

b/drivers/cpufreq/amd-pstate.c index 7c51f4125263..8a2b6ad9b8c0

100644

drivers/cpufreq/amd-pstate.c static void amd_pstate_update(struct

Quoted 3 lines
drivers/cpufreq/amd-pstate.c +0 -0
@@ -265,6 +265,7 @@ static void amd_pstate_update(struct

amd_cpudata *cpudata, u32 min_perf,

Quoted 3 lines
drivers/cpufreq/amd-pstate.c +0 -0
 	u64 prev = READ_ONCE(cpudata->cppc_req_cached);
 	u64 value = prev;
 
Quoted 6 lines

drivers/cpufreq/amd-pstate.c static void amd_pstate_update(struct amd_cpudata *cpudata, u32 min_perf, · line 268

Quoted 1 line
drivers/cpufreq/amd-pstate.c +1 -0
+	des_perf = clamp_t(unsigned long, des_perf, min_perf, max_perf);

You should also update amd_pstate_adjust_perf() to remove the clamp_t() call now that it is done here.

-Nathan

I missed that, changed into V3.
Thank you!

Perry.

Quoted 4 lines
Quoted 4 lines
drivers/cpufreq/amd-pstate.c +0 -0
 	value &= ~AMD_CPPC_MIN_PERF(~0L);
 	value |= AMD_CPPC_MIN_PERF(min_perf);