diff options
author | Matt Mackall <mpm@selenic.com> | 2006-03-28 04:55:58 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-28 12:16:00 -0500 |
commit | 63732c2f37093d63102d53e70866cf87bf0c0479 (patch) | |
tree | bf364131da50132b6e27cfb028eee725fb4fe3e5 /include/asm-i386/mach-default | |
parent | 329b10bb0feacb7fb9a41389313ff0a51ae56f2a (diff) |
[PATCH] RTC: Remove RTC UIP synchronization on x86
Reading the CMOS clock on x86 and some other arches currently takes up to one
second because it synchronizes with the CMOS second tick-over. This delay
shows up at boot time as well a resume time.
This is the currently the most substantial boot time delay for machines that
are working towards instant-on capability. Also, a quick back of the envelope
calculation (.5sec * 2M users * 1 boot a day * 10 years) suggests it has cost
Linux users in the neighborhood of a million man-hours.
An earlier thread on this topic is here:
http://groups.google.com/group/linux.kernel/browse_frm/thread/8a24255215ff6151/2aa97e66a977653d?hl=en&lr=&ie=UTF-8&rnum=1&prev=/groups%3Fhl%3Den%26lr%3D%26ie%3DUTF-8%26selm%3D1To2R-2S7-11%40gated-at.bofh.it#2aa97e66a977653d
..from which the consensus seems to be that it's no longer desirable.
In my view, there are basically four cases to consider:
1) networked, need precise walltime: use NTP
2) networked, don't need precise walltime: use NTP anyway
3) not networked, don't need sub-second precision walltime: don't care
4) not networked, need sub-second precision walltime:
get a network or a radio time source because RTC isn't good enough anyway
So this patch series simply removes the synchronization in favor of a simple
seqlock-like approach using the seconds value.
Note that for purposes of timer accuracy on wakeup, this patch will cause us
to fire timers up to one second late. But as the current timer resume code
will already sync once (or more!), it's no worse for short timers.
Signed-off-by: Matt Mackall <mpm@selenic.com>
Cc: Andi Kleen <ak@muc.de>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Kazumoto Kojima <kkojima@rr.iij4u.or.jp>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/asm-i386/mach-default')
-rw-r--r-- | include/asm-i386/mach-default/mach_time.h | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/include/asm-i386/mach-default/mach_time.h b/include/asm-i386/mach-default/mach_time.h index b749aa44a86f..ff03cf0fdc3c 100644 --- a/include/asm-i386/mach-default/mach_time.h +++ b/include/asm-i386/mach-default/mach_time.h | |||
@@ -82,21 +82,8 @@ static inline int mach_set_rtc_mmss(unsigned long nowtime) | |||
82 | static inline unsigned long mach_get_cmos_time(void) | 82 | static inline unsigned long mach_get_cmos_time(void) |
83 | { | 83 | { |
84 | unsigned int year, mon, day, hour, min, sec; | 84 | unsigned int year, mon, day, hour, min, sec; |
85 | int i; | ||
86 | 85 | ||
87 | /* The Linux interpretation of the CMOS clock register contents: | 86 | do { |
88 | * When the Update-In-Progress (UIP) flag goes from 1 to 0, the | ||
89 | * RTC registers show the second which has precisely just started. | ||
90 | * Let's hope other operating systems interpret the RTC the same way. | ||
91 | */ | ||
92 | /* read RTC exactly on falling edge of update flag */ | ||
93 | for (i = 0 ; i < 1000000 ; i++) /* may take up to 1 second... */ | ||
94 | if (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP) | ||
95 | break; | ||
96 | for (i = 0 ; i < 1000000 ; i++) /* must try at least 2.228 ms */ | ||
97 | if (!(CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP)) | ||
98 | break; | ||
99 | do { /* Isn't this overkill ? UIP above should guarantee consistency */ | ||
100 | sec = CMOS_READ(RTC_SECONDS); | 87 | sec = CMOS_READ(RTC_SECONDS); |
101 | min = CMOS_READ(RTC_MINUTES); | 88 | min = CMOS_READ(RTC_MINUTES); |
102 | hour = CMOS_READ(RTC_HOURS); | 89 | hour = CMOS_READ(RTC_HOURS); |
@@ -104,6 +91,7 @@ static inline unsigned long mach_get_cmos_time(void) | |||
104 | mon = CMOS_READ(RTC_MONTH); | 91 | mon = CMOS_READ(RTC_MONTH); |
105 | year = CMOS_READ(RTC_YEAR); | 92 | year = CMOS_READ(RTC_YEAR); |
106 | } while (sec != CMOS_READ(RTC_SECONDS)); | 93 | } while (sec != CMOS_READ(RTC_SECONDS)); |
94 | |||
107 | if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) | 95 | if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) |
108 | { | 96 | { |
109 | BCD_TO_BIN(sec); | 97 | BCD_TO_BIN(sec); |