[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-4b1b7f8054896cee25669f6cea7cb6dd17f508f7@git.kernel.org>
Date: Thu, 19 Jul 2018 15:29:46 -0700
From: tip-bot for Pavel Tatashin <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: pasha.tatashin@...cle.com, mingo@...nel.org, hpa@...or.com,
tglx@...utronix.de, linux-kernel@...r.kernel.org
Subject: [tip:x86/timers] timekeeping: Default boot time offset to
local_clock()
Commit-ID: 4b1b7f8054896cee25669f6cea7cb6dd17f508f7
Gitweb: https://git.kernel.org/tip/4b1b7f8054896cee25669f6cea7cb6dd17f508f7
Author: Pavel Tatashin <pasha.tatashin@...cle.com>
AuthorDate: Thu, 19 Jul 2018 16:55:35 -0400
Committer: Thomas Gleixner <tglx@...utronix.de>
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 <pasha.tatashin@...cle.com>
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Cc: steven.sistare@...cle.com
Cc: daniel.m.jordan@...cle.com
Cc: linux@...linux.org.uk
Cc: schwidefsky@...ibm.com
Cc: heiko.carstens@...ibm.com
Cc: john.stultz@...aro.org
Cc: sboyd@...eaurora.org
Cc: hpa@...or.com
Cc: douly.fnst@...fujitsu.com
Cc: peterz@...radead.org
Cc: prarit@...hat.com
Cc: feng.tang@...el.com
Cc: pmladek@...e.com
Cc: gnomes@...rguk.ukuu.org.uk
Cc: linux-s390@...r.kernel.org
Cc: boris.ostrovsky@...cle.com
Cc: jgross@...e.com
Cc: pbonzini@...hat.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 */
Powered by blists - more mailing lists