lkml.org 
[lkml]   [2020]   [Nov]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 1/2] KVM: x86: implement KVM_SET_TSC_PRECISE/KVM_GET_TSC_PRECISE
From
Date
On 30/11/20 14:35, Maxim Levitsky wrote:
> + if (guest_cpuid_has(vcpu, X86_FEATURE_TSC_ADJUST)) {
> + tsc_state.tsc_adjust = vcpu->arch.ia32_tsc_adjust_msr;
> + tsc_state.flags |= KVM_TSC_STATE_TSC_ADJUST_VALID;
> + }

This is mostly useful for userspace that doesn't disable the quirk, right?

> + kvm_get_walltime(&wall_nsec, &host_tsc);
> + diff = wall_nsec - tsc_state.nsec;
> +
> + if (diff < 0 || tsc_state.nsec == 0)
> + diff = 0;
> +

diff < 0 should be okay. Also why the nsec==0 special case? What about
using a flag instead?

Paolo

\
 
 \ /
  Last update: 2020-11-30 15:36    [W:0.229 / U:0.228 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site