From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH v3 2/6] KVM: x86: switch to masterclock update using timekeeper functionality Date: Tue, 1 Aug 2017 12:16:06 +0200 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> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: rkagan@virtuozzo.com, den@virtuozzo.com, svt-core@lists.sw.ru To: Denis Plotnikov , rkrcmar@redhat.com, kvm@vger.kernel.org Return-path: Received: from mail-wm0-f68.google.com ([74.125.82.68]:35274 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751631AbdHAKQK (ORCPT ); Tue, 1 Aug 2017 06:16:10 -0400 Received: by mail-wm0-f68.google.com with SMTP id r77so2291975wmd.2 for ; Tue, 01 Aug 2017 03:16:09 -0700 (PDT) In-Reply-To: <82c81e37-9c56-26b9-d8c5-cf87eeb1d470@redhat.com> Content-Language: en-US Sender: kvm-owner@vger.kernel.org List-ID: A couple more observation now that we've agreed on the approach. On 01/08/2017 12:03, Paolo Bonzini wrote: > >>> Maybe what we want is some kind of "bool cycles_valid", and then >>> read_clock_and_systime can return it: >>> >>> >>> if (clock->read_clock_and_systime) { >>> systime_snapshot->cycles_valid = >>> clock->read_clock_and_systime( >>> &now, &systime_snapshot->cycles); Please pass the clocksource to the new function. However this: > + clock = tk->tkr_mono.clock; should then be READ_ONCE for the same reason mentioned in tk_clock_read's comments. Then, >>> } else { >>> now = tk_clock_read(&tk->tkr_mono); this can call clock->read(clock) directly, without going through tk_clock_read. Thanks, Paolo >>> systime_snapshot->cycles_valid = true; >>> systime_snapshot->cycles = now; >>> }