From mboxrd@z Thu Jan 1 00:00:00 1970 From: Denis Plotnikov Subject: Re: [PATCH v3 2/6] KVM: x86: switch to masterclock update using timekeeper functionality Date: Tue, 1 Aug 2017 15:46:54 +0300 Message-ID: References: <1501331711-12961-1-git-send-email-dplotnikov@virtuozzo.com> <1501331711-12961-3-git-send-email-dplotnikov@virtuozzo.com> <80e6cc1b-bccb-6e5b-1d3a-28a54e564d6c@virtuozzo.com> <82c81e37-9c56-26b9-d8c5-cf87eeb1d470@redhat.com> <616b4427-49a9-7815-56c3-9171248d9673@virtuozzo.com> <399f7166-0f18-a1b8-b236-66baccf410b9@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Cc: rkagan@virtuozzo.com, den@virtuozzo.com, svt-core@lists.sw.ru To: Paolo Bonzini , rkrcmar@redhat.com, kvm@vger.kernel.org Return-path: Received: from mail-eopbgr00102.outbound.protection.outlook.com ([40.107.0.102]:51664 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751339AbdHAMrD (ORCPT ); Tue, 1 Aug 2017 08:47:03 -0400 In-Reply-To: <399f7166-0f18-a1b8-b236-66baccf410b9@redhat.com> Content-Language: en-US Sender: kvm-owner@vger.kernel.org List-ID: On 01.08.2017 15:41, Paolo Bonzini wrote: > On 01/08/2017 14:11, Denis Plotnikov wrote: >> In fact, this "cycles_valid" is going to be used for deciding whether to >> use KVM masterclock or not. And if it's not we still want to know >> cycles_stamp value to use it in KVM. > > Why? Neither pvclock_update_vm_gtod_copy nor kvm_pv_clock_pairing do > anything with the two variables that are passed by reference, if the > read returns false. Hence my suggestion of calling it cycles_valid. giving up > >> So the cycles is valid, but clocksource is not reliable (why? let decide >> to a clocksource, by default assume they are all not stable), thus we >> must calculate time values for a guest each time its needed. >> So, my proposal is to name the variable sightly differently: cs_reliable >> and go like: >> if (clock->read_clock_with_stamp) { >> systime_snapshot->cs_reliable = >> clock->read_clock_with_stamp( >> &now, &systime_snapshot->cycles); >> } else { >> now = tk_clock_read(&tk->tkr_mono); >> systime_snapshot->cs_reliable = false; >> systime_snapshot->cycles = now; >> } >> What do you think? > > I'm afraid you still have to define the meaning of "reliable". (Though > I agree that the right default is false, that was a thinko on my side. > This also means that you need to define read_clock_with_stamp for the > TSC clocksource too). > > Paolo > agree name: cycles_valid default: false read_clock_with_stamp: defined for tsc returning true Thanks! Patches are in progress. They well be sent soon, nice and shiny! Denis