aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/time_64.c
diff options
context:
space:
mode:
authorDavid P. Reed <dpreed@reed.com>2007-11-14 17:47:35 -0500
committerThomas Gleixner <tglx@apollo.(none)>2007-11-17 10:27:01 -0500
commitc399da0d97e06803e51085ec076b63a3168aad1b (patch)
treede37d0450254d8755f82db6ff6c392230698ca95 /arch/x86/kernel/time_64.c
parentfa6a1a554b50cbb7763f6907e6fef927ead480d9 (diff)
x86: fix freeze in x86_64 RTC update code in time_64.c
Fix hard freeze on x86_64 when the ntpd service calls update_persistent_clock() A repeatable but randomly timed freeze has been happening in Fedora 6 and 7 for the last year, whenever I run the ntpd service on my AMD64x2 HP Pavilion dv9000z laptop. This freeze is due to the use of spin_lock(&rtc_lock) under the assumption (per a bad comment) that set_rtc_mmss is called only with interrupts disabled. The call from ntp.c to update_persistent_clock is made with interrupts enabled. Signed-off-by: David P. Reed <dpreed@reed.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/kernel/time_64.c')
-rw-r--r--arch/x86/kernel/time_64.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/arch/x86/kernel/time_64.c b/arch/x86/kernel/time_64.c
index c821edc32216..4ad1f7a6a839 100644
--- a/arch/x86/kernel/time_64.c
+++ b/arch/x86/kernel/time_64.c
@@ -82,18 +82,15 @@ static int set_rtc_mmss(unsigned long nowtime)
82 int retval = 0; 82 int retval = 0;
83 int real_seconds, real_minutes, cmos_minutes; 83 int real_seconds, real_minutes, cmos_minutes;
84 unsigned char control, freq_select; 84 unsigned char control, freq_select;
85 unsigned long flags;
85 86
86/* 87/*
87 * IRQs are disabled when we're called from the timer interrupt, 88 * set_rtc_mmss is called when irqs are enabled, so disable irqs here
88 * no need for spin_lock_irqsave()
89 */ 89 */
90 90 spin_lock_irqsave(&rtc_lock, flags);
91 spin_lock(&rtc_lock);
92
93/* 91/*
94 * Tell the clock it's being set and stop it. 92 * Tell the clock it's being set and stop it.
95 */ 93 */
96
97 control = CMOS_READ(RTC_CONTROL); 94 control = CMOS_READ(RTC_CONTROL);
98 CMOS_WRITE(control | RTC_SET, RTC_CONTROL); 95 CMOS_WRITE(control | RTC_SET, RTC_CONTROL);
99 96
@@ -138,7 +135,7 @@ static int set_rtc_mmss(unsigned long nowtime)
138 CMOS_WRITE(control, RTC_CONTROL); 135 CMOS_WRITE(control, RTC_CONTROL);
139 CMOS_WRITE(freq_select, RTC_FREQ_SELECT); 136 CMOS_WRITE(freq_select, RTC_FREQ_SELECT);
140 137
141 spin_unlock(&rtc_lock); 138 spin_unlock_irqrestore(&rtc_lock, flags);
142 139
143 return retval; 140 return retval;
144} 141}