On Fri, Jul 10, 2020 at 1:38 PM Paolo Bonzini <pbonzini@xxxxxxxxxx> wrote: > > On 10/07/20 22:07, Oliver Upton wrote: > > From: Peter Hornyack <peterhornyack@xxxxxxxxxx> > > > > The KVM_SET_MSR vcpu ioctl has some temporal and value-based heuristics > > for determining when userspace is attempting to synchronize TSCs. > > Instead of guessing at userspace's intentions in the kernel, directly > > expose control of the TSC offset field to userspace such that userspace > > may deliberately synchronize the guest TSCs. > > > > Note that TSC offset support is mandatory for KVM on both SVM and VMX. > > > > Reviewed-by: Jim Mattson <jmattson@xxxxxxxxxx> > > Signed-off-by: Peter Hornyack <peterhornyack@xxxxxxxxxx> > > Signed-off-by: Oliver Upton <oupton@xxxxxxxxxx> > > --- > > Documentation/virt/kvm/api.rst | 27 +++++++++++++++++++++++++++ > > arch/x86/kvm/x86.c | 28 ++++++++++++++++++++++++++++ > > include/uapi/linux/kvm.h | 5 +++++ > > 3 files changed, 60 insertions(+) > > Needless to say, a patch that comes with tests starts on the fast lane. > But I have a fundamental question that isn't answered by either the > test or the documentation: how should KVM_SET_TSC_OFFSET be used _in > practice_ by a VMM? One could either omit IA32_TIME_STAMP_COUNTER from KVM_SET_MSRS, or one could call KVM_SET_TSC_OFFSET after KVM_SET_MSRS. We do the former. This isn't the only undocumented dependency among the various KVM_SET_* calls, but I agree that it would be helpful to document it.