diff options
author | john stultz <johnstul@us.ibm.com> | 2009-05-01 13:10:26 -0700 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2009-05-02 11:45:15 +0200 |
commit | 7d27558c4138ac6b3684dea35c2f4379b940a7dd (patch) | |
tree | c10f5cee4dda1e6bc7977d016db020377f97feab /kernel/time/timekeeping.c | |
parent | a25cbd045a2ffc42787d4dbcbb9c7118f5f42732 (diff) | |
download | op-kernel-dev-7d27558c4138ac6b3684dea35c2f4379b940a7dd.zip op-kernel-dev-7d27558c4138ac6b3684dea35c2f4379b940a7dd.tar.gz |
timekeeping: create arch_gettimeoffset infrastructure
Some arches don't supply their own clocksource. This is mainly the
case in architectures that get their inter-tick times by reading the
counter on their interval timer. Since these timers wrap every tick,
they're not really useful as clocksources. Wrapping them to act like
one is possible but not very efficient. So we provide a callout these
arches can implement for use with the jiffies clocksource to provide
finer then tick granular time.
[ Impact: ease the migration to generic time keeping ]
Signed-off-by: John Stultz <johnstul@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel/time/timekeeping.c')
-rw-r--r-- | kernel/time/timekeeping.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 687dff4..e97c50f 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -77,6 +77,10 @@ static void clocksource_forward_now(void) clock->cycle_last = cycle_now; nsec = cyc2ns(clock, cycle_delta); + + /* If arch requires, add in gettimeoffset() */ + nsec += arch_gettimeoffset(); + timespec_add_ns(&xtime, nsec); nsec = ((s64)cycle_delta * clock->mult_orig) >> clock->shift; @@ -111,6 +115,9 @@ void getnstimeofday(struct timespec *ts) /* convert to nanoseconds: */ nsecs = cyc2ns(clock, cycle_delta); + /* If arch requires, add in gettimeoffset() */ + nsecs += arch_gettimeoffset(); + } while (read_seqretry(&xtime_lock, seq)); timespec_add_ns(ts, nsecs); |