Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753020AbdHBRVZ (ORCPT ); Wed, 2 Aug 2017 13:21:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41952 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752217AbdHBRVY (ORCPT ); Wed, 2 Aug 2017 13:21:24 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 3690913A9D Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=pbonzini@redhat.com Subject: Re: [PATCH v4 01/10] timekeeper: introduce extended clocksource reading callback To: John Stultz , Denis Plotnikov Cc: Radim Krcmar , kvm list , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , lkml , "x86@kernel.org" , rkagan@virtuozzo.com, den@virtuozzo.com References: <1501684690-211093-1-git-send-email-dplotnikov@virtuozzo.com> <1501684690-211093-2-git-send-email-dplotnikov@virtuozzo.com> From: Paolo Bonzini Message-ID: Date: Wed, 2 Aug 2017 19:21:16 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 02 Aug 2017 17:21:24 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1026 Lines: 25 On 02/08/2017 19:08, John Stultz wrote: >> + bool (*read_with_stamp)(struct clocksource *cs, >> + u64 *cycles, u64 *cycles_stamp); >> u64 mask; > I'm not really fan of an interface that leaks magic data to users that > know enough. > > And its not clear from this if the magic data is standardized or > different clocksources export different data? > > What exactly are the attributes you're trying to pull from the > lower-level hardware that you can't get otherwise (without using the > update_pvclock_gtod() since, if I'm understanding that apparently > gives you too much detail to deal with)? We need the exact TSC value that was used to compute the ktime. This is different between TSC and kvmclock because TSC's read() callback returns cycles (of course), while kvmclock's read() callback returns nanoseconds. In turn, kvmclock's read() callback returns nanoseconds because it has to check the read against the host-provided seqlock, so this cannot be changed. Paolo