diff options
| author | Atsushi Nemoto <anemo@mba.ocn.ne.jp> | 2006-10-01 02:28:31 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-01 03:39:27 -0400 |
| commit | 8ef386092d7c2891bd7acefb2a87f878f7e9a0d6 (patch) | |
| tree | b149f0c63f9b9bb3f43e82097f1ae5972662288f /arch | |
| parent | 70bc42f90a3f4721c89dbe865e6c95da8565b41c (diff) | |
[PATCH] kill wall_jiffies
With 2.6.18-rc4-mm2, now wall_jiffies will always be the same as jiffies.
So we can kill wall_jiffies completely.
This is just a cleanup and logically should not change any real behavior
except for one thing: RTC updating code in (old) ppc and xtensa use a
condition "jiffies - wall_jiffies == 1". This condition is never met so I
suppose it is just a bug. I just remove that condition only instead of
kill the whole "if" block.
[heiko.carstens@de.ibm.com: s390 build fix and cleanup]
Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc: Andi Kleen <ak@muc.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: Ian Molton <spyro@f2s.com>
Cc: Mikael Starvik <starvik@axis.com>
Cc: David Howells <dhowells@redhat.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Hirokazu Takata <takata.hirokazu@renesas.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Kyle McMartin <kyle@mcmartin.ca>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Kazumoto Kojima <kkojima@rr.iij4u.or.jp>
Cc: Richard Curnow <rc@rc0.org.uk>
Cc: William Lee Irwin III <wli@holomorphy.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Miles Bader <uclinux-v850@lsi.nec.co.jp>
Cc: Chris Zankel <chris@zankel.net>
Cc: "Luck, Tony" <tony.luck@intel.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Roman Zippel <zippel@linux-m68k.org>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch')
| -rw-r--r-- | arch/alpha/kernel/time.c | 15 | ||||
| -rw-r--r-- | arch/arm/kernel/time.c | 10 | ||||
| -rw-r--r-- | arch/arm26/kernel/time.c | 12 | ||||
| -rw-r--r-- | arch/cris/kernel/time.c | 7 | ||||
| -rw-r--r-- | arch/i386/kernel/time.c | 3 | ||||
| -rw-r--r-- | arch/ia64/kernel/time.c | 2 | ||||
| -rw-r--r-- | arch/m32r/kernel/time.c | 11 | ||||
| -rw-r--r-- | arch/m68k/kernel/time.c | 16 | ||||
| -rw-r--r-- | arch/m68knommu/kernel/time.c | 7 | ||||
| -rw-r--r-- | arch/mips/kernel/time.c | 12 | ||||
| -rw-r--r-- | arch/mips/sgi-ip27/ip27-timer.c | 2 | ||||
| -rw-r--r-- | arch/parisc/kernel/time.c | 5 | ||||
| -rw-r--r-- | arch/powerpc/kernel/time.c | 7 | ||||
| -rw-r--r-- | arch/ppc/kernel/time.c | 11 | ||||
| -rw-r--r-- | arch/s390/kernel/time.c | 7 | ||||
| -rw-r--r-- | arch/sh/kernel/time.c | 10 | ||||
| -rw-r--r-- | arch/sh64/kernel/time.c | 12 | ||||
| -rw-r--r-- | arch/sparc/kernel/pcic.c | 16 | ||||
| -rw-r--r-- | arch/sparc/kernel/time.c | 18 | ||||
| -rw-r--r-- | arch/sparc64/kernel/time.c | 2 | ||||
| -rw-r--r-- | arch/x86_64/kernel/time.c | 12 | ||||
| -rw-r--r-- | arch/x86_64/kernel/vmlinux.lds.S | 3 | ||||
| -rw-r--r-- | arch/x86_64/kernel/vsyscall.c | 3 | ||||
| -rw-r--r-- | arch/xtensa/kernel/time.c | 13 |
24 files changed, 34 insertions, 182 deletions
diff --git a/arch/alpha/kernel/time.c b/arch/alpha/kernel/time.c index 7c1e44420a78..581ddcc22fc5 100644 --- a/arch/alpha/kernel/time.c +++ b/arch/alpha/kernel/time.c | |||
| @@ -54,8 +54,6 @@ | |||
| 54 | #include "proto.h" | 54 | #include "proto.h" |
| 55 | #include "irq_impl.h" | 55 | #include "irq_impl.h" |
| 56 | 56 | ||
| 57 | extern unsigned long wall_jiffies; /* kernel/timer.c */ | ||
| 58 | |||
| 59 | static int set_rtc_mmss(unsigned long); | 57 | static int set_rtc_mmss(unsigned long); |
| 60 | 58 | ||
| 61 | DEFINE_SPINLOCK(rtc_lock); | 59 | DEFINE_SPINLOCK(rtc_lock); |
| @@ -413,7 +411,7 @@ void | |||
| 413 | do_gettimeofday(struct timeval *tv) | 411 | do_gettimeofday(struct timeval *tv) |
| 414 | { | 412 | { |
| 415 | unsigned long flags; | 413 | unsigned long flags; |
| 416 | unsigned long sec, usec, lost, seq; | 414 | unsigned long sec, usec, seq; |
| 417 | unsigned long delta_cycles, delta_usec, partial_tick; | 415 | unsigned long delta_cycles, delta_usec, partial_tick; |
| 418 | 416 | ||
| 419 | do { | 417 | do { |
| @@ -423,14 +421,13 @@ do_gettimeofday(struct timeval *tv) | |||
| 423 | sec = xtime.tv_sec; | 421 | sec = xtime.tv_sec; |
| 424 | usec = (xtime.tv_nsec / 1000); | 422 | usec = (xtime.tv_nsec / 1000); |
| 425 | partial_tick = state.partial_tick; | 423 | partial_tick = state.partial_tick; |
| 426 | lost = jiffies - wall_jiffies; | ||
| 427 | 424 | ||
| 428 | } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); | 425 | } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); |
| 429 | 426 | ||
| 430 | #ifdef CONFIG_SMP | 427 | #ifdef CONFIG_SMP |
| 431 | /* Until and unless we figure out how to get cpu cycle counters | 428 | /* Until and unless we figure out how to get cpu cycle counters |
| 432 | in sync and keep them there, we can't use the rpcc tricks. */ | 429 | in sync and keep them there, we can't use the rpcc tricks. */ |
| 433 | delta_usec = lost * (1000000 / HZ); | 430 | delta_usec = 0; |
| 434 | #else | 431 | #else |
| 435 | /* | 432 | /* |
| 436 | * usec = cycles * ticks_per_cycle * 2**48 * 1e6 / (2**48 * ticks) | 433 | * usec = cycles * ticks_per_cycle * 2**48 * 1e6 / (2**48 * ticks) |
| @@ -446,8 +443,7 @@ do_gettimeofday(struct timeval *tv) | |||
| 446 | */ | 443 | */ |
| 447 | 444 | ||
| 448 | delta_usec = (delta_cycles * state.scaled_ticks_per_cycle | 445 | delta_usec = (delta_cycles * state.scaled_ticks_per_cycle |
| 449 | + partial_tick | 446 | + partial_tick) * 15625; |
| 450 | + (lost << FIX_SHIFT)) * 15625; | ||
| 451 | delta_usec = ((delta_usec / ((1UL << (FIX_SHIFT-6-1)) * HZ)) + 1) / 2; | 447 | delta_usec = ((delta_usec / ((1UL << (FIX_SHIFT-6-1)) * HZ)) + 1) / 2; |
| 452 | #endif | 448 | #endif |
| 453 | 449 | ||
| @@ -480,12 +476,11 @@ do_settimeofday(struct timespec *tv) | |||
| 480 | time. Without this, a full-tick error is possible. */ | 476 | time. Without this, a full-tick error is possible. */ |
| 481 | 477 | ||
| 482 | #ifdef CONFIG_SMP | 478 | #ifdef CONFIG_SMP |
| 483 | delta_nsec = (jiffies - wall_jiffies) * (NSEC_PER_SEC / HZ); | 479 | delta_nsec = 0; |
| 484 | #else | 480 | #else |
| 485 | delta_nsec = rpcc() - state.last_time; | 481 | delta_nsec = rpcc() - state.last_time; |
| 486 | delta_nsec = (delta_nsec * state.scaled_ticks_per_cycle | 482 | delta_nsec = (delta_nsec * state.scaled_ticks_per_cycle |
| 487 | + state.partial_tick | 483 | + state.partial_tick) * 15625; |
| 488 | + ((jiffies - wall_jiffies) << FIX_SHIFT)) * 15625; | ||
| 489 | delta_nsec = ((delta_nsec / ((1UL << (FIX_SHIFT-6-1)) * HZ)) + 1) / 2; | 484 | delta_nsec = ((delta_nsec / ((1UL << (FIX_SHIFT-6-1)) * HZ)) + 1) / 2; |
| 490 | delta_nsec *= 1000; | 485 | delta_nsec *= 1000; |
| 491 | #endif | 486 | #endif |
diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c index f7d5165796ef..b030320b17c7 100644 --- a/arch/arm/kernel/time.c +++ b/arch/arm/kernel/time.c | |||
| @@ -37,8 +37,6 @@ | |||
| 37 | */ | 37 | */ |
| 38 | struct sys_timer *system_timer; | 38 | struct sys_timer *system_timer; |
| 39 | 39 | ||
| 40 | extern unsigned long wall_jiffies; | ||
| 41 | |||
| 42 | /* this needs a better home */ | 40 | /* this needs a better home */ |
| 43 | DEFINE_SPINLOCK(rtc_lock); | 41 | DEFINE_SPINLOCK(rtc_lock); |
| 44 | 42 | ||
| @@ -237,16 +235,11 @@ void do_gettimeofday(struct timeval *tv) | |||
| 237 | { | 235 | { |
| 238 | unsigned long flags; | 236 | unsigned long flags; |
| 239 | unsigned long seq; | 237 | unsigned long seq; |
| 240 | unsigned long usec, sec, lost; | 238 | unsigned long usec, sec; |
| 241 | 239 | ||
| 242 | do { | 240 | do { |
| 243 | seq = read_seqbegin_irqsave(&xtime_lock, flags); | 241 | seq = read_seqbegin_irqsave(&xtime_lock, flags); |
| 244 | usec = system_timer->offset(); | 242 | usec = system_timer->offset(); |
| 245 | |||
| 246 | lost = jiffies - wall_jiffies; | ||
| 247 | if (lost) | ||
| 248 | usec += lost * USECS_PER_JIFFY; | ||
| 249 | |||
| 250 | sec = xtime.tv_sec; | 243 | sec = xtime.tv_sec; |
| 251 | usec += xtime.tv_nsec / 1000; | 244 | usec += xtime.tv_nsec / 1000; |
| 252 | } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); | 245 | } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); |
| @@ -279,7 +272,6 @@ int do_settimeofday(struct timespec *tv) | |||
| 279 | * done, and then undo it! | 272 | * done, and then undo it! |
| 280 | */ | 273 | */ |
| 281 | nsec -= system_timer->offset() * NSEC_PER_USEC; | 274 | nsec -= system_timer->offset() * NSEC_PER_USEC; |
| 282 | nsec -= (jiffies - wall_jiffies) * TICK_NSEC; | ||
| 283 | 275 | ||
| 284 | wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec); | 276 | wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec); |
| 285 | wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec); | 277 | wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec); |
diff --git a/arch/arm26/kernel/time.c b/arch/arm26/kernel/time.c index 80adbd005fc5..1206469b2b86 100644 --- a/arch/arm26/kernel/time.c +++ b/arch/arm26/kernel/time.c | |||
| @@ -33,8 +33,6 @@ | |||
| 33 | #include <asm/irq.h> | 33 | #include <asm/irq.h> |
| 34 | #include <asm/ioc.h> | 34 | #include <asm/ioc.h> |
| 35 | 35 | ||
| 36 | extern unsigned long wall_jiffies; | ||
| 37 | |||
| 38 | /* this needs a better home */ | 36 | /* this needs a better home */ |
| 39 | DEFINE_SPINLOCK(rtc_lock); | 37 | DEFINE_SPINLOCK(rtc_lock); |
| 40 | 38 | ||
| @@ -136,16 +134,11 @@ void do_gettimeofday(struct timeval *tv) | |||
| 136 | { | 134 | { |
| 137 | unsigned long flags; | 135 | unsigned long flags; |
| 138 | unsigned long seq; | 136 | unsigned long seq; |
| 139 | unsigned long usec, sec, lost; | 137 | unsigned long usec, sec; |
| 140 | 138 | ||
| 141 | do { | 139 | do { |
| 142 | seq = read_seqbegin_irqsave(&xtime_lock, flags); | 140 | seq = read_seqbegin_irqsave(&xtime_lock, flags); |
| 143 | usec = gettimeoffset(); | 141 | usec = gettimeoffset(); |
| 144 | |||
| 145 | lost = jiffies - wall_jiffies; | ||
| 146 | if (lost) | ||
| 147 | usec += lost * USECS_PER_JIFFY; | ||
| 148 | |||
| 149 | sec = xtime.tv_sec; | 142 | sec = xtime.tv_sec; |
| 150 | usec += xtime.tv_nsec / 1000; | 143 | usec += xtime.tv_nsec / 1000; |
| 151 | } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); | 144 | } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); |
| @@ -174,8 +167,7 @@ int do_settimeofday(struct timespec *tv) | |||
| 174 | * wall time. Discover what correction gettimeofday() would have | 167 | * wall time. Discover what correction gettimeofday() would have |
| 175 | * done, and then undo it! | 168 | * done, and then undo it! |
| 176 | */ | 169 | */ |
| 177 | tv->tv_nsec -= 1000 * (gettimeoffset() + | 170 | tv->tv_nsec -= 1000 * gettimeoffset(); |
| 178 | (jiffies - wall_jiffies) * USECS_PER_JIFFY); | ||
| 179 | 171 | ||
| 180 | while (tv->tv_nsec < 0) { | 172 | while (tv->tv_nsec < 0) { |
| 181 | tv->tv_nsec += NSEC_PER_SEC; | 173 | tv->tv_nsec += NSEC_PER_SEC; |
diff --git a/arch/cris/kernel/time.c b/arch/cris/kernel/time.c index 66ba8898db07..0f9213cbd48e 100644 --- a/arch/cris/kernel/time.c +++ b/arch/cris/kernel/time.c | |||
| @@ -37,7 +37,6 @@ int have_rtc; /* used to remember if we have an RTC or not */; | |||
| 37 | 37 | ||
| 38 | #define TICK_SIZE tick | 38 | #define TICK_SIZE tick |
| 39 | 39 | ||
| 40 | extern unsigned long wall_jiffies; | ||
| 41 | extern unsigned long loops_per_jiffy; /* init/main.c */ | 40 | extern unsigned long loops_per_jiffy; /* init/main.c */ |
| 42 | unsigned long loops_per_usec; | 41 | unsigned long loops_per_usec; |
| 43 | 42 | ||
| @@ -58,11 +57,6 @@ void do_gettimeofday(struct timeval *tv) | |||
| 58 | local_irq_save(flags); | 57 | local_irq_save(flags); |
| 59 | local_irq_disable(); | 58 | local_irq_disable(); |
| 60 | usec = do_gettimeoffset(); | 59 | usec = do_gettimeoffset(); |
| 61 | { | ||
| 62 | unsigned long lost = jiffies - wall_jiffies; | ||
| 63 | if (lost) | ||
| 64 | usec += lost * (1000000 / HZ); | ||
| 65 | } | ||
| 66 | 60 | ||
| 67 | /* | 61 | /* |
| 68 | * If time_adjust is negative then NTP is slowing the clock | 62 | * If time_adjust is negative then NTP is slowing the clock |
| @@ -103,7 +97,6 @@ int do_settimeofday(struct timespec *tv) | |||
| 103 | * made, and then undo it! | 97 | * made, and then undo it! |
| 104 | */ | 98 | */ |
| 105 | nsec -= do_gettimeoffset() * NSEC_PER_USEC; | 99 | nsec -= do_gettimeoffset() * NSEC_PER_USEC; |
| 106 | nsec -= (jiffies - wall_jiffies) * TICK_NSEC; | ||
| 107 | 100 | ||
| 108 | wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec); | 101 | wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec); |
| 109 | wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec); | 102 | wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec); |
diff --git a/arch/i386/kernel/time.c b/arch/i386/kernel/time.c index 86944acfb647..58a2d5582419 100644 --- a/arch/i386/kernel/time.c +++ b/arch/i386/kernel/time.c | |||
| @@ -76,8 +76,6 @@ int pit_latch_buggy; /* extern */ | |||
| 76 | unsigned int cpu_khz; /* Detected as we calibrate the TSC */ | 76 | unsigned int cpu_khz; /* Detected as we calibrate the TSC */ |
| 77 | EXPORT_SYMBOL(cpu_khz); | 77 | EXPORT_SYMBOL(cpu_khz); |
| 78 | 78 | ||
| 79 | extern unsigned long wall_jiffies; | ||
| 80 | |||
| 81 | DEFINE_SPINLOCK(rtc_lock); | 79 | DEFINE_SPINLOCK(rtc_lock); |
| 82 | EXPORT_SYMBOL(rtc_lock); | 80 | EXPORT_SYMBOL(rtc_lock); |
| 83 | 81 | ||
| @@ -329,7 +327,6 @@ static int timer_resume(struct sys_device *dev) | |||
| 329 | do_settimeofday(&ts); | 327 | do_settimeofday(&ts); |
| 330 | write_seqlock_irqsave(&xtime_lock, flags); | 328 | write_seqlock_irqsave(&xtime_lock, flags); |
| 331 | jiffies_64 += sleep_length; | 329 | jiffies_64 += sleep_length; |
| 332 | wall_jiffies += sleep_length; | ||
| 333 | write_sequnlock_irqrestore(&xtime_lock, flags); | 330 | write_sequnlock_irqrestore(&xtime_lock, flags); |
| 334 | touch_softlockup_watchdog(); | 331 | touch_softlockup_watchdog(); |
| 335 | return 0; | 332 | return 0; |
diff --git a/arch/ia64/kernel/time.c b/arch/ia64/kernel/time.c index 16262687a103..62e07f906e05 100644 --- a/arch/ia64/kernel/time.c +++ b/arch/ia64/kernel/time.c | |||
| @@ -29,8 +29,6 @@ | |||
| 29 | #include <asm/sections.h> | 29 | #include <asm/sections.h> |
| 30 | #include <asm/system.h> | 30 | #include <asm/system.h> |
| 31 | 31 | ||
| 32 | extern unsigned long wall_jiffies; | ||
| 33 | |||
| 34 | volatile int time_keeper_id = 0; /* smp_processor_id() of time-keeper */ | 32 | volatile int time_keeper_id = 0; /* smp_processor_id() of time-keeper */ |
| 35 | 33 | ||
| 36 | #ifdef CONFIG_IA64_DEBUG_IRQ | 34 | #ifdef CONFIG_IA64_DEBUG_IRQ |
diff --git a/arch/m32r/kernel/time.c b/arch/m32r/kernel/time.c index 7a896893cd28..d8af155db984 100644 --- a/arch/m32r/kernel/time.c +++ b/arch/m32r/kernel/time.c | |||
| @@ -38,7 +38,6 @@ extern void send_IPI_allbutself(int, int); | |||
| 38 | extern void smp_local_timer_interrupt(struct pt_regs *); | 38 | extern void smp_local_timer_interrupt(struct pt_regs *); |
| 39 | #endif | 39 | #endif |
| 40 | 40 | ||
| 41 | extern unsigned long wall_jiffies; | ||
| 42 | #define TICK_SIZE (tick_nsec / 1000) | 41 | #define TICK_SIZE (tick_nsec / 1000) |
| 43 | 42 | ||
| 44 | /* | 43 | /* |
| @@ -108,24 +107,17 @@ void do_gettimeofday(struct timeval *tv) | |||
| 108 | unsigned long max_ntp_tick = tick_usec - tickadj; | 107 | unsigned long max_ntp_tick = tick_usec - tickadj; |
| 109 | 108 | ||
| 110 | do { | 109 | do { |
| 111 | unsigned long lost; | ||
| 112 | |||
| 113 | seq = read_seqbegin(&xtime_lock); | 110 | seq = read_seqbegin(&xtime_lock); |
| 114 | 111 | ||
| 115 | usec = do_gettimeoffset(); | 112 | usec = do_gettimeoffset(); |
| 116 | lost = jiffies - wall_jiffies; | ||
| 117 | 113 | ||
| 118 | /* | 114 | /* |
| 119 | * If time_adjust is negative then NTP is slowing the clock | 115 | * If time_adjust is negative then NTP is slowing the clock |
| 120 | * so make sure not to go into next possible interval. | 116 | * so make sure not to go into next possible interval. |
| 121 | * Better to lose some accuracy than have time go backwards.. | 117 | * Better to lose some accuracy than have time go backwards.. |
| 122 | */ | 118 | */ |
| 123 | if (unlikely(time_adjust < 0)) { | 119 | if (unlikely(time_adjust < 0)) |
| 124 | usec = min(usec, max_ntp_tick); | 120 | usec = min(usec, max_ntp_tick); |
| 125 | if (lost) | ||
| 126 | usec += lost * max_ntp_tick; | ||
| 127 | } else if (unlikely(lost)) | ||
| 128 | usec += lost * tick_usec; | ||
| 129 | 121 | ||
| 130 | sec = xtime.tv_sec; | 122 | sec = xtime.tv_sec; |
| 131 | usec += (xtime.tv_nsec / 1000); | 123 | usec += (xtime.tv_nsec / 1000); |
| @@ -158,7 +150,6 @@ int do_settimeofday(struct timespec *tv) | |||
| 158 | * made, and then undo it! | 150 | * made, and then undo it! |
| 159 | */ | 151 | */ |
| 160 | nsec -= do_gettimeoffset() * NSEC_PER_USEC; | 152 | nsec -= do_gettimeoffset() * NSEC_PER_USEC; |
| 161 | nsec -= (jiffies - wall_jiffies) * TICK_NSEC; | ||
| 162 | 153 | ||
| 163 | wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec); | 154 | wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec); |
| 164 | wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec); | 155 | wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec); |
diff --git a/arch/m68k/kernel/time.c b/arch/m68k/kernel/time.c index 1072e4946a4a..6cfc984380d9 100644 --- a/arch/m68k/kernel/time.c +++ b/arch/m68k/kernel/time.c | |||
| @@ -96,31 +96,23 @@ void time_init(void) | |||
| 96 | void do_gettimeofday(struct timeval *tv) | 96 | void do_gettimeofday(struct timeval *tv) |
| 97 | { | 97 | { |
| 98 | unsigned long flags; | 98 | unsigned long flags; |
| 99 | extern unsigned long wall_jiffies; | ||
| 100 | unsigned long seq; | 99 | unsigned long seq; |
| 101 | unsigned long usec, sec, lost; | 100 | unsigned long usec, sec; |
| 102 | unsigned long max_ntp_tick = tick_usec - tickadj; | 101 | unsigned long max_ntp_tick = tick_usec - tickadj; |
| 103 | 102 | ||
| 104 | do { | 103 | do { |
| 105 | seq = read_seqbegin_irqsave(&xtime_lock, flags); | 104 | seq = read_seqbegin_irqsave(&xtime_lock, flags); |
| 106 | 105 | ||
| 107 | usec = mach_gettimeoffset(); | 106 | usec = mach_gettimeoffset(); |
| 108 | lost = jiffies - wall_jiffies; | ||
| 109 | 107 | ||
| 110 | /* | 108 | /* |
| 111 | * If time_adjust is negative then NTP is slowing the clock | 109 | * If time_adjust is negative then NTP is slowing the clock |
| 112 | * so make sure not to go into next possible interval. | 110 | * so make sure not to go into next possible interval. |
| 113 | * Better to lose some accuracy than have time go backwards.. | 111 | * Better to lose some accuracy than have time go backwards.. |
| 114 | */ | 112 | */ |
| 115 | if (unlikely(time_adjust < 0)) { | 113 | if (unlikely(time_adjust < 0)) |
| 116 | usec = min(usec, max_ntp_tick); | 114 | usec = min(usec, max_ntp_tick); |
| 117 | 115 | ||
| 118 | if (lost) | ||
| 119 | usec += lost * max_ntp_tick; | ||
| 120 | } | ||
| 121 | else if (unlikely(lost)) | ||
| 122 | usec += lost * tick_usec; | ||
| 123 | |||
| 124 | sec = xtime.tv_sec; | 116 | sec = xtime.tv_sec; |
| 125 | usec += xtime.tv_nsec/1000; | 117 | usec += xtime.tv_nsec/1000; |
| 126 | } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); | 118 | } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); |
| @@ -141,7 +133,6 @@ int do_settimeofday(struct timespec *tv) | |||
| 141 | { | 133 | { |
| 142 | time_t wtm_sec, sec = tv->tv_sec; | 134 | time_t wtm_sec, sec = tv->tv_sec; |
| 143 | long wtm_nsec, nsec = tv->tv_nsec; | 135 | long wtm_nsec, nsec = tv->tv_nsec; |
| 144 | extern unsigned long wall_jiffies; | ||
| 145 | 136 | ||
| 146 | if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC) | 137 | if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC) |
| 147 | return -EINVAL; | 138 | return -EINVAL; |
| @@ -153,8 +144,7 @@ int do_settimeofday(struct timespec *tv) | |||
| 153 | * Discover what correction gettimeofday | 144 | * Discover what correction gettimeofday |
| 154 | * would have done, and then undo it! | 145 | * would have done, and then undo it! |
| 155 | */ | 146 | */ |
| 156 | nsec -= 1000 * (mach_gettimeoffset() + | 147 | nsec -= 1000 * mach_gettimeoffset(); |
| 157 | (jiffies - wall_jiffies) * (1000000 / HZ)); | ||
| 158 | 148 | ||
| 159 | wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec); | 149 | wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec); |
| 160 | wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec); | 150 | wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec); |
diff --git a/arch/m68knommu/kernel/time.c b/arch/m68knommu/kernel/time.c index db1e1ce0a349..c5667bdddd5e 100644 --- a/arch/m68knommu/kernel/time.c +++ b/arch/m68knommu/kernel/time.c | |||
| @@ -26,8 +26,6 @@ | |||
| 26 | 26 | ||
| 27 | #define TICK_SIZE (tick_nsec / 1000) | 27 | #define TICK_SIZE (tick_nsec / 1000) |
| 28 | 28 | ||
| 29 | extern unsigned long wall_jiffies; | ||
| 30 | |||
| 31 | 29 | ||
| 32 | static inline int set_rtc_mmss(unsigned long nowtime) | 30 | static inline int set_rtc_mmss(unsigned long nowtime) |
| 33 | { | 31 | { |
| @@ -124,15 +122,12 @@ void time_init(void) | |||
| 124 | void do_gettimeofday(struct timeval *tv) | 122 | void do_gettimeofday(struct timeval *tv) |
| 125 | { | 123 | { |
| 126 | unsigned long flags; | 124 | unsigned long flags; |
| 127 | unsigned long lost, seq; | 125 | unsigned long seq; |
| 128 | unsigned long usec, sec; | 126 | unsigned long usec, sec; |
| 129 | 127 | ||
| 130 | do { | 128 | do { |
| 131 | seq = read_seqbegin_irqsave(&xtime_lock, flags); | 129 | seq = read_seqbegin_irqsave(&xtime_lock, flags); |
| 132 | usec = mach_gettimeoffset ? mach_gettimeoffset() : 0; | 130 | usec = mach_gettimeoffset ? mach_gettimeoffset() : 0; |
| 133 | lost = jiffies - wall_jiffies; | ||
| 134 | if (lost) | ||
| 135 | usec += lost * (1000000 / HZ); | ||
| 136 | sec = xtime.tv_sec; | 131 | sec = xtime.tv_sec; |
| 137 | usec += (xtime.tv_nsec / 1000); | 132 | usec += (xtime.tv_nsec / 1000); |
| 138 | } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); | 133 | } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); |
diff --git a/arch/mips/kernel/time.c b/arch/mips/kernel/time.c index 6ab8d975a974..845c7e55505d 100644 --- a/arch/mips/kernel/time.c +++ b/arch/mips/kernel/time.c | |||
| @@ -47,8 +47,6 @@ | |||
| 47 | /* | 47 | /* |
| 48 | * forward reference | 48 | * forward reference |
| 49 | */ | 49 | */ |
| 50 | extern volatile unsigned long wall_jiffies; | ||
| 51 | |||
| 52 | DEFINE_SPINLOCK(rtc_lock); | 50 | DEFINE_SPINLOCK(rtc_lock); |
| 53 | 51 | ||
| 54 | /* | 52 | /* |
| @@ -159,7 +157,6 @@ void (*mips_hpt_init)(unsigned int); | |||
| 159 | void do_gettimeofday(struct timeval *tv) | 157 | void do_gettimeofday(struct timeval *tv) |
| 160 | { | 158 | { |
| 161 | unsigned long seq; | 159 | unsigned long seq; |
| 162 | unsigned long lost; | ||
| 163 | unsigned long usec, sec; | 160 | unsigned long usec, sec; |
| 164 | unsigned long max_ntp_tick; | 161 | unsigned long max_ntp_tick; |
| 165 | 162 | ||
| @@ -168,8 +165,6 @@ void do_gettimeofday(struct timeval *tv) | |||
| 168 | 165 | ||
| 169 | usec = do_gettimeoffset(); | 166 | usec = do_gettimeoffset(); |
| 170 | 167 | ||
| 171 | lost = jiffies - wall_jiffies; | ||
| 172 | |||
| 173 | /* | 168 | /* |
| 174 | * If time_adjust is negative then NTP is slowing the clock | 169 | * If time_adjust is negative then NTP is slowing the clock |
| 175 | * so make sure not to go into next possible interval. | 170 | * so make sure not to go into next possible interval. |
| @@ -178,11 +173,7 @@ void do_gettimeofday(struct timeval *tv) | |||
| 178 | if (unlikely(time_adjust < 0)) { | 173 | if (unlikely(time_adjust < 0)) { |
| 179 | max_ntp_tick = (USEC_PER_SEC / HZ) - tickadj; | 174 | max_ntp_tick = (USEC_PER_SEC / HZ) - tickadj; |
| 180 | usec = min(usec, max_ntp_tick); | 175 | usec = min(usec, max_ntp_tick); |
| 181 | 176 | } | |
| 182 | if (lost) | ||
| 183 | usec += lost * max_ntp_tick; | ||
| 184 | } else if (unlikely(lost)) | ||
| 185 | usec += lost * (USEC_PER_SEC / HZ); | ||
| 186 | 177 | ||
| 187 | sec = xtime.tv_sec; | 178 | sec = xtime.tv_sec; |
| 188 | usec += (xtime.tv_nsec / 1000); | 179 | usec += (xtime.tv_nsec / 1000); |
| @@ -217,7 +208,6 @@ int do_settimeofday(struct timespec *tv) | |||
| 217 | * made, and then undo it! | 208 | * made, and then undo it! |
| 218 | */ | 209 | */ |
| 219 | nsec -= do_gettimeoffset() * NSEC_PER_USEC; | 210 | nsec -= do_gettimeoffset() * NSEC_PER_USEC; |
| 220 | nsec -= (jiffies - wall_jiffies) * tick_nsec; | ||
| 221 | 211 | ||
| 222 | wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec); | 212 | wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec); |
| 223 | wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec); | 213 | wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec); |
diff --git a/arch/mips/sgi-ip27/ip27-timer.c b/arch/mips/sgi-ip27/ip27-timer.c index c62a3a9ef867..257ce118e380 100644 --- a/arch/mips/sgi-ip27/ip27-timer.c +++ b/arch/mips/sgi-ip27/ip27-timer.c | |||
| @@ -42,8 +42,6 @@ | |||
| 42 | static unsigned long ct_cur[NR_CPUS]; /* What counter should be at next timer irq */ | 42 | static unsigned long ct_cur[NR_CPUS]; /* What counter should be at next timer irq */ |
| 43 | static long last_rtc_update; /* Last time the rtc clock got updated */ | 43 | static long last_rtc_update; /* Last time the rtc clock got updated */ |
| 44 | 44 | ||
| 45 | extern volatile unsigned long wall_jiffies; | ||
| 46 | |||
| 47 | #if 0 | 45 | #if 0 |
| 48 | static int set_rtc_mmss(unsigned long nowtime) | 46 | static int set_rtc_mmss(unsigned long nowtime) |
| 49 | { | 47 | { |
diff --git a/arch/parisc/kernel/time.c b/arch/parisc/kernel/time.c index 700df10924dd..ab641d67f551 100644 --- a/arch/parisc/kernel/time.c +++ b/arch/parisc/kernel/time.c | |||
| @@ -32,9 +32,6 @@ | |||
| 32 | 32 | ||
| 33 | #include <linux/timex.h> | 33 | #include <linux/timex.h> |
| 34 | 34 | ||
| 35 | /* xtime and wall_jiffies keep wall-clock time */ | ||
| 36 | extern unsigned long wall_jiffies; | ||
| 37 | |||
| 38 | static long clocktick __read_mostly; /* timer cycles per tick */ | 35 | static long clocktick __read_mostly; /* timer cycles per tick */ |
| 39 | static long halftick __read_mostly; | 36 | static long halftick __read_mostly; |
| 40 | 37 | ||
| @@ -112,7 +109,7 @@ EXPORT_SYMBOL(profile_pc); | |||
| 112 | /*** converted from ia64 ***/ | 109 | /*** converted from ia64 ***/ |
| 113 | /* | 110 | /* |
| 114 | * Return the number of micro-seconds that elapsed since the last | 111 | * Return the number of micro-seconds that elapsed since the last |
| 115 | * update to wall time (aka xtime aka wall_jiffies). The xtime_lock | 112 | * update to wall time (aka xtime). The xtime_lock |
| 116 | * must be at least read-locked when calling this routine. | 113 | * must be at least read-locked when calling this routine. |
| 117 | */ | 114 | */ |
| 118 | static inline unsigned long | 115 | static inline unsigned long |
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c index 71f71da98e7d..8b278d85ca4e 100644 --- a/arch/powerpc/kernel/time.c +++ b/arch/powerpc/kernel/time.c | |||
| @@ -117,8 +117,6 @@ unsigned tb_to_ns_shift; | |||
| 117 | 117 | ||
| 118 | struct gettimeofday_struct do_gtod; | 118 | struct gettimeofday_struct do_gtod; |
| 119 | 119 | ||
| 120 | extern unsigned long wall_jiffies; | ||
| 121 | |||
| 122 | extern struct timezone sys_tz; | 120 | extern struct timezone sys_tz; |
| 123 | static long timezone_offset; | 121 | static long timezone_offset; |
| 124 | 122 | ||
| @@ -816,11 +814,6 @@ int do_settimeofday(struct timespec *tv) | |||
| 816 | /* | 814 | /* |
| 817 | * Subtract off the number of nanoseconds since the | 815 | * Subtract off the number of nanoseconds since the |
| 818 | * beginning of the last tick. | 816 | * beginning of the last tick. |
| 819 | * Note that since we don't increment jiffies_64 anywhere other | ||
| 820 | * than in do_timer (since we don't have a lost tick problem), | ||
| 821 | * wall_jiffies will always be the same as jiffies, | ||
| 822 | * and therefore the (jiffies - wall_jiffies) computation | ||
| 823 | * has been removed. | ||
| 824 | */ | 817 | */ |
| 825 | tb_delta = tb_ticks_since(tb_last_jiffy); | 818 | tb_delta = tb_ticks_since(tb_last_jiffy); |
| 826 | tb_delta = mulhdu(tb_delta, do_gtod.varp->tb_to_xs); /* in xsec */ | 819 | tb_delta = mulhdu(tb_delta, do_gtod.varp->tb_to_xs); /* in xsec */ |
diff --git a/arch/ppc/kernel/time.c b/arch/ppc/kernel/time.c index 1e1f31554767..187388625a76 100644 --- a/arch/ppc/kernel/time.c +++ b/arch/ppc/kernel/time.c | |||
| @@ -80,8 +80,6 @@ unsigned tb_to_us; | |||
| 80 | unsigned tb_last_stamp; | 80 | unsigned tb_last_stamp; |
| 81 | unsigned long tb_to_ns_scale; | 81 | unsigned long tb_to_ns_scale; |
| 82 | 82 | ||
| 83 | extern unsigned long wall_jiffies; | ||
| 84 | |||
| 85 | /* used for timezone offset */ | 83 | /* used for timezone offset */ |
| 86 | static long timezone_offset; | 84 | static long timezone_offset; |
| 87 | 85 | ||
| @@ -173,8 +171,7 @@ void timer_interrupt(struct pt_regs * regs) | |||
| 173 | */ | 171 | */ |
| 174 | if ( ppc_md.set_rtc_time && ntp_synced() && | 172 | if ( ppc_md.set_rtc_time && ntp_synced() && |
| 175 | xtime.tv_sec - last_rtc_update >= 659 && | 173 | xtime.tv_sec - last_rtc_update >= 659 && |
| 176 | abs((xtime.tv_nsec / 1000) - (1000000-1000000/HZ)) < 500000/HZ && | 174 | abs((xtime.tv_nsec / 1000) - (1000000-1000000/HZ)) < 500000/HZ) { |
| 177 | jiffies - wall_jiffies == 1) { | ||
| 178 | if (ppc_md.set_rtc_time(xtime.tv_sec+1 + timezone_offset) == 0) | 175 | if (ppc_md.set_rtc_time(xtime.tv_sec+1 + timezone_offset) == 0) |
| 179 | last_rtc_update = xtime.tv_sec+1; | 176 | last_rtc_update = xtime.tv_sec+1; |
| 180 | else | 177 | else |
| @@ -200,7 +197,7 @@ void do_gettimeofday(struct timeval *tv) | |||
| 200 | { | 197 | { |
| 201 | unsigned long flags; | 198 | unsigned long flags; |
| 202 | unsigned long seq; | 199 | unsigned long seq; |
| 203 | unsigned delta, lost_ticks, usec, sec; | 200 | unsigned delta, usec, sec; |
| 204 | 201 | ||
| 205 | do { | 202 | do { |
| 206 | seq = read_seqbegin_irqsave(&xtime_lock, flags); | 203 | seq = read_seqbegin_irqsave(&xtime_lock, flags); |
| @@ -214,10 +211,9 @@ void do_gettimeofday(struct timeval *tv) | |||
| 214 | if (!smp_tb_synchronized) | 211 | if (!smp_tb_synchronized) |
| 215 | delta = 0; | 212 | delta = 0; |
| 216 | #endif /* CONFIG_SMP */ | 213 | #endif /* CONFIG_SMP */ |
| 217 | lost_ticks = jiffies - wall_jiffies; | ||
| 218 | } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); | 214 | } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); |
| 219 | 215 | ||
| 220 | usec += mulhwu(tb_to_us, tb_ticks_per_jiffy * lost_ticks + delta); | 216 | usec += mulhwu(tb_to_us, delta); |
| 221 | while (usec >= 1000000) { | 217 | while (usec >= 1000000) { |
| 222 | sec++; | 218 | sec++; |
| 223 | usec -= 1000000; | 219 | usec -= 1000000; |
| @@ -258,7 +254,6 @@ int do_settimeofday(struct timespec *tv) | |||
| 258 | * still reasonable when gettimeofday resolution is 1 jiffy. | 254 | * still reasonable when gettimeofday resolution is 1 jiffy. |
| 259 | */ | 255 | */ |
| 260 | tb_delta = tb_ticks_since(last_jiffy_stamp(smp_processor_id())); | 256 | tb_delta = tb_ticks_since(last_jiffy_stamp(smp_processor_id())); |
| 261 | tb_delta += (jiffies - wall_jiffies) * tb_ticks_per_jiffy; | ||
| 262 | 257 | ||
| 263 | new_nsec -= 1000 * mulhwu(tb_to_us, tb_delta); | 258 | new_nsec -= 1000 * mulhwu(tb_to_us, tb_delta); |
| 264 | 259 | ||
diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c index abab42e9f5f8..4bf66cc4a267 100644 --- a/arch/s390/kernel/time.c +++ b/arch/s390/kernel/time.c | |||
| @@ -53,8 +53,6 @@ static u64 init_timer_cc; | |||
| 53 | static u64 jiffies_timer_cc; | 53 | static u64 jiffies_timer_cc; |
| 54 | static u64 xtime_cc; | 54 | static u64 xtime_cc; |
| 55 | 55 | ||
| 56 | extern unsigned long wall_jiffies; | ||
| 57 | |||
| 58 | /* | 56 | /* |
| 59 | * Scheduler clock - returns current time in nanosec units. | 57 | * Scheduler clock - returns current time in nanosec units. |
| 60 | */ | 58 | */ |
| @@ -87,9 +85,8 @@ static inline unsigned long do_gettimeoffset(void) | |||
| 87 | { | 85 | { |
| 88 | __u64 now; | 86 | __u64 now; |
| 89 | 87 | ||
| 90 | now = (get_clock() - jiffies_timer_cc) >> 12; | 88 | now = (get_clock() - jiffies_timer_cc) >> 12; |
| 91 | /* We require the offset from the latest update of xtime */ | 89 | now -= (__u64) jiffies * USECS_PER_JIFFY; |
| 92 | now -= (__u64) wall_jiffies*USECS_PER_JIFFY; | ||
| 93 | return (unsigned long) now; | 90 | return (unsigned long) now; |
| 94 | } | 91 | } |
| 95 | 92 | ||
diff --git a/arch/sh/kernel/time.c b/arch/sh/kernel/time.c index f664a196c4f5..450c68f1df05 100644 --- a/arch/sh/kernel/time.c +++ b/arch/sh/kernel/time.c | |||
| @@ -18,7 +18,6 @@ | |||
| 18 | #include <asm/timer.h> | 18 | #include <asm/timer.h> |
| 19 | #include <asm/kgdb.h> | 19 | #include <asm/kgdb.h> |
| 20 | 20 | ||
| 21 | extern unsigned long wall_jiffies; | ||
| 22 | struct sys_timer *sys_timer; | 21 | struct sys_timer *sys_timer; |
| 23 | 22 | ||
| 24 | /* Move this somewhere more sensible.. */ | 23 | /* Move this somewhere more sensible.. */ |
| @@ -52,16 +51,10 @@ void do_gettimeofday(struct timeval *tv) | |||
| 52 | { | 51 | { |
| 53 | unsigned long seq; | 52 | unsigned long seq; |
| 54 | unsigned long usec, sec; | 53 | unsigned long usec, sec; |
| 55 | unsigned long lost; | ||
| 56 | 54 | ||
| 57 | do { | 55 | do { |
| 58 | seq = read_seqbegin(&xtime_lock); | 56 | seq = read_seqbegin(&xtime_lock); |
| 59 | usec = get_timer_offset(); | 57 | usec = get_timer_offset(); |
| 60 | |||
| 61 | lost = jiffies - wall_jiffies; | ||
| 62 | if (lost) | ||
| 63 | usec += lost * (1000000 / HZ); | ||
| 64 | |||
| 65 | sec = xtime.tv_sec; | 58 | sec = xtime.tv_sec; |
| 66 | usec += xtime.tv_nsec / 1000; | 59 | usec += xtime.tv_nsec / 1000; |
| 67 | } while (read_seqretry(&xtime_lock, seq)); | 60 | } while (read_seqretry(&xtime_lock, seq)); |
| @@ -91,8 +84,7 @@ int do_settimeofday(struct timespec *tv) | |||
| 91 | * wall time. Discover what correction gettimeofday() would have | 84 | * wall time. Discover what correction gettimeofday() would have |
| 92 | * made, and then undo it! | 85 | * made, and then undo it! |
| 93 | */ | 86 | */ |
| 94 | nsec -= 1000 * (get_timer_offset() + | 87 | nsec -= 1000 * get_timer_offset(); |
| 95 | (jiffies - wall_jiffies) * (1000000 / HZ)); | ||
| 96 | 88 | ||
| 97 | wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec); | 89 | wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec); |
| 98 | wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec); | 90 | wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec); |
diff --git a/arch/sh64/kernel/time.c b/arch/sh64/kernel/time.c index 3b61e06f9d72..9c4a38a8698c 100644 --- a/arch/sh64/kernel/time.c +++ b/arch/sh64/kernel/time.c | |||
| @@ -107,8 +107,6 @@ | |||
| 107 | 107 | ||
| 108 | #define TICK_SIZE (tick_nsec / 1000) | 108 | #define TICK_SIZE (tick_nsec / 1000) |
| 109 | 109 | ||
| 110 | extern unsigned long wall_jiffies; | ||
| 111 | |||
| 112 | static unsigned long tmu_base, rtc_base; | 110 | static unsigned long tmu_base, rtc_base; |
| 113 | unsigned long cprc_base; | 111 | unsigned long cprc_base; |
| 114 | 112 | ||
| @@ -194,13 +192,6 @@ void do_gettimeofday(struct timeval *tv) | |||
| 194 | do { | 192 | do { |
| 195 | seq = read_seqbegin_irqsave(&xtime_lock, flags); | 193 | seq = read_seqbegin_irqsave(&xtime_lock, flags); |
| 196 | usec = usecs_since_tick(); | 194 | usec = usecs_since_tick(); |
| 197 | { | ||
| 198 | unsigned long lost = jiffies - wall_jiffies; | ||
| 199 | |||
| 200 | if (lost) | ||
| 201 | usec += lost * (1000000 / HZ); | ||
| 202 | } | ||
| 203 | |||
| 204 | sec = xtime.tv_sec; | 195 | sec = xtime.tv_sec; |
| 205 | usec += xtime.tv_nsec / 1000; | 196 | usec += xtime.tv_nsec / 1000; |
| 206 | } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); | 197 | } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); |
| @@ -229,8 +220,7 @@ int do_settimeofday(struct timespec *tv) | |||
| 229 | * wall time. Discover what correction gettimeofday() would have | 220 | * wall time. Discover what correction gettimeofday() would have |
| 230 | * made, and then undo it! | 221 | * made, and then undo it! |
| 231 | */ | 222 | */ |
| 232 | nsec -= 1000 * (usecs_since_tick() + | 223 | nsec -= 1000 * usecs_since_tick(); |
| 233 | (jiffies - wall_jiffies) * (1000000 / HZ)); | ||
| 234 | 224 | ||
| 235 | wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec); | 225 | wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec); |
| 236 | wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec); | 226 | wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec); |
diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c index e19b1bad9bc5..edb6cc665f56 100644 --- a/arch/sparc/kernel/pcic.c +++ b/arch/sparc/kernel/pcic.c | |||
| @@ -765,8 +765,6 @@ static __inline__ unsigned long do_gettimeoffset(void) | |||
| 765 | return count; | 765 | return count; |
| 766 | } | 766 | } |
| 767 | 767 | ||
| 768 | extern unsigned long wall_jiffies; | ||
| 769 | |||
| 770 | static void pci_do_gettimeofday(struct timeval *tv) | 768 | static void pci_do_gettimeofday(struct timeval *tv) |
| 771 | { | 769 | { |
| 772 | unsigned long flags; | 770 | unsigned long flags; |
| @@ -775,26 +773,17 @@ static void pci_do_gettimeofday(struct timeval *tv) | |||
| 775 | unsigned long max_ntp_tick = tick_usec - tickadj; | 773 | unsigned long max_ntp_tick = tick_usec - tickadj; |
| 776 | 774 | ||
| 777 | do { | 775 | do { |
| 778 | unsigned long lost; | ||
| 779 | |||
| 780 | seq = read_seqbegin_irqsave(&xtime_lock, flags); | 776 | seq = read_seqbegin_irqsave(&xtime_lock, flags); |
| 781 | usec = do_gettimeoffset(); | 777 | usec = do_gettimeoffset(); |
| 782 | lost = jiffies - wall_jiffies; | ||
| 783 | 778 | ||
| 784 | /* | 779 | /* |
| 785 | * If time_adjust is negative then NTP is slowing the clock | 780 | * If time_adjust is negative then NTP is slowing the clock |
| 786 | * so make sure not to go into next possible interval. | 781 | * so make sure not to go into next possible interval. |
| 787 | * Better to lose some accuracy than have time go backwards.. | 782 | * Better to lose some accuracy than have time go backwards.. |
| 788 | */ | 783 | */ |
| 789 | if (unlikely(time_adjust < 0)) { | 784 | if (unlikely(time_adjust < 0)) |
| 790 | usec = min(usec, max_ntp_tick); | 785 | usec = min(usec, max_ntp_tick); |
| 791 | 786 | ||
| 792 | if (lost) | ||
| 793 | usec += lost * max_ntp_tick; | ||
| 794 | } | ||
| 795 | else if (unlikely(lost)) | ||
| 796 | usec += lost * tick_usec; | ||
| 797 | |||
| 798 | sec = xtime.tv_sec; | 787 | sec = xtime.tv_sec; |
| 799 | usec += (xtime.tv_nsec / 1000); | 788 | usec += (xtime.tv_nsec / 1000); |
| 800 | } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); | 789 | } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); |
| @@ -819,8 +808,7 @@ static int pci_do_settimeofday(struct timespec *tv) | |||
| 819 | * wall time. Discover what correction gettimeofday() would have | 808 | * wall time. Discover what correction gettimeofday() would have |
| 820 | * made, and then undo it! | 809 | * made, and then undo it! |
| 821 | */ | 810 | */ |
| 822 | tv->tv_nsec -= 1000 * (do_gettimeoffset() + | 811 | tv->tv_nsec -= 1000 * do_gettimeoffset(); |
| 823 | (jiffies - wall_jiffies) * (USEC_PER_SEC / HZ)); | ||
| 824 | while (tv->tv_nsec < 0) { | 812 | while (tv->tv_nsec < 0) { |
| 825 | tv->tv_nsec += NSEC_PER_SEC; | 813 | tv->tv_nsec += NSEC_PER_SEC; |
| 826 | tv->tv_sec--; | 814 | tv->tv_sec--; |
diff --git a/arch/sparc/kernel/time.c b/arch/sparc/kernel/time.c index 6f84fa1b58e5..e10dc831944d 100644 --- a/arch/sparc/kernel/time.c +++ b/arch/sparc/kernel/time.c | |||
| @@ -43,8 +43,6 @@ | |||
| 43 | #include <asm/pcic.h> | 43 | #include <asm/pcic.h> |
| 44 | #include <asm/of_device.h> | 44 | #include <asm/of_device.h> |
| 45 | 45 | ||
| 46 | extern unsigned long wall_jiffies; | ||
| 47 | |||
| 48 | DEFINE_SPINLOCK(rtc_lock); | 46 | DEFINE_SPINLOCK(rtc_lock); |
| 49 | enum sparc_clock_type sp_clock_typ; | 47 | enum sparc_clock_type sp_clock_typ; |
| 50 | DEFINE_SPINLOCK(mostek_lock); | 48 | DEFINE_SPINLOCK(mostek_lock); |
| @@ -449,7 +447,7 @@ unsigned long long sched_clock(void) | |||
| 449 | 447 | ||
| 450 | /* Ok, my cute asm atomicity trick doesn't work anymore. | 448 | /* Ok, my cute asm atomicity trick doesn't work anymore. |
| 451 | * There are just too many variables that need to be protected | 449 | * There are just too many variables that need to be protected |
| 452 | * now (both members of xtime, wall_jiffies, et al.) | 450 | * now (both members of xtime, et al.) |
| 453 | */ | 451 | */ |
| 454 | void do_gettimeofday(struct timeval *tv) | 452 | void do_gettimeofday(struct timeval *tv) |
| 455 | { | 453 | { |
| @@ -459,26 +457,17 @@ void do_gettimeofday(struct timeval *tv) | |||
| 459 | unsigned long max_ntp_tick = tick_usec - tickadj; | 457 | unsigned long max_ntp_tick = tick_usec - tickadj; |
| 460 | 458 | ||
| 461 | do { | 459 | do { |
| 462 | unsigned long lost; | ||
| 463 | |||
| 464 | seq = read_seqbegin_irqsave(&xtime_lock, flags); | 460 | seq = read_seqbegin_irqsave(&xtime_lock, flags); |
| 465 | usec = do_gettimeoffset(); | 461 | usec = do_gettimeoffset(); |
| 466 | lost = jiffies - wall_jiffies; | ||
| 467 | 462 | ||
| 468 | /* | 463 | /* |
| 469 | * If time_adjust is negative then NTP is slowing the clock | 464 | * If time_adjust is negative then NTP is slowing the clock |
| 470 | * so make sure not to go into next possible interval. | 465 | * so make sure not to go into next possible interval. |
| 471 | * Better to lose some accuracy than have time go backwards.. | 466 | * Better to lose some accuracy than have time go backwards.. |
| 472 | */ | 467 | */ |
| 473 | if (unlikely(time_adjust < 0)) { | 468 | if (unlikely(time_adjust < 0)) |
| 474 | usec = min(usec, max_ntp_tick); | 469 | usec = min(usec, max_ntp_tick); |
| 475 | 470 | ||
| 476 | if (lost) | ||
| 477 | usec += lost * max_ntp_tick; | ||
| 478 | } | ||
| 479 | else if (unlikely(lost)) | ||
| 480 | usec += lost * tick_usec; | ||
| 481 | |||
| 482 | sec = xtime.tv_sec; | 471 | sec = xtime.tv_sec; |
| 483 | usec += (xtime.tv_nsec / 1000); | 472 | usec += (xtime.tv_nsec / 1000); |
| 484 | } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); | 473 | } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); |
| @@ -521,8 +510,7 @@ static int sbus_do_settimeofday(struct timespec *tv) | |||
| 521 | * wall time. Discover what correction gettimeofday() would have | 510 | * wall time. Discover what correction gettimeofday() would have |
| 522 | * made, and then undo it! | 511 | * made, and then undo it! |
| 523 | */ | 512 | */ |
| 524 | nsec -= 1000 * (do_gettimeoffset() + | 513 | nsec -= 1000 * do_gettimeoffset(); |
| 525 | (jiffies - wall_jiffies) * (USEC_PER_SEC / HZ)); | ||
| 526 | 514 | ||
| 527 | wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec); | 515 | wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec); |
| 528 | wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec); | 516 | wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec); |
diff --git a/arch/sparc64/kernel/time.c b/arch/sparc64/kernel/time.c index ca1193482f07..00f6fc4aaaff 100644 --- a/arch/sparc64/kernel/time.c +++ b/arch/sparc64/kernel/time.c | |||
| @@ -53,8 +53,6 @@ void __iomem *mstk48t02_regs = NULL; | |||
| 53 | unsigned long ds1287_regs = 0UL; | 53 | unsigned long ds1287_regs = 0UL; |
| 54 | #endif | 54 | #endif |
| 55 | 55 | ||
| 56 | extern unsigned long wall_jiffies; | ||
| 57 | |||
| 58 | static void __iomem *mstk48t08_regs; | 56 | static void __iomem *mstk48t08_regs; |
| 59 | static void __iomem *mstk48t59_regs; | 57 | static void __iomem *mstk48t59_regs; |
| 60 | 58 | ||
diff --git a/arch/x86_64/kernel/time.c b/arch/x86_64/kernel/time.c index 7ea3bf2a858c..557e92af7bea 100644 --- a/arch/x86_64/kernel/time.c +++ b/arch/x86_64/kernel/time.c | |||
| @@ -77,7 +77,6 @@ unsigned long long monotonic_base; | |||
| 77 | struct vxtime_data __vxtime __section_vxtime; /* for vsyscalls */ | 77 | struct vxtime_data __vxtime __section_vxtime; /* for vsyscalls */ |
| 78 | 78 | ||
| 79 | volatile unsigned long __jiffies __section_jiffies = INITIAL_JIFFIES; | 79 | volatile unsigned long __jiffies __section_jiffies = INITIAL_JIFFIES; |
| 80 | unsigned long __wall_jiffies __section_wall_jiffies = INITIAL_JIFFIES; | ||
| 81 | struct timespec __xtime __section_xtime; | 80 | struct timespec __xtime __section_xtime; |
| 82 | struct timezone __sys_tz __section_sys_tz; | 81 | struct timezone __sys_tz __section_sys_tz; |
| 83 | 82 | ||
| @@ -119,7 +118,7 @@ unsigned int (*do_gettimeoffset)(void) = do_gettimeoffset_tsc; | |||
| 119 | 118 | ||
| 120 | void do_gettimeofday(struct timeval *tv) | 119 | void do_gettimeofday(struct timeval *tv) |
| 121 | { | 120 | { |
| 122 | unsigned long seq, t; | 121 | unsigned long seq; |
| 123 | unsigned int sec, usec; | 122 | unsigned int sec, usec; |
| 124 | 123 | ||
| 125 | do { | 124 | do { |
| @@ -136,10 +135,7 @@ void do_gettimeofday(struct timeval *tv) | |||
| 136 | be found. Note when you fix it here you need to do the same | 135 | be found. Note when you fix it here you need to do the same |
| 137 | in arch/x86_64/kernel/vsyscall.c and export all needed | 136 | in arch/x86_64/kernel/vsyscall.c and export all needed |
| 138 | variables in vmlinux.lds. -AK */ | 137 | variables in vmlinux.lds. -AK */ |
| 139 | 138 | usec += do_gettimeoffset(); | |
| 140 | t = (jiffies - wall_jiffies) * USEC_PER_TICK + | ||
| 141 | do_gettimeoffset(); | ||
| 142 | usec += t; | ||
| 143 | 139 | ||
| 144 | } while (read_seqretry(&xtime_lock, seq)); | 140 | } while (read_seqretry(&xtime_lock, seq)); |
| 145 | 141 | ||
| @@ -165,8 +161,7 @@ int do_settimeofday(struct timespec *tv) | |||
| 165 | 161 | ||
| 166 | write_seqlock_irq(&xtime_lock); | 162 | write_seqlock_irq(&xtime_lock); |
| 167 | 163 | ||
| 168 | nsec -= do_gettimeoffset() * NSEC_PER_USEC + | 164 | nsec -= do_gettimeoffset() * NSEC_PER_USEC; |
| 169 | (jiffies - wall_jiffies) * NSEC_PER_TICK; | ||
| 170 | 165 | ||
| 171 | wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec); | 166 | wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec); |
| 172 | wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec); | 167 | wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec); |
| @@ -1071,7 +1066,6 @@ static int timer_resume(struct sys_device *dev) | |||
| 1071 | vxtime.last_tsc = get_cycles_sync(); | 1066 | vxtime.last_tsc = get_cycles_sync(); |
| 1072 | write_sequnlock_irqrestore(&xtime_lock,flags); | 1067 | write_sequnlock_irqrestore(&xtime_lock,flags); |
| 1073 | jiffies += sleep_length; | 1068 | jiffies += sleep_length; |
| 1074 | wall_jiffies += sleep_length; | ||
| 1075 | monotonic_base += sleep_length * (NSEC_PER_SEC/HZ); | 1069 | monotonic_base += sleep_length * (NSEC_PER_SEC/HZ); |
| 1076 | touch_softlockup_watchdog(); | 1070 | touch_softlockup_watchdog(); |
| 1077 | return 0; | 1071 | return 0; |
diff --git a/arch/x86_64/kernel/vmlinux.lds.S b/arch/x86_64/kernel/vmlinux.lds.S index f8aeccf105fa..b9df2ab6529f 100644 --- a/arch/x86_64/kernel/vmlinux.lds.S +++ b/arch/x86_64/kernel/vmlinux.lds.S | |||
| @@ -101,9 +101,6 @@ SECTIONS | |||
| 101 | .vgetcpu_mode : AT(VLOAD(.vgetcpu_mode)) { *(.vgetcpu_mode) } | 101 | .vgetcpu_mode : AT(VLOAD(.vgetcpu_mode)) { *(.vgetcpu_mode) } |
| 102 | vgetcpu_mode = VVIRT(.vgetcpu_mode); | 102 | vgetcpu_mode = VVIRT(.vgetcpu_mode); |
| 103 | 103 | ||
| 104 | .wall_jiffies : AT(VLOAD(.wall_jiffies)) { *(.wall_jiffies) } | ||
| 105 | wall_jiffies = VVIRT(.wall_jiffies); | ||
| 106 | |||
| 107 | .sys_tz : AT(VLOAD(.sys_tz)) { *(.sys_tz) } | 104 | .sys_tz : AT(VLOAD(.sys_tz)) { *(.sys_tz) } |
| 108 | sys_tz = VVIRT(.sys_tz); | 105 | sys_tz = VVIRT(.sys_tz); |
| 109 | 106 | ||
diff --git a/arch/x86_64/kernel/vsyscall.c b/arch/x86_64/kernel/vsyscall.c index 07c086382059..a98b460af6a1 100644 --- a/arch/x86_64/kernel/vsyscall.c +++ b/arch/x86_64/kernel/vsyscall.c | |||
| @@ -66,8 +66,7 @@ static __always_inline void do_vgettimeofday(struct timeval * tv) | |||
| 66 | sequence = read_seqbegin(&__xtime_lock); | 66 | sequence = read_seqbegin(&__xtime_lock); |
| 67 | 67 | ||
| 68 | sec = __xtime.tv_sec; | 68 | sec = __xtime.tv_sec; |
| 69 | usec = (__xtime.tv_nsec / 1000) + | 69 | usec = __xtime.tv_nsec / 1000; |
| 70 | (__jiffies - __wall_jiffies) * (1000000 / HZ); | ||
| 71 | 70 | ||
| 72 | if (__vxtime.mode != VXTIME_HPET) { | 71 | if (__vxtime.mode != VXTIME_HPET) { |
| 73 | t = get_cycles_sync(); | 72 | t = get_cycles_sync(); |
diff --git a/arch/xtensa/kernel/time.c b/arch/xtensa/kernel/time.c index 241db201f40e..37347e369987 100644 --- a/arch/xtensa/kernel/time.c +++ b/arch/xtensa/kernel/time.c | |||
| @@ -26,8 +26,6 @@ | |||
| 26 | #include <asm/platform.h> | 26 | #include <asm/platform.h> |
| 27 | 27 | ||
| 28 | 28 | ||
| 29 | extern volatile unsigned long wall_jiffies; | ||
| 30 | |||
| 31 | DEFINE_SPINLOCK(rtc_lock); | 29 | DEFINE_SPINLOCK(rtc_lock); |
| 32 | EXPORT_SYMBOL(rtc_lock); | 30 | EXPORT_SYMBOL(rtc_lock); |
| 33 | 31 | ||
| @@ -110,7 +108,6 @@ int do_settimeofday(struct timespec *tv) | |||
| 110 | */ | 108 | */ |
| 111 | ccount = get_ccount(); | 109 | ccount = get_ccount(); |
| 112 | nsec -= (ccount - last_ccount_stamp) * CCOUNT_NSEC; | 110 | nsec -= (ccount - last_ccount_stamp) * CCOUNT_NSEC; |
| 113 | nsec -= (jiffies - wall_jiffies) * CCOUNT_PER_JIFFY * CCOUNT_NSEC; | ||
| 114 | 111 | ||
| 115 | wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec); | 112 | wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec); |
| 116 | wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec); | 113 | wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec); |
| @@ -129,7 +126,7 @@ EXPORT_SYMBOL(do_settimeofday); | |||
| 129 | void do_gettimeofday(struct timeval *tv) | 126 | void do_gettimeofday(struct timeval *tv) |
| 130 | { | 127 | { |
| 131 | unsigned long flags; | 128 | unsigned long flags; |
| 132 | unsigned long sec, usec, delta, lost, seq; | 129 | unsigned long sec, usec, delta, seq; |
| 133 | 130 | ||
| 134 | do { | 131 | do { |
| 135 | seq = read_seqbegin_irqsave(&xtime_lock, flags); | 132 | seq = read_seqbegin_irqsave(&xtime_lock, flags); |
| @@ -137,12 +134,9 @@ void do_gettimeofday(struct timeval *tv) | |||
| 137 | delta = get_ccount() - last_ccount_stamp; | 134 | delta = get_ccount() - last_ccount_stamp; |
| 138 | sec = xtime.tv_sec; | 135 | sec = xtime.tv_sec; |
| 139 | usec = (xtime.tv_nsec / NSEC_PER_USEC); | 136 | usec = (xtime.tv_nsec / NSEC_PER_USEC); |
| 140 | |||
| 141 | lost = jiffies - wall_jiffies; | ||
| 142 | |||
| 143 | } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); | 137 | } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); |
| 144 | 138 | ||
| 145 | usec += lost * (1000000UL/HZ) + (delta * CCOUNT_NSEC) / NSEC_PER_USEC; | 139 | usec += (delta * CCOUNT_NSEC) / NSEC_PER_USEC; |
| 146 | for (; usec >= 1000000; sec++, usec -= 1000000) | 140 | for (; usec >= 1000000; sec++, usec -= 1000000) |
| 147 | ; | 141 | ; |
| 148 | 142 | ||
| @@ -179,8 +173,7 @@ again: | |||
| 179 | 173 | ||
| 180 | if (ntp_synced() && | 174 | if (ntp_synced() && |
| 181 | xtime.tv_sec - last_rtc_update >= 659 && | 175 | xtime.tv_sec - last_rtc_update >= 659 && |
| 182 | abs((xtime.tv_nsec/1000)-(1000000-1000000/HZ))<5000000/HZ && | 176 | abs((xtime.tv_nsec/1000)-(1000000-1000000/HZ))<5000000/HZ) { |
| 183 | jiffies - wall_jiffies == 1) { | ||
| 184 | 177 | ||
| 185 | if (platform_set_rtc_time(xtime.tv_sec+1) == 0) | 178 | if (platform_set_rtc_time(xtime.tv_sec+1) == 0) |
| 186 | last_rtc_update = xtime.tv_sec+1; | 179 | last_rtc_update = xtime.tv_sec+1; |
