[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <38602ef4-7ecf-a5fd-6db9-db86e8e974e4@redhat.com>
Date: Mon, 30 Nov 2020 15:33:46 +0100
From: Paolo Bonzini <pbonzini@...hat.com>
To: Maxim Levitsky <mlevitsk@...hat.com>, kvm@...r.kernel.org
Cc: Oliver Upton <oupton@...gle.com>, Ingo Molnar <mingo@...hat.com>,
Sean Christopherson <sean.j.christopherson@...el.com>,
Thomas Gleixner <tglx@...utronix.de>,
open list <linux-kernel@...r.kernel.org>,
Marcelo Tosatti <mtosatti@...hat.com>,
Jonathan Corbet <corbet@....net>,
Wanpeng Li <wanpengli@...cent.com>,
Borislav Petkov <bp@...en8.de>,
Jim Mattson <jmattson@...gle.com>,
"H. Peter Anvin" <hpa@...or.com>,
"open list:DOCUMENTATION" <linux-doc@...r.kernel.org>,
Joerg Roedel <joro@...tes.org>,
"maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" <x86@...nel.org>,
Vitaly Kuznetsov <vkuznets@...hat.com>
Subject: Re: [PATCH 1/2] KVM: x86: implement
KVM_SET_TSC_PRECISE/KVM_GET_TSC_PRECISE
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
Powered by blists - more mailing lists