Re: [PATCH 1/4] kvm: x86: add KVM_{GET,SET}_TSC_OFFSET ioctls

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jul 10, 2020 at 3:40 PM Paolo Bonzini <pbonzini@xxxxxxxxxx> wrote:
>
> On 11/07/20 00:09, Jim Mattson wrote:
> >>  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.
>
> Other questions:
>
> 1) how do you handle non-synchronized TSC between source and destination?
>

On the source side we record a host TSC reading establishing the start
of migration, along with the TSC offsets. We recalculate new offsets
that compensate for the elapsed time + TSC difference between
source/target when restoring the VM.

> 2) how is KVM_REQ_MASTERCLOCK_UPDATE triggered, since that's the main
> function of the various heuristics?

We initialize all TSCs to 0 at VM creation, then restore offsets (if
any). Should the offsets be out of phase, we write a garbage value to
the TSC MSR to break the vCPU matching, then set the offset. Not the
most elegant solution, it'd be better if the {GET,SET}_TSC_OFFSET
ioctls instrumented this directly.

>
> Paolo
>



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux