Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp2239286imm; Thu, 21 Jun 2018 09:14:41 -0700 (PDT) X-Google-Smtp-Source: ADUXVKL3EZDLiyDf7CKS1s7Waosm2GvWfFb1B+IHNDAOtmaBJyBYsScYRd7uz07+0XcK6X+x2icH X-Received: by 2002:a63:985:: with SMTP id 127-v6mr6640770pgj.52.1529597681167; Thu, 21 Jun 2018 09:14:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529597681; cv=none; d=google.com; s=arc-20160816; b=U52x/Z2AWJAFSn8l6MxvdLcgeF/60wQ8FlXNB3ghR8MeWjD9REUTMB0xnPgSXhYEPR PkJ2YMRfQ+Tovmipk2f+Dr3Tk8dCK3TAw64SakFP4QX9wWCQaNHUGALS/IHIf9tj/2x2 3YnJDpp3G3PQ1sbSVG1dfaK+GF4MPYNQs4NTQIoJ9ToVWTENWJwEOl9CfGgkIsu3UGhY olmLD8DEdeQnb3cKmgCGQSwqSyprN49ZqmFoB5SMwiaL1f5nJgcgBKvqveU7dok+G0z0 qjYV0M8jnMKG5nQ7awJLxBbncrFq5ItR/DoJ18wHoCY/q/csYKRGuM2lqGctTeC4O0Zc evSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date :arc-authentication-results; bh=4wRw9FoDoqARa72izPmhYlSES9TRw0OQMfUX6Rqcl8w=; b=gtGeWvsZQktBD7sEdR8PxpUQ8MKAexFjELn2WUy4dTHbWZjpl3vQYuC6LelHF6r68x GF2phJaF5y/yXg7ZJBPnqMc8fSBWXw6hTPUXqlyVNqTxegsDuSHbeq7mAauHY2H9FvjR 89o9eLQ8caP7M96tK4r2hBYyVOc0609jkZCJ5K5O9qFHcabRYLrCmFDJikzI2fXdnCsI Kr0pMJ8rb/G6TJd63p74gZq25TrF3/cuH6f8aE36yXZTnHvc0nnmat/jL70IsSJVdV6O 1c3welW5q/FQlQuEqFRVHefcHRxYIMAVfrKUc7dsX9mWtHewPv6WJqmGj8ZUoYMtHKSa G3CQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 125-v6si1398413pgg.298.2018.06.21.09.14.26; Thu, 21 Jun 2018 09:14:41 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933391AbeFUQNf (ORCPT + 99 others); Thu, 21 Jun 2018 12:13:35 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:39196 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932858AbeFUQNe (ORCPT ); Thu, 21 Jun 2018 12:13:34 -0400 Received: from p4fea482e.dip0.t-ipconnect.de ([79.234.72.46] helo=nanos) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1fW2Cz-0001Z2-GS; Thu, 21 Jun 2018 18:13:17 +0200 Date: Thu, 21 Jun 2018 18:13:16 +0200 (CEST) From: Thomas Gleixner To: Pavel Tatashin cc: steven.sistare@oracle.com, daniel.m.jordan@oracle.com, linux@armlinux.org.uk, schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com, john.stultz@linaro.org, sboyd@codeaurora.org, x86@kernel.org, linux-kernel@vger.kernel.org, mingo@redhat.com, hpa@zytor.com, douly.fnst@cn.fujitsu.com, peterz@infradead.org, prarit@redhat.com, feng.tang@intel.com, pmladek@suse.com, gnomes@lxorguk.ukuu.org.uk Subject: Re: [PATCH v11 3/6] time: replace read_boot_clock64() with read_persistent_wall_and_boot_offset() In-Reply-To: <20180620212700.29178-4-pasha.tatashin@oracle.com> Message-ID: References: <20180620212700.29178-1-pasha.tatashin@oracle.com> <20180620212700.29178-4-pasha.tatashin@oracle.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 20 Jun 2018, Pavel Tatashin wrote: > If architecture does not support exact boot time, it is challenging to > estimate boot time without having a reference to the current persistent > clock value. Yet, we cannot read the persistent clock time again, because > this may lead to math discrepancies with the caller of read_boot_clock64() > who have read the persistent clock at a different time. > > This is why it is better to provide two values simultaneously: the > persistent clock value, and the boot time. > > Thus, we replace read_boot_clock64() with: > read_persistent_wall_and_boot_offset(wall_time, boot_offset) > > Where wall_time is returned by read_persistent_clock() > And boot_offset is wall_time - boot time > > We calculate boot_offset using the current value of local_clock() so > architectures, that do not have a dedicated boot_clock but have early > sched_clock(), such as SPARCv9, x86, and possibly more will benefit from > this change by getting a better and more consistent estimate of the boot > time without need for an arch specific implementation. > > Signed-off-by: Pavel Tatashin > --- > arch/arm/kernel/time.c | 12 +------- > arch/s390/kernel/time.c | 11 +++++-- > include/linux/timekeeping.h | 3 +- > kernel/time/timekeeping.c | 61 +++++++++++++++++++------------------ Please don't make that a wholesale patch. I surely indicated the steps which are required and the steps can be done as separate patches easily, Thanks, tglx