Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2211079imm; Thu, 19 Jul 2018 15:30:48 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdaOtxoGhO8Gk9yDLy2IAmSQsatQwPp6f5b1/xXrNmoZR1g7JX1xtmtwfcc7btgMVDKmoGE X-Received: by 2002:a62:d1b:: with SMTP id v27-v6mr11413922pfi.87.1532039448553; Thu, 19 Jul 2018 15:30:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532039448; cv=none; d=google.com; s=arc-20160816; b=Mr9eAkd9cT1zjn+L3ZqfOwi8k3tafWZguubujgB/mKVIl0nFQCfUP9KmtgiqD3zPgs tlQNqWXAx6mDRJ/7nA1qWAn2rUKvqGMzh43ebcOZNaM5k5rigzdAWvYF0GrTWPEXxBER m/gpgKLw5J0lVYN9cOtOJeNxlzy+PF8APui54DJaVrvrImcAxTDF3Kk0hvY9PMrHzcra UqbH/ajqG+zLchp65fUbwc2StbxiwZ7jB3eor+sqtPBjtEhkTiwsNyLLK0hqbfam1sHT 2sxIKVxbVg3CtHW9v776Pira8IH2cTx2YUs9veWOESaDUDpIntZwI0dt9aym7t39Rc60 DkbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:arc-authentication-results; bh=Qt/NzikCVvIg6qV6f1q+mR5hVMwOffb3HP12sDUh8xo=; b=FgruLl4b7krmdf2zqdjUTf150xY5tKVSG7iXBm9F3jhKNQ+5UQ9tUaW2RNiJ0AE/XD jAaRU75z4nAgWcTkSOHhcIHZJCMS+WDfz7aEv0ciYYqDv6FV5d8VSWX2BxADB+oJpRXj EkuhV4ak/DVQvLSt0SHl/orGdtMCEhHs292iBpIRDDhZTsNGWVgC3SFWTZyImE9SLrJD R+pmJhZpT2vc7h7+ySQbg1wA9SlljsPrFOV57Wy/kUCtzKm8COfgxEcrMzFhf2sSnyAo l2TUaVSzWo6e0OW1HiX0s6QUizy9W4wHVESvFTW0KsfzKQylH2Kl/Y6XroW3VSPSG8gv 5bGw== 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 a2-v6si300371pgh.396.2018.07.19.15.30.34; Thu, 19 Jul 2018 15:30: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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731193AbeGSXPC (ORCPT + 99 others); Thu, 19 Jul 2018 19:15:02 -0400 Received: from terminus.zytor.com ([198.137.202.136]:38813 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730315AbeGSXPB (ORCPT ); Thu, 19 Jul 2018 19:15:01 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id w6JMTlp62439267 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 19 Jul 2018 15:29:47 -0700 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w6JMTkWk2439264; Thu, 19 Jul 2018 15:29:46 -0700 Date: Thu, 19 Jul 2018 15:29:46 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Pavel Tatashin Message-ID: Cc: pasha.tatashin@oracle.com, mingo@kernel.org, hpa@zytor.com, tglx@linutronix.de, linux-kernel@vger.kernel.org Reply-To: pasha.tatashin@oracle.com, hpa@zytor.com, mingo@kernel.org, tglx@linutronix.de, linux-kernel@vger.kernel.org In-Reply-To: <20180719205545.16512-17-pasha.tatashin@oracle.com> References: <20180719205545.16512-17-pasha.tatashin@oracle.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/timers] timekeeping: Default boot time offset to local_clock() Git-Commit-ID: 4b1b7f8054896cee25669f6cea7cb6dd17f508f7 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, DATE_IN_FUTURE_96_Q autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 4b1b7f8054896cee25669f6cea7cb6dd17f508f7 Gitweb: https://git.kernel.org/tip/4b1b7f8054896cee25669f6cea7cb6dd17f508f7 Author: Pavel Tatashin AuthorDate: Thu, 19 Jul 2018 16:55:35 -0400 Committer: Thomas Gleixner CommitDate: Fri, 20 Jul 2018 00:02:41 +0200 timekeeping: Default boot time offset to local_clock() read_persistent_wall_and_boot_offset() is called during boot to read both the persistent clock and also return the offset between the boot time and the value of persistent clock. Change the default boot_offset from zero to 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 Signed-off-by: Thomas Gleixner Cc: steven.sistare@oracle.com Cc: daniel.m.jordan@oracle.com Cc: linux@armlinux.org.uk Cc: schwidefsky@de.ibm.com Cc: heiko.carstens@de.ibm.com Cc: john.stultz@linaro.org Cc: sboyd@codeaurora.org Cc: hpa@zytor.com Cc: douly.fnst@cn.fujitsu.com Cc: peterz@infradead.org Cc: prarit@redhat.com Cc: feng.tang@intel.com Cc: pmladek@suse.com Cc: gnomes@lxorguk.ukuu.org.uk Cc: linux-s390@vger.kernel.org Cc: boris.ostrovsky@oracle.com Cc: jgross@suse.com Cc: pbonzini@redhat.com Link: https://lkml.kernel.org/r/20180719205545.16512-17-pasha.tatashin@oracle.com --- kernel/time/timekeeping.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index cb738f825c12..30d7f64ffc87 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -1503,14 +1503,17 @@ void __weak read_persistent_clock64(struct timespec64 *ts64) * Weak dummy function for arches that do not yet support it. * wall_time - current time as returned by persistent clock * boot_offset - offset that is defined as wall_time - boot_time - * default to 0. + * The default function calculates offset based on the current value of + * local_clock(). This way architectures that support sched_clock() but don't + * support dedicated boot time clock will provide the best estimate of the + * boot time. */ void __weak __init read_persistent_wall_and_boot_offset(struct timespec64 *wall_time, struct timespec64 *boot_offset) { read_persistent_clock64(wall_time); - *boot_offset = (struct timespec64){0}; + *boot_offset = ns_to_timespec64(local_clock()); } /* Flag for if timekeeping_resume() has injected sleeptime */