[tip: sched/urgent] x86, sched: Move check for CPU type to caller function

From: tip-bot2 for Giovanni Gherdovich
Date: Wed Apr 22 2020 - 17:21:09 EST


The following commit has been merged into the sched/urgent branch of tip:

Commit-ID: db441bd9f630329c402d5cdd319f11bfcf509fb6
Gitweb: https://git.kernel.org/tip/db441bd9f630329c402d5cdd319f11bfcf509fb6
Author: Giovanni Gherdovich <ggherdovich@xxxxxxx>
AuthorDate: Thu, 16 Apr 2020 07:47:45 +02:00
Committer: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
CommitterDate: Wed, 22 Apr 2020 23:10:13 +02:00

x86, sched: Move check for CPU type to caller function

Improve readability of the function intel_set_max_freq_ratio() by moving
the check for KNL CPUs there, together with checks for GLM and SKX.

Signed-off-by: Giovanni Gherdovich <ggherdovich@xxxxxxx>
Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
Link: https://lkml.kernel.org/r/20200416054745.740-5-ggherdovich@xxxxxxx
---
arch/x86/kernel/smpboot.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index dd8e15f..8c89e4d 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -1877,9 +1877,6 @@ static bool knl_set_max_freq_ratio(u64 *base_freq, u64 *turbo_freq,
int err, i;
u64 msr;

- if (!x86_match_cpu(has_knl_turbo_ratio_limits))
- return false;
-
err = rdmsrl_safe(MSR_PLATFORM_INFO, base_freq);
if (err)
return false;
@@ -1977,7 +1974,8 @@ static bool intel_set_max_freq_ratio(void)
skx_set_max_freq_ratio(&base_freq, &turbo_freq, 1))
goto out;

- if (knl_set_max_freq_ratio(&base_freq, &turbo_freq, 1))
+ if (x86_match_cpu(has_knl_turbo_ratio_limits) &&
+ knl_set_max_freq_ratio(&base_freq, &turbo_freq, 1))
goto out;

if (x86_match_cpu(has_skx_turbo_ratio_limits) &&