]> www.infradead.org Git - users/dwmw2/linux.git/commit
KVM: x86: Fix systemic drift in __get_kvmclock() with TSC scaling kvmclock2
authorDavid Woodhouse <dwmw@amazon.co.uk>
Thu, 18 Jan 2024 12:57:30 +0000 (12:57 +0000)
committerDavid Woodhouse <dwmw@amazon.co.uk>
Wed, 31 Jan 2024 00:18:01 +0000 (00:18 +0000)
commitbc557e5ee450e886f97cb8cbb65237d3931e2fbf
tree81ccd7d73b995d227f515b5477ad2eb08228802b
parent96aee1721d5ecb5d3664f582595f0ff536e6525b
KVM: x86: Fix systemic drift in __get_kvmclock() with TSC scaling

Converting a host TSC delta directly to nanoseconds results in a systemic
drift compared to the way the guest calculates its kvmclock.

Provide a __kvmclock_from_tsc() function which calculates the kvmclock
just as the guest would, by scaling to the guest TSC first and from that
to nanoseconds.

Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
arch/x86/include/asm/kvm_host.h
arch/x86/kvm/x86.c