From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH v2] KVM: x86: update masterclock values on TSC writes Date: Wed, 05 Nov 2014 20:49:38 +0100 Message-ID: <545A7F52.8070408@redhat.com> References: <20141104233044.GB29191@amt.cnet> <5459EF85.5010206@redhat.com> <20141105181928.GA608@amt.cnet> <545A7ED1.3050504@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Cc: kvm-devel To: Marcelo Tosatti Return-path: Received: from mail-wi0-f179.google.com ([209.85.212.179]:55731 "EHLO mail-wi0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750860AbaKETtm (ORCPT ); Wed, 5 Nov 2014 14:49:42 -0500 Received: by mail-wi0-f179.google.com with SMTP id h11so3097210wiw.0 for ; Wed, 05 Nov 2014 11:49:41 -0800 (PST) In-Reply-To: <545A7ED1.3050504@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 05/11/2014 20:47, Paolo Bonzini wrote: > > > On 05/11/2014 19:19, Marcelo Tosatti wrote: >>>>>> + * If the vcpus have matched TSCs and host clocksource is TSC, >>>>>> + * perform request to enable masterclock. >>>>>> + * >>>>>> + * If the masterclock is enabled, perform request to update >>>>>> + * masterclock values. >>>>>> + */ >>>>>> + if ((vcpus_matched && gtod->clock.vclock_mode == VCLOCK_TSC) || >>>>>> + ka->use_master_clock) >>>> >>>> This is not an explanation, it is a literal translation from C to >>>> English. :) Can you also explain the why, especially for the first half >>>> of the condition? >>>> >>>> Paolo >> The comment on top of pvclock_update_vm_gtod_copy says: >> >> "Rely on synchronization of host TSCs and guest TSCs for monotonicity." >> >> Then with this patch >> >> "If the vcpus have matched TSCs and host clocksource is TSC" >> >> Is it sufficient to add >> >> "Masterclock requires synchronized guest TSC and host clocksource TSC" >> to this patch? > > Got it now, thanks. I think I misread one "enable" as "update" in your > comment, sorry. I'll apply v2 tomorrow. Slightly reworded: /* * Once the masterclock is enabled, always perform request in * order to update it. * * Until then, if the vcpus have matched TSCs and host clocksource * is TSC, perform request to enable masterclock. */ if (ka->use_master_clock || (vcpus_matched && gtod->clock.vclock_mode == VCLOCK_TSC)) kvm_make_request(KVM_REQ_MASTERCLOCK_UPDATE, vcpu); Paolo