lkml.org 
[lkml]   [2020]   [Dec]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH v2 1/3] KVM: x86: implement KVM_{GET|SET}_TSC_STATE
Date
On 08/12/20 18:08, Maxim Levitsky wrote:
>> Even if you support TSCADJUST and let the guest write to it does not
>> change the per guest offset at all. TSCADJUST is per [v]CPU and adds on
>> top:
>>
>> tscvcpu = tsc_host + guest_offset + TSC_ADJUST
>>
>> Scaling is just orthogonal and does not change any of this.
>
> I agree with this, and I think that this is what we will end up doing.
> Paulo, what do you think about this?

Yes, you can have a VM ioctl that saves/restores cur_tsc_nsec and
cur_tsc_write. The restore side would loop on all vcpus.

However, it is not so easy: 1) it would have to be usable only if
KVM_X86_QUIRK_TSC_HOST_ACCESS is false, 2) it would fail if
kvm->arch.nr_vcpus_matched_tsc == kvm->online_vcpus (which basically
means that userspace didn't mess up the TSC configuration). If not, it
would return -EINVAL.

Also, while at it let's burn and pour salt on the support for
KVM_SET_TSC_KHZ unless TSC scaling is supported, together with
vcpu->tsc_catchup and all the "tolerance" crap that is in
kvm_set_tsc_khz. And initialize vcpu->arch.virtual_tsc_khz to
kvm->arch.last_tsc_khz before calling kvm_synchronize_tsc.

Paolo

\
 
 \ /
  Last update: 2020-12-10 12:55    [W:1.273 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site