diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2007-02-16 04:27:43 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-16 11:13:57 -0500 |
commit | 5d8b34fdcb384161552d01ee8f34af5ff11f9684 (patch) | |
tree | 7052d50574d747b7ec2172051adf8126074d6982 /kernel/timer.c | |
parent | 7e69f2b1ead2a4c51c12817f18263ff0e59335a6 (diff) |
[PATCH] clocksource: Add verification (watchdog) helper
The TSC needs to be verified against another clocksource. Instead of using
hardwired assumptions of available hardware, provide a generic verification
mechanism. The verification uses the best available clocksource and handles
the usability for high resolution timers / dynticks of the clocksource which
needs to be verified.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Cc: john stultz <johnstul@us.ibm.com>
Cc: Roman Zippel <zippel@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/timer.c')
-rw-r--r-- | kernel/timer.c | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/kernel/timer.c b/kernel/timer.c index 4b088fcadb3f..b68a21a82e17 100644 --- a/kernel/timer.c +++ b/kernel/timer.c | |||
@@ -832,30 +832,33 @@ EXPORT_SYMBOL(do_settimeofday); | |||
832 | * | 832 | * |
833 | * Accumulates current time interval and initializes new clocksource | 833 | * Accumulates current time interval and initializes new clocksource |
834 | */ | 834 | */ |
835 | static int change_clocksource(void) | 835 | static void change_clocksource(void) |
836 | { | 836 | { |
837 | struct clocksource *new; | 837 | struct clocksource *new; |
838 | cycle_t now; | 838 | cycle_t now; |
839 | u64 nsec; | 839 | u64 nsec; |
840 | |||
840 | new = clocksource_get_next(); | 841 | new = clocksource_get_next(); |
841 | if (clock != new) { | 842 | |
842 | now = clocksource_read(new); | 843 | if (clock == new) |
843 | nsec = __get_nsec_offset(); | 844 | return; |
844 | timespec_add_ns(&xtime, nsec); | 845 | |
845 | 846 | now = clocksource_read(new); | |
846 | clock = new; | 847 | nsec = __get_nsec_offset(); |
847 | clock->cycle_last = now; | 848 | timespec_add_ns(&xtime, nsec); |
848 | printk(KERN_INFO "Time: %s clocksource has been installed.\n", | 849 | |
849 | clock->name); | 850 | clock = new; |
850 | return 1; | 851 | clock->cycle_last = now; |
851 | } | 852 | |
852 | return 0; | 853 | clock->error = 0; |
854 | clock->xtime_nsec = 0; | ||
855 | clocksource_calculate_interval(clock, NTP_INTERVAL_LENGTH); | ||
856 | |||
857 | printk(KERN_INFO "Time: %s clocksource has been installed.\n", | ||
858 | clock->name); | ||
853 | } | 859 | } |
854 | #else | 860 | #else |
855 | static inline int change_clocksource(void) | 861 | static inline void change_clocksource(void) { } |
856 | { | ||
857 | return 0; | ||
858 | } | ||
859 | #endif | 862 | #endif |
860 | 863 | ||
861 | /** | 864 | /** |
@@ -869,7 +872,7 @@ int timekeeping_is_continuous(void) | |||
869 | do { | 872 | do { |
870 | seq = read_seqbegin(&xtime_lock); | 873 | seq = read_seqbegin(&xtime_lock); |
871 | 874 | ||
872 | ret = clock->flags & CLOCK_SOURCE_IS_CONTINUOUS; | 875 | ret = clock->flags & CLOCK_SOURCE_VALID_FOR_HRES; |
873 | 876 | ||
874 | } while (read_seqretry(&xtime_lock, seq)); | 877 | } while (read_seqretry(&xtime_lock, seq)); |
875 | 878 | ||
@@ -1124,11 +1127,7 @@ static void update_wall_time(void) | |||
1124 | clock->xtime_nsec -= (s64)xtime.tv_nsec << clock->shift; | 1127 | clock->xtime_nsec -= (s64)xtime.tv_nsec << clock->shift; |
1125 | 1128 | ||
1126 | /* check to see if there is a new clocksource to use */ | 1129 | /* check to see if there is a new clocksource to use */ |
1127 | if (change_clocksource()) { | 1130 | change_clocksource(); |
1128 | clock->error = 0; | ||
1129 | clock->xtime_nsec = 0; | ||
1130 | clocksource_calculate_interval(clock, NTP_INTERVAL_LENGTH); | ||
1131 | } | ||
1132 | } | 1131 | } |
1133 | 1132 | ||
1134 | /* | 1133 | /* |