[PATCH v2 3/4] cpufreq/amd-pstate: Update asym_prefer_cpu when core rankings change

K Prateek Nayak posted 4 patches 10 months ago
[PATCH v2 3/4] cpufreq/amd-pstate: Update asym_prefer_cpu when core rankings change
Posted by K Prateek Nayak 10 months ago
A subset of AMD systems supporting Preferred Core rankings can have
their rankings changed dynamically at runtime. Update the
"sg->asym_prefer_cpu" across the local hierarchy of CPU when the
preferred core ranking changes.

Signed-off-by: K Prateek Nayak <kprateek.nayak@amd.com>
---
 drivers/cpufreq/amd-pstate.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
index 6789eed1bb5b..8796217ccc60 100644
--- a/drivers/cpufreq/amd-pstate.c
+++ b/drivers/cpufreq/amd-pstate.c
@@ -844,8 +844,10 @@ static void amd_pstate_update_limits(unsigned int cpu)
 	if (highest_perf_changed) {
 		WRITE_ONCE(cpudata->prefcore_ranking, cur_high);
 
-		if (cur_high < CPPC_MAX_PERF)
+		if (cur_high < CPPC_MAX_PERF) {
 			sched_set_itmt_core_prio((int)cur_high, cpu);
+			sched_update_asym_prefer_cpu(cpu, prev_high, cur_high);
+		}
 	}
 }
 
-- 
2.34.1
Re: [PATCH v2 3/4] cpufreq/amd-pstate: Update asym_prefer_cpu when core rankings change
Posted by Mario Limonciello 10 months ago
On 4/9/2025 12:34 AM, K Prateek Nayak wrote:
> A subset of AMD systems supporting Preferred Core rankings can have
> their rankings changed dynamically at runtime. Update the
> "sg->asym_prefer_cpu" across the local hierarchy of CPU when the
> preferred core ranking changes.
> 
> Signed-off-by: K Prateek Nayak <kprateek.nayak@amd.com>
Acked-by: Mario Limonciello <mario.limonciello@amd.com>
> ---
>   drivers/cpufreq/amd-pstate.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
> index 6789eed1bb5b..8796217ccc60 100644
> --- a/drivers/cpufreq/amd-pstate.c
> +++ b/drivers/cpufreq/amd-pstate.c
> @@ -844,8 +844,10 @@ static void amd_pstate_update_limits(unsigned int cpu)
>   	if (highest_perf_changed) {
>   		WRITE_ONCE(cpudata->prefcore_ranking, cur_high);
>   
> -		if (cur_high < CPPC_MAX_PERF)
> +		if (cur_high < CPPC_MAX_PERF) {
>   			sched_set_itmt_core_prio((int)cur_high, cpu);
> +			sched_update_asym_prefer_cpu(cpu, prev_high, cur_high);
> +		}
>   	}
>   }
>
[tip: sched/core] cpufreq/amd-pstate: Update asym_prefer_cpu when core rankings change
Posted by tip-bot2 for K Prateek Nayak 9 months, 4 weeks ago
The following commit has been merged into the sched/core branch of tip:

Commit-ID:     8157fbc907452aa5674df2de23c1c7305c907006
Gitweb:        https://git.kernel.org/tip/8157fbc907452aa5674df2de23c1c7305c907006
Author:        K Prateek Nayak <kprateek.nayak@amd.com>
AuthorDate:    Wed, 09 Apr 2025 05:34:45 
Committer:     Peter Zijlstra <peterz@infradead.org>
CommitterDate: Wed, 16 Apr 2025 21:09:11 +02:00

cpufreq/amd-pstate: Update asym_prefer_cpu when core rankings change

A subset of AMD systems supporting Preferred Core rankings can have
their rankings changed dynamically at runtime. Update the
"sg->asym_prefer_cpu" across the local hierarchy of CPU when the
preferred core ranking changes.

Signed-off-by: K Prateek Nayak <kprateek.nayak@amd.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Mario Limonciello <mario.limonciello@amd.com>
Link: https://lore.kernel.org/r/20250409053446.23367-4-kprateek.nayak@amd.com
---
 drivers/cpufreq/amd-pstate.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
index 6789eed..8796217 100644
--- a/drivers/cpufreq/amd-pstate.c
+++ b/drivers/cpufreq/amd-pstate.c
@@ -844,8 +844,10 @@ static void amd_pstate_update_limits(unsigned int cpu)
 	if (highest_perf_changed) {
 		WRITE_ONCE(cpudata->prefcore_ranking, cur_high);
 
-		if (cur_high < CPPC_MAX_PERF)
+		if (cur_high < CPPC_MAX_PERF) {
 			sched_set_itmt_core_prio((int)cur_high, cpu);
+			sched_update_asym_prefer_cpu(cpu, prev_high, cur_high);
+		}
 	}
 }