Merge branch 'x86-timers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
authorLinus Torvalds <torvalds@linux-foundation.org>
Tue, 14 Aug 2018 01:28:19 +0000 (18:28 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 14 Aug 2018 01:28:19 +0000 (18:28 -0700)
Pull x86 timer updates from Thomas Gleixner:
 "Early TSC based time stamping to allow better boot time analysis.

  This comes with a general cleanup of the TSC calibration code which
  grew warts and duct taping over the years and removes 250 lines of
  code. Initiated and mostly implemented by Pavel with help from various
  folks"

* 'x86-timers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (37 commits)
  x86/kvmclock: Mark kvm_get_preset_lpj() as __init
  x86/tsc: Consolidate init code
  sched/clock: Disable interrupts when calling generic_sched_clock_init()
  timekeeping: Prevent false warning when persistent clock is not available
  sched/clock: Close a hole in sched_clock_init()
  x86/tsc: Make use of tsc_calibrate_cpu_early()
  x86/tsc: Split native_calibrate_cpu() into early and late parts
  sched/clock: Use static key for sched_clock_running
  sched/clock: Enable sched clock early
  sched/clock: Move sched clock initialization and merge with generic clock
  x86/tsc: Use TSC as sched clock early
  x86/tsc: Initialize cyc2ns when tsc frequency is determined
  x86/tsc: Calibrate tsc only once
  ARM/time: Remove read_boot_clock64()
  s390/time: Remove read_boot_clock64()
  timekeeping: Default boot time offset to local_clock()
  timekeeping: Replace read_boot_clock64() with read_persistent_wall_and_boot_offset()
  s390/time: Add read_persistent_wall_and_boot_offset()
  x86/xen/time: Output xen sched_clock time from 0
  x86/xen/time: Initialize pv xen time in init_hypervisor_platform()
  ...

1  2 
Documentation/admin-guide/kernel-parameters.txt
Documentation/x86/x86_64/boot-options.txt
arch/x86/kernel/cpu/common.c
arch/x86/kernel/kvm.c
drivers/clocksource/tegra20_timer.c
include/linux/timekeeping.h
init/main.c
kernel/sched/core.c
kernel/sched/debug.c
kernel/time/timekeeping.c

Simple merge
Simple merge
Simple merge
Simple merge
diff --cc init/main.c
Simple merge
Simple merge
Simple merge
@@@ -1505,34 -1497,27 +1506,39 @@@ void __weak read_persistent_clock64(str
  }
  
  /**
-  * read_boot_clock64 -  Return time of the system start.
+  * read_persistent_wall_and_boot_offset - Read persistent clock, and also offset
+  *                                        from the boot.
   *
   * Weak dummy function for arches that do not yet support it.
-  * Function to read the exact time the system has been started.
-  * Returns a timespec64 with tv_sec=0 and tv_nsec=0 if unsupported.
-  *
-  *  XXX - Do be sure to remove it once all arches implement it.
+  * wall_time  - current time as returned by persistent clock
+  * boot_offset        - offset that is defined as wall_time - boot_time
+  * 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 read_boot_clock64(struct timespec64 *ts)
+ void __weak __init
+ read_persistent_wall_and_boot_offset(struct timespec64 *wall_time,
+                                    struct timespec64 *boot_offset)
  {
-       ts->tv_sec = 0;
-       ts->tv_nsec = 0;
+       read_persistent_clock64(wall_time);
+       *boot_offset = ns_to_timespec64(local_clock());
  }
  
 -/* Flag for if timekeeping_resume() has injected sleeptime */
 -static bool sleeptime_injected;
 +/*
 + * Flag reflecting whether timekeeping_resume() has injected sleeptime.
 + *
 + * The flag starts of false and is only set when a suspend reaches
 + * timekeeping_suspend(), timekeeping_resume() sets it to false when the
 + * timekeeper clocksource is not stopping across suspend and has been
 + * used to update sleep time. If the timekeeper clocksource has stopped
 + * then the flag stays true and is used by the RTC resume code to decide
 + * whether sleeptime must be injected and if so the flag gets false then.
 + *
 + * If a suspend fails before reaching timekeeping_resume() then the flag
 + * stays false and prevents erroneous sleeptime injection.
 + */
 +static bool suspend_timing_needed;
  
  /* Flag for if there is a persistent clock on this platform */
  static bool persistent_clock_exists;