]> www.infradead.org Git - users/dwmw2/linux.git/commit
KVM: x86: Add KVM_VCPU_TSC_SCALE and fix the documentation on TSC migration
authorDavid Woodhouse <dwmw@amazon.co.uk>
Wed, 13 Sep 2023 13:57:55 +0000 (15:57 +0200)
committerDavid Woodhouse <dwmw@amazon.co.uk>
Wed, 13 Sep 2023 13:57:55 +0000 (15:57 +0200)
commit79d425be158d12a4d860d53d1f90e4abe45646f8
treee2d66f720c4f2e46334db58b50eaebe4f12291e4
parent5133c9e51de41bfa902153888e11add3342ede18
KVM: x86: Add KVM_VCPU_TSC_SCALE and fix the documentation on TSC migration

The documentation on TSC migration using KVM_VCPU_TSC_OFFSET is woefully
inadequate. It ignores TSC scaling, and ignores the fact that the host
TSC may differ from one host to the next (and in fact because of the way
the kernel calibrates it, it generally differs from one boot to the next
even on the same hardware).

Add KVM_VCPU_TSC_SCALE to extract the actual scale ratio and frac_bits,
and attempt to document the *awful* process that we're requiring userspace
to follow to merely preserve the TSC across migration.

I may have thrown up in my mouth a little when writing that documentation.
It's an awful API. If we do this, we should be ashamed of ourselves.

Let's use Simon's KVM_VCPU_TSC_VALUE instead.
https://lore.kernel.org/all/20230202165950.483430-1-sveith@amazon.de/

Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Documentation/virt/kvm/devices/vcpu.rst
arch/x86/include/uapi/asm/kvm.h
arch/x86/kvm/x86.c