As pointed out by Sashiko[*], kvmclock_init() runs before __setup() and
thus before notsc_setup() or tsc_setup() can mark the TSC unstable.
kvmclock_init() also runs well before tsc_init(), and even before
tsc_early_init(). Simply delete the check, as it's been dead code since
it was introduced.
Note, odds are good the check_tsc_unstable() call was copied from Xen's
xen_time_init()+xen_tsc_safe_clocksource() logic (as so much of KVM's PV
code was). However, xen_time_init() runs via x86_init.timers.timer_init(),
which is invoke from x86_late_time_init(), and thus after params have been
parsed.
Alternatively, kvmclock could register itself later on, or tsc_setup()
could be parsed as an early param. Given that there's zero evidence there
was any meaningful intent or need to actually check for an unstable TSC,
go with the simplest option.
Fixes: 7539b174aef4 ("x86: kvmguest: use TSC clocksource if invariant TSC is
exposed")
Link: https://lore.kernel.org/all/[email protected]
[*]
Signed-off-by: Sean Christopherson <[email protected]>
---
arch/x86/kernel/kvmclock.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c
index 061a22d31dea..29ca37e9a3bc 100644
--- a/arch/x86/kernel/kvmclock.c
+++ b/arch/x86/kernel/kvmclock.c
@@ -362,8 +362,7 @@ void __init kvmclock_init(void)
*
*/
if (boot_cpu_has(X86_FEATURE_CONSTANT_TSC) &&
- boot_cpu_has(X86_FEATURE_NONSTOP_TSC) &&
- !check_tsc_unstable())
+ boot_cpu_has(X86_FEATURE_NONSTOP_TSC))
kvm_clock.rating = 299;
clocksource_register_hz(&kvm_clock, NSEC_PER_SEC);
--
2.55.0.rc0.799.gd6f94ed593-goog