aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2014-07-16 17:05:13 -0400
committerJohn Stultz <john.stultz@linaro.org>2014-07-23 18:01:52 -0400
commit4a0e637738f06673725792d74eed67f8779b62c7 (patch)
treea5943ca88cc98cf65d3d2fd22f6311699ed2222b /kernel
parent09ec54429c6d10f87d1f084de53ae2c1c3a81108 (diff)
clocksource: Get rid of cycle_last
cycle_last was added to the clocksource to support the TSC validation. We moved that to the core code, so we can get rid of the extra copy. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: John Stultz <john.stultz@linaro.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/time/timekeeping.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index 531805013786..4e748c404749 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -121,7 +121,7 @@ static void tk_setup_internals(struct timekeeper *tk, struct clocksource *clock)
121 121
122 old_clock = tk->clock; 122 old_clock = tk->clock;
123 tk->clock = clock; 123 tk->clock = clock;
124 tk->cycle_last = clock->cycle_last = clock->read(clock); 124 tk->cycle_last = clock->read(clock);
125 125
126 /* Do the ns -> cycle conversion first, using original mult */ 126 /* Do the ns -> cycle conversion first, using original mult */
127 tmp = NTP_INTERVAL_LENGTH; 127 tmp = NTP_INTERVAL_LENGTH;
@@ -182,7 +182,7 @@ static inline s64 timekeeping_get_ns(struct timekeeper *tk)
182 cycle_now = clock->read(clock); 182 cycle_now = clock->read(clock);
183 183
184 /* calculate the delta since the last update_wall_time: */ 184 /* calculate the delta since the last update_wall_time: */
185 delta = clocksource_delta(cycle_now, clock->cycle_last, clock->mask); 185 delta = clocksource_delta(cycle_now, tk->cycle_last, clock->mask);
186 186
187 nsec = delta * tk->mult + tk->xtime_nsec; 187 nsec = delta * tk->mult + tk->xtime_nsec;
188 nsec >>= tk->shift; 188 nsec >>= tk->shift;
@@ -202,7 +202,7 @@ static inline s64 timekeeping_get_ns_raw(struct timekeeper *tk)
202 cycle_now = clock->read(clock); 202 cycle_now = clock->read(clock);
203 203
204 /* calculate the delta since the last update_wall_time: */ 204 /* calculate the delta since the last update_wall_time: */
205 delta = clocksource_delta(cycle_now, clock->cycle_last, clock->mask); 205 delta = clocksource_delta(cycle_now, tk->cycle_last, clock->mask);
206 206
207 /* convert delta to nanoseconds. */ 207 /* convert delta to nanoseconds. */
208 nsec = clocksource_cyc2ns(delta, clock->mult, clock->shift); 208 nsec = clocksource_cyc2ns(delta, clock->mult, clock->shift);
@@ -218,7 +218,8 @@ static inline void update_vsyscall(struct timekeeper *tk)
218 struct timespec xt; 218 struct timespec xt;
219 219
220 xt = tk_xtime(tk); 220 xt = tk_xtime(tk);
221 update_vsyscall_old(&xt, &tk->wall_to_monotonic, tk->clock, tk->mult); 221 update_vsyscall_old(&xt, &tk->wall_to_monotonic, tk->clock, tk->mult,
222 tk->cycle_last);
222} 223}
223 224
224static inline void old_vsyscall_fixup(struct timekeeper *tk) 225static inline void old_vsyscall_fixup(struct timekeeper *tk)
@@ -342,8 +343,8 @@ static void timekeeping_forward_now(struct timekeeper *tk)
342 343
343 clock = tk->clock; 344 clock = tk->clock;
344 cycle_now = clock->read(clock); 345 cycle_now = clock->read(clock);
345 delta = clocksource_delta(cycle_now, clock->cycle_last, clock->mask); 346 delta = clocksource_delta(cycle_now, tk->cycle_last, clock->mask);
346 tk->cycle_last = clock->cycle_last = cycle_now; 347 tk->cycle_last = cycle_now;
347 348
348 tk->xtime_nsec += delta * tk->mult; 349 tk->xtime_nsec += delta * tk->mult;
349 350
@@ -1020,13 +1021,13 @@ static void timekeeping_resume(void)
1020 */ 1021 */
1021 cycle_now = clock->read(clock); 1022 cycle_now = clock->read(clock);
1022 if ((clock->flags & CLOCK_SOURCE_SUSPEND_NONSTOP) && 1023 if ((clock->flags & CLOCK_SOURCE_SUSPEND_NONSTOP) &&
1023 cycle_now > clock->cycle_last) { 1024 cycle_now > tk->cycle_last) {
1024 u64 num, max = ULLONG_MAX; 1025 u64 num, max = ULLONG_MAX;
1025 u32 mult = clock->mult; 1026 u32 mult = clock->mult;
1026 u32 shift = clock->shift; 1027 u32 shift = clock->shift;
1027 s64 nsec = 0; 1028 s64 nsec = 0;
1028 1029
1029 cycle_delta = clocksource_delta(cycle_now, clock->cycle_last, 1030 cycle_delta = clocksource_delta(cycle_now, tk->cycle_last,
1030 clock->mask); 1031 clock->mask);
1031 1032
1032 /* 1033 /*
@@ -1053,7 +1054,7 @@ static void timekeeping_resume(void)
1053 __timekeeping_inject_sleeptime(tk, &ts_delta); 1054 __timekeeping_inject_sleeptime(tk, &ts_delta);
1054 1055
1055 /* Re-base the last cycle value */ 1056 /* Re-base the last cycle value */
1056 tk->cycle_last = clock->cycle_last = cycle_now; 1057 tk->cycle_last = cycle_now;
1057 tk->ntp_error = 0; 1058 tk->ntp_error = 0;
1058 timekeeping_suspended = 0; 1059 timekeeping_suspended = 0;
1059 timekeeping_update(tk, TK_MIRROR | TK_CLOCK_WAS_SET); 1060 timekeeping_update(tk, TK_MIRROR | TK_CLOCK_WAS_SET);
@@ -1433,7 +1434,7 @@ void update_wall_time(void)
1433#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET 1434#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET
1434 offset = real_tk->cycle_interval; 1435 offset = real_tk->cycle_interval;
1435#else 1436#else
1436 offset = clocksource_delta(clock->read(clock), clock->cycle_last, 1437 offset = clocksource_delta(clock->read(clock), tk->cycle_last,
1437 clock->mask); 1438 clock->mask);
1438#endif 1439#endif
1439 1440
@@ -1477,8 +1478,6 @@ void update_wall_time(void)
1477 clock_set |= accumulate_nsecs_to_secs(tk); 1478 clock_set |= accumulate_nsecs_to_secs(tk);
1478 1479
1479 write_seqcount_begin(&tk_core.seq); 1480 write_seqcount_begin(&tk_core.seq);
1480 /* Update clock->cycle_last with the new value */
1481 clock->cycle_last = tk->cycle_last;
1482 /* 1481 /*
1483 * Update the real timekeeper. 1482 * Update the real timekeeper.
1484 * 1483 *