Skip to content

Commit 51beea8

Browse files
gghhPeter Zijlstra
authored andcommitted
x86, sched: Bail out of frequency invariance if turbo frequency is unknown
There may be CPUs that support turbo boost but don't declare any turbo ratio, i.e. their MSR_TURBO_RATIO_LIMIT is all zeroes. In that condition scale-invariant calculations can't be performed. Fixes: 1567c3e ("x86, sched: Add support for frequency invariance") Suggested-by: Ricardo Neri <[email protected]> Signed-off-by: Giovanni Gherdovich <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Reviewed-by: Rafael J. Wysocki <[email protected]> Tested-by: Ricardo Neri <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent e2b0d61 commit 51beea8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

arch/x86/kernel/smpboot.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2002,9 +2002,11 @@ static bool intel_set_max_freq_ratio(void)
20022002
/*
20032003
* Some hypervisors advertise X86_FEATURE_APERFMPERF
20042004
* but then fill all MSR's with zeroes.
2005+
* Some CPUs have turbo boost but don't declare any turbo ratio
2006+
* in MSR_TURBO_RATIO_LIMIT.
20052007
*/
2006-
if (!base_freq) {
2007-
pr_debug("Couldn't determine cpu base frequency, necessary for scale-invariant accounting.\n");
2008+
if (!base_freq || !turbo_freq) {
2009+
pr_debug("Couldn't determine cpu base or turbo frequency, necessary for scale-invariant accounting.\n");
20082010
return false;
20092011
}
20102012

0 commit comments

Comments
 (0)