Re: [PATCH v6 19/51] x86/kvmclock: Drop dead check on TSC being unstable during kvmclock_init()

David Woodhouse <[email protected]> Sat, 08 Aug 2026 16:05:33 +0100
Newsgroups org.kernel.vger.linux-hyperv,dev.linux.lists.linux-coco,dev.linux.lists.virtualization,org.kernel.vger.kvm,org.kernel.vger.linux-kernel,org.xenproject.lists.xen-devel
Message-ID <[email protected]>
On Thu, 2026-08-06 at 16:35 -0700, Sean Christopherson wrote:
> 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]>

Reviewed-by: David Woodhouse <[email protected]>
smime.p7s (application/pkcs7-signature, 6 KB) - not displayed