Commit c399da0d authored by David P. Reed's avatar David P. Reed Committed by Thomas Gleixner

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: default avatarDavid P. Reed <dpreed@reed.com>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent fa6a1a55
...@@ -82,18 +82,15 @@ static int set_rtc_mmss(unsigned long nowtime) ...@@ -82,18 +82,15 @@ static int set_rtc_mmss(unsigned long nowtime)
int retval = 0; int retval = 0;
int real_seconds, real_minutes, cmos_minutes; int real_seconds, real_minutes, cmos_minutes;
unsigned char control, freq_select; unsigned char control, freq_select;
unsigned long flags;
/* /*
* IRQs are disabled when we're called from the timer interrupt, * set_rtc_mmss is called when irqs are enabled, so disable irqs here
* no need for spin_lock_irqsave()
*/ */
spin_lock_irqsave(&rtc_lock, flags);
spin_lock(&rtc_lock);
/* /*
* Tell the clock it's being set and stop it. * Tell the clock it's being set and stop it.
*/ */
control = CMOS_READ(RTC_CONTROL); control = CMOS_READ(RTC_CONTROL);
CMOS_WRITE(control | RTC_SET, RTC_CONTROL); CMOS_WRITE(control | RTC_SET, RTC_CONTROL);
...@@ -138,7 +135,7 @@ static int set_rtc_mmss(unsigned long nowtime) ...@@ -138,7 +135,7 @@ static int set_rtc_mmss(unsigned long nowtime)
CMOS_WRITE(control, RTC_CONTROL); CMOS_WRITE(control, RTC_CONTROL);
CMOS_WRITE(freq_select, RTC_FREQ_SELECT); CMOS_WRITE(freq_select, RTC_FREQ_SELECT);
spin_unlock(&rtc_lock); spin_unlock_irqrestore(&rtc_lock, flags);
return retval; return retval;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment