From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [RFC PATCH v3 2/2] add support for Hyper-V partition reference time enlightenment Date: Thu, 12 Dec 2013 10:34:06 +0100 Message-ID: <52A9830E.4020102@redhat.com> References: <1386502419-26614-1-git-send-email-vrozenfe@redhat.com> <1386502419-26614-3-git-send-email-vrozenfe@redhat.com> <20131211192700.GA28701@amt.cnet> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Vadim Rozenfeld , kvm@vger.kernel.org, pl@dlhnet.de To: Marcelo Tosatti Return-path: Received: from mx1.redhat.com ([209.132.183.28]:53290 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751429Ab3LLJeM (ORCPT ); Thu, 12 Dec 2013 04:34:12 -0500 In-Reply-To: <20131211192700.GA28701@amt.cnet> Sender: kvm-owner@vger.kernel.org List-ID: Il 11/12/2013 20:27, Marcelo Tosatti ha scritto: >> > + if (kvm->arch.hv_tsc_page & HV_X64_MSR_TSC_REFERENCE_ENABLE) { >> > + HV_REFERENCE_TSC_PAGE* tsc_ref; >> > + tsc_ref = (HV_REFERENCE_TSC_PAGE*)gfn_to_hva(kvm, >> > + kvm->arch.hv_tsc_page >> HV_X64_MSR_TSC_REFERENCE_ADDRESS_SHIFT); > kvm_read_guest_cached. > >> > + kvm->arch.hv_ref_time = (((tsc_ref->tsc_scale >> 32) * >> > + native_read_tsc()) >> 32) + tsc_ref->tsc_offset; > Why native_read_tsc and not ->read_l1_tsc? > > It is easier to trust on the host to check reliability of the TSC: if > it uses TSC clocksource, then the TSCs are stable. So could condition > exposing the TSC ref page when ka->use_master_clock=1, see kvm_guest_time_update. > And hook into pvclock_gtod_notify. > > So in addition to X86_FEATURE_CONSTANT_TSC, check > ka->use_master_clock=1 FWIW, I agree with all these comments from Marcelo. Paolo