Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754518AbcKIWD6 convert rfc822-to-8bit (ORCPT ); Wed, 9 Nov 2016 17:03:58 -0500 Received: from mx5-phx2.redhat.com ([209.132.183.37]:33704 "EHLO mx5-phx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752312AbcKIWD4 (ORCPT ); Wed, 9 Nov 2016 17:03:56 -0500 Date: Wed, 9 Nov 2016 17:03:55 -0500 (EST) From: Paolo Bonzini To: Marcelo Tosatti Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Radim =?utf-8?B?S3LEjW3DocWZ?= Message-ID: <628483831.11762909.1478729035700.JavaMail.zimbra@redhat.com> In-Reply-To: <20161109201716.GB25974@amt.cnet> References: <1478710095-15022-1-git-send-email-pbonzini@redhat.com> <20161109201248.GA25974@amt.cnet> <20161109201716.GB25974@amt.cnet> Subject: Re: [PATCH] kvm: kvmclock: let KVM_GET_CLOCK return whether the master clock is in use MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT X-Originating-IP: [10.4.164.1, 10.5.101.130] X-Mailer: Zimbra 8.0.6_GA_5922 (ZimbraWebClient - FF49 (Linux)/8.0.6_GA_5922) Thread-Topic: kvmclock: let KVM_GET_CLOCK return whether the master clock is in use Thread-Index: ERMWlpmuB0+FoMeOXPKszY5FF5W7tA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1242 Lines: 33 ----- Original Message ----- > From: "Marcelo Tosatti" > To: "Paolo Bonzini" > Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, "Radim Krčmář" > Sent: Wednesday, November 9, 2016 9:17:19 PM > Subject: Re: [PATCH] kvm: kvmclock: let KVM_GET_CLOCK return whether the master clock is in use > > On Wed, Nov 09, 2016 at 06:12:50PM -0200, Marcelo Tosatti wrote: > > On Wed, Nov 09, 2016 at 05:48:15PM +0100, Paolo Bonzini wrote: > > > Userspace can read the exact value of kvmclock by reading the TSC > > > and fetching the timekeeping parameters out of guest memory. This > > > however is brittle and not necessary anymore with KVM 4.11. > > > > Hi Paolo, > > > > Can you point to commit or explanation why that is not the case anymore? > > Thanks > > I don't see how thats possible given the: > > * TSC > * TSC (timer interrupt + TSC deltas) (AKA host TSC clocksource and > * CLOCK_MONOTONIC). > > Clocks currently drift from each other (therefore are not monotonic). __get_kernel_ns now computes the guest's kvmclock directly when using the master clock. Instead of peeking at guest memory, it does it from the hypervisor's copy of the parameters. Paolo