aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-08-13 21:28:19 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-08-13 21:28:19 -0400
commit13e091b6dd0e78a518a7d8756607d3acb8215768 (patch)
treeab7b6eef8d53008602be8dd5966655816abfeda6
parenteac341194426ba7ead3444923b9eba491ae4feeb (diff)
parent1088c6eef261939bda8346ec35b513790a2111d5 (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() ...
-rw-r--r--Documentation/admin-guide/kernel-parameters.txt2
-rw-r--r--Documentation/x86/x86_64/boot-options.txt4
-rw-r--r--arch/arm/include/asm/mach/time.h3
-rw-r--r--arch/arm/kernel/time.c15
-rw-r--r--arch/arm/plat-omap/counter_32k.c2
-rw-r--r--arch/s390/kernel/time.c15
-rw-r--r--arch/x86/include/asm/intel-family.h13
-rw-r--r--arch/x86/include/asm/intel-mid.h43
-rw-r--r--arch/x86/include/asm/kvm_guest.h7
-rw-r--r--arch/x86/include/asm/kvm_para.h1
-rw-r--r--arch/x86/include/asm/text-patching.h1
-rw-r--r--arch/x86/include/asm/tsc.h4
-rw-r--r--arch/x86/kernel/alternative.c7
-rw-r--r--arch/x86/kernel/cpu/amd.c13
-rw-r--r--arch/x86/kernel/cpu/common.c40
-rw-r--r--arch/x86/kernel/jump_label.c11
-rw-r--r--arch/x86/kernel/kvm.c14
-rw-r--r--arch/x86/kernel/kvmclock.c258
-rw-r--r--arch/x86/kernel/setup.c10
-rw-r--r--arch/x86/kernel/tsc.c259
-rw-r--r--arch/x86/kernel/tsc_msr.c96
-rw-r--r--arch/x86/kernel/x86_init.c2
-rw-r--r--arch/x86/platform/intel-mid/Makefile2
-rw-r--r--arch/x86/platform/intel-mid/intel-mid.c23
-rw-r--r--arch/x86/platform/intel-mid/intel_mid_weak_decls.h18
-rw-r--r--arch/x86/platform/intel-mid/mfld.c70
-rw-r--r--arch/x86/platform/intel-mid/mrfld.c105
-rw-r--r--arch/x86/xen/enlighten_pv.c51
-rw-r--r--arch/x86/xen/mmu_pv.c6
-rw-r--r--arch/x86/xen/suspend_pv.c5
-rw-r--r--arch/x86/xen/time.c18
-rw-r--r--arch/x86/xen/xen-ops.h6
-rw-r--r--drivers/clocksource/tegra20_timer.c2
-rw-r--r--include/linux/sched_clock.h5
-rw-r--r--include/linux/timekeeping.h3
-rw-r--r--init/main.c4
-rw-r--r--kernel/sched/clock.c57
-rw-r--r--kernel/sched/core.c1
-rw-r--r--kernel/sched/debug.c2
-rw-r--r--kernel/time/sched_clock.c2
-rw-r--r--kernel/time/timekeeping.c62
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
92Timing 92Timing
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 @@
13extern void timer_tick(void); 13extern void timer_tick(void);
14 14
15typedef void (*clock_access_fn)(struct timespec64 *); 15typedef void (*clock_access_fn)(struct timespec64 *);
16extern int register_persistent_clock(clock_access_fn read_boot, 16extern 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
85static clock_access_fn __read_persistent_clock = dummy_clock_access; 85static clock_access_fn __read_persistent_clock = dummy_clock_access;
86static clock_access_fn __read_boot_clock = dummy_clock_access;
87 86
88void read_persistent_clock64(struct timespec64 *ts) 87void read_persistent_clock64(struct timespec64 *ts)
89{ 88{
90 __read_persistent_clock(ts); 89 __read_persistent_clock(ts);
91} 90}
92 91
93void read_boot_clock64(struct timespec64 *ts) 92int __init register_persistent_clock(clock_access_fn read_persistent)
94{
95 __read_boot_clock(ts);
96}
97
98int __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
224void read_boot_clock64(struct timespec64 *ts) 224void __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
237static u64 read_tod_clock(struct clocksource *cs) 242static 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