Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp2065015imd; Fri, 2 Nov 2018 05:32:48 -0700 (PDT) X-Google-Smtp-Source: AJdET5eAeqTH2uILydTa+FCTO7XP5wAIydYMb3sVOyxCsBSNCeODjgOZ2Q+PL4VbXFbdAFp9XR8f X-Received: by 2002:a62:b87:: with SMTP id 7-v6mr11710386pfl.67.1541161968577; Fri, 02 Nov 2018 05:32:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541161968; cv=none; d=google.com; s=arc-20160816; b=jEAEpwyICLjTFb3YRVgYWFVT4NWT0nPM/Jkz9znIIdUzax4n7jsTKKnVA3zs2gR/ZC CucKBN/Qu0AM6Kj/IS6cMAnsZ4Ruz6iPPG7d7esZoijBmo2Lea3v8kkhLt8UoRiRM9kq 9EzmkvLUGArNBvJNDWHNuDaVCNyaQAtb0Ma/ea/eUcqKPESdcBBPAg/EUd76uIYTwfzU LffQ3zKD2uySslUrLg8gEwF1rMFMuSS5CoJGw6dsPCL+W7GPiC9OuFa+HyT0GgEt0SJG M83ciOZ89svQtGwxc47QnbvgkyoKGItkI66NgRvkLbCQSM7s8cVB7nLDSx79E+Nh5NmL Y+Tg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=zlFOJO9q4lLwiZUI9ZPePriR4q2PYEzpRULnDBWuJcI=; b=JKrFvvMYrM3R65F0p8qccJjzwL91vWspaqeSs5kauu4Qfb5x/XwQ0PfXkdf96LkJQ0 FHcweO54AMY2wWvTN2EgcI0to3LeofMPQkFIDHxsTNVgAE3lLXgqfxxGf9q3DxgJZ1rG Zz5nJILBNfsnVt1dmGc5fkZl4uSBH9KQFxrUldbFYUTTnX6MtvAWjECQbimpBjgYAv2w hb+BCP140G1EMHg1sp8ZBDPqR9ggFEBDqxfc+Ii4ZpQnSJmVRm4oCBPMYt9N6hsDms02 XxJHAE1b7U5pQXOgbEqGb6wLSMBvtZOaEOxpjrBy6zIHQyYqFp6QkZ9DKj+2h0wgIcV/ jKvw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c22-v6si34759554pgb.472.2018.11.02.05.32.33; Fri, 02 Nov 2018 05:32:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727250AbeKBVjD (ORCPT + 99 others); Fri, 2 Nov 2018 17:39:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39700 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726008AbeKBVjD (ORCPT ); Fri, 2 Nov 2018 17:39:03 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C4C733082129; Fri, 2 Nov 2018 12:32:01 +0000 (UTC) Received: from localhost (holly.tpb.lab.eng.brq.redhat.com [10.43.134.11]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BC98D1054FD5; Fri, 2 Nov 2018 12:31:59 +0000 (UTC) Date: Fri, 2 Nov 2018 13:31:58 +0100 From: Miroslav Lichvar To: Thomas Gleixner Cc: John Stultz , Christopher Hall , "H. Peter Anvin" , linux-rt-users , jesus.sanchez-palencia@intel.com, Gavin Hindman , liam.r.girdwood@intel.com, Peter Zijlstra , LKML Subject: Re: TSC to Mono-raw Drift Message-ID: <20181102123158.GN19434@localhost> References: <20181102112006.GM19434@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Fri, 02 Nov 2018 12:32:02 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 02, 2018 at 12:25:56PM +0100, Thomas Gleixner wrote: > On Fri, 2 Nov 2018, Miroslav Lichvar wrote: > > clocksource -> MONOTONIC_RAW -> MONOTONIC/REALTIME > > > > or > > > > clocksource -> ? -> MONOTONIC_RAW > > -> MONOTONIC/REALTIME > > That's what we have now. At least I don't see how the raw thing is coupled > in NTP. Oh, right. So, for the first approach when the raw clock is stepped, the same step needs to be applied to the mono clock. That means the mono clock will have two large independent corrections applied to it, which will make it less stable, e.g. steps of up to 8 ns at 100 Hz instead of 4 ns. Otherwise they would drift from each other when not synchronized by NTP/PTP. In the second approach, the corrections of the two clocks are independent, but the NTP tick length needs to be adjusted before the multiplier is calculated to match the frequency of the raw clock. If the correction was applied later, I suspect it would require a +2 mult adjustment or larger steps as in the first approach. That tick adjustment generally won't be perfectly accurate, so an extra small correction would be needed to keep the clocks in sync over long intervals. This could be a +1 adjustment of the NTP tick length, or it could be a small forward step. I'm not sure what would be easier to implement. Does that make sense? -- Miroslav Lichvar