diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-08-13 21:28:19 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-08-13 21:28:19 -0400 |
| commit | 13e091b6dd0e78a518a7d8756607d3acb8215768 (patch) | |
| tree | ab7b6eef8d53008602be8dd5966655816abfeda6 | |
| parent | eac341194426ba7ead3444923b9eba491ae4feeb (diff) | |
| parent | 1088c6eef261939bda8346ec35b513790a2111d5 (diff) | |
Merge branch 'x86-timers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
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()
...
41 files changed, 508 insertions, 754 deletions
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index c370f5f0eb38..5cde1ff32ff3 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt | |||
| @@ -2835,8 +2835,6 @@ | |||
| 2835 | 2835 | ||
| 2836 | nosync [HW,M68K] Disables sync negotiation for all devices. | 2836 | nosync [HW,M68K] Disables sync negotiation for all devices. |
| 2837 | 2837 | ||
| 2838 | notsc [BUGS=X86-32] Disable Time Stamp Counter | ||
| 2839 | |||
| 2840 | nowatchdog [KNL] Disable both lockup detectors, i.e. | 2838 | nowatchdog [KNL] Disable both lockup detectors, i.e. |
| 2841 | soft-lockup and NMI watchdog (hard-lockup). | 2839 | soft-lockup and NMI watchdog (hard-lockup). |
| 2842 | 2840 | ||
diff --git a/Documentation/x86/x86_64/boot-options.txt b/Documentation/x86/x86_64/boot-options.txt index 3a2ba436721a..ad6d2a80cf05 100644 --- a/Documentation/x86/x86_64/boot-options.txt +++ b/Documentation/x86/x86_64/boot-options.txt | |||
| @@ -92,9 +92,7 @@ APICs | |||
| 92 | Timing | 92 | Timing |
| 93 | 93 | ||
| 94 | notsc | 94 | notsc |
| 95 | Don't use the CPU time stamp counter to read the wall time. | 95 | Deprecated, use tsc=unstable instead. |
| 96 | This can be used to work around timing problems on multiprocessor systems | ||
| 97 | with not properly synchronized CPUs. | ||
| 98 | 96 | ||
| 99 | nohpet | 97 | nohpet |
| 100 | Don't use the HPET timer. | 98 | Don't use the HPET timer. |
diff --git a/arch/arm/include/asm/mach/time.h b/arch/arm/include/asm/mach/time.h index 0f79e4dec7f9..4ac3a019a46f 100644 --- a/arch/arm/include/asm/mach/time.h +++ b/arch/arm/include/asm/mach/time.h | |||
| @@ -13,7 +13,6 @@ | |||
| 13 | extern void timer_tick(void); | 13 | extern void timer_tick(void); |
| 14 | 14 | ||
| 15 | typedef void (*clock_access_fn)(struct timespec64 *); | 15 | typedef void (*clock_access_fn)(struct timespec64 *); |
| 16 | extern int register_persistent_clock(clock_access_fn read_boot, | 16 | extern int register_persistent_clock(clock_access_fn read_persistent); |
| 17 | clock_access_fn read_persistent); | ||
| 18 | 17 | ||
| 19 | #endif | 18 | #endif |
diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c index cf2701cb0de8..078b259ead4e 100644 --- a/arch/arm/kernel/time.c +++ b/arch/arm/kernel/time.c | |||
| @@ -83,29 +83,18 @@ static void dummy_clock_access(struct timespec64 *ts) | |||
| 83 | } | 83 | } |
| 84 | 84 | ||
| 85 | static clock_access_fn __read_persistent_clock = dummy_clock_access; | 85 | static clock_access_fn __read_persistent_clock = dummy_clock_access; |
| 86 | static clock_access_fn __read_boot_clock = dummy_clock_access; | ||
| 87 | 86 | ||
| 88 | void read_persistent_clock64(struct timespec64 *ts) | 87 | void read_persistent_clock64(struct timespec64 *ts) |
| 89 | { | 88 | { |
| 90 | __read_persistent_clock(ts); | 89 | __read_persistent_clock(ts); |
| 91 | } | 90 | } |
| 92 | 91 | ||
| 93 | void read_boot_clock64(struct timespec64 *ts) | 92 | int __init register_persistent_clock(clock_access_fn read_persistent) |
| 94 | { | ||
| 95 | __read_boot_clock(ts); | ||
| 96 | } | ||
| 97 | |||
| 98 | int __init register_persistent_clock(clock_access_fn read_boot, | ||
| 99 | clock_access_fn read_persistent) | ||
| 100 | { | 93 | { |
| 101 | /* Only allow the clockaccess functions to be registered once */ | 94 | /* Only allow the clockaccess functions to be registered once */ |
| 102 | if (__read_persistent_clock == dummy_clock_access && | 95 | if (__read_persistent_clock == dummy_clock_access) { |
| 103 | __read_boot_clock == dummy_clock_access) { | ||
| 104 | if (read_boot) | ||
| 105 | __read_boot_clock = read_boot; | ||
| 106 | if (read_persistent) | 96 | if (read_persistent) |
| 107 | __read_persistent_clock = read_persistent; | 97 | __read_persistent_clock = read_persistent; |
| 108 | |||
| 109 | return 0; | 98 | return 0; |
| 110 | } | 99 | } |
| 111 | 100 | ||
diff --git a/arch/arm/plat-omap/counter_32k.c b/arch/arm/plat-omap/counter_32k.c index 2438b96004c1..fcc5bfec8bd1 100644 --- a/arch/arm/plat-omap/counter_32k.c +++ b/arch/arm/plat-omap/counter_32k.c | |||
| @@ -110,7 +110,7 @@ int __init omap_init_clocksource_32k(void __iomem *vbase) | |||
| 110 | } | 110 | } |
| 111 | 111 | ||
| 112 | sched_clock_register(omap_32k_read_sched_clock, 32, 32768); | 112 | sched_clock_register(omap_32k_read_sched_clock, 32, 32768); |
| 113 | register_persistent_clock(NULL, omap_read_persistent_clock64); | 113 | register_persistent_clock(omap_read_persistent_clock64); |
| 114 | pr_info("OMAP clocksource: 32k_counter at 32768 Hz\n"); | 114 | pr_info("OMAP clocksource: 32k_counter at 32768 Hz\n"); |
| 115 | 115 | ||
| 116 | return 0; | 116 | return 0; |
diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c index cf561160ea88..e8766beee5ad 100644 --- a/arch/s390/kernel/time.c +++ b/arch/s390/kernel/time.c | |||
| @@ -221,17 +221,22 @@ void read_persistent_clock64(struct timespec64 *ts) | |||
| 221 | ext_to_timespec64(clk, ts); | 221 | ext_to_timespec64(clk, ts); |
| 222 | } | 222 | } |
| 223 | 223 | ||
| 224 | void read_boot_clock64(struct timespec64 *ts) | 224 | void __init read_persistent_wall_and_boot_offset(struct timespec64 *wall_time, |
| 225 | struct timespec64 *boot_offset) | ||
| 225 | { | 226 | { |
| 226 | unsigned char clk[STORE_CLOCK_EXT_SIZE]; | 227 | unsigned char clk[STORE_CLOCK_EXT_SIZE]; |
| 228 | struct timespec64 boot_time; | ||
| 227 | __u64 delta; | 229 | __u64 delta; |
| 228 | 230 | ||
| 229 | delta = initial_leap_seconds + TOD_UNIX_EPOCH; | 231 | delta = initial_leap_seconds + TOD_UNIX_EPOCH; |
| 230 | memcpy(clk, tod_clock_base, 16); | 232 | memcpy(clk, tod_clock_base, STORE_CLOCK_EXT_SIZE); |
| 231 | *(__u64 *) &clk[1] -= delta; | 233 | *(__u64 *)&clk[1] -= delta; |
| 232 | if (*(__u64 *) &clk[1] > delta) | 234 | if (*(__u64 *)&clk[1] > delta) |
| 233 | clk[0]--; | 235 | clk[0]--; |
| 234 | ext_to_timespec64(clk, ts); | 236 | ext_to_timespec64(clk, &boot_time); |
| 237 | |||
| 238 | read_persistent_clock64(wall_time); | ||
| 239 | *boot_offset = timespec64_sub(*wall_time, boot_time); | ||
| 235 | } | 240 | } |
| 236 | 241 | ||
| 237 | static u64 read_tod_clock(struct clocksource *cs) | 242 | static u64 read_tod_clock(struct clocksource *cs) |
diff --git a/arch/x86/include/asm/intel-family.h b/arch/x86/include/asm/intel-family.h index cf090e584202..7ed08a7c3398 100644 --- a/arch/x86/include/asm/intel-family.h +++ b/arch/x86/include/asm/intel-family.h | |||
| @@ -76,4 +76,17 @@ | |||
| 76 | #define INTEL_FAM6_XEON_PHI_KNL 0x57 /* Knights Landing */ | 76 | #define INTEL_FAM6_XEON_PHI_KNL 0x57 /* Knights Landing */ |
| 77 | #define INTEL_FAM6_XEON_PHI_KNM 0x85 /* Knights Mill */ | 77 | #define INTEL_FAM6_XEON_PHI_KNM 0x85 /* Knights Mill */ |
| 78 | 78 | ||
