Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c399da0d97e06803e51085ec076b63a3168aad1b
Commit:     c399da0d97e06803e51085ec076b63a3168aad1b
Parent:     fa6a1a554b50cbb7763f6907e6fef927ead480d9
Author:     David P. Reed <[EMAIL PROTECTED]>
AuthorDate: Wed Nov 14 17:47:35 2007 -0500
Committer:  Thomas Gleixner <[EMAIL PROTECTED](none)>
CommitDate: Sat Nov 17 16:27:01 2007 +0100

    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 <[EMAIL PROTECTED]>
    Signed-off-by: Thomas Gleixner <[EMAIL PROTECTED]>
---
 arch/x86/kernel/time_64.c |   11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/arch/x86/kernel/time_64.c b/arch/x86/kernel/time_64.c
index c821edc..4ad1f7a 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)
        int retval = 0;
        int real_seconds, real_minutes, cmos_minutes;
        unsigned char control, freq_select;
+       unsigned long flags;
 
 /*
- * IRQs are disabled when we're called from the timer interrupt,
- * no need for spin_lock_irqsave()
+ * set_rtc_mmss is called when irqs are enabled, so disable irqs here
  */
-
-       spin_lock(&rtc_lock);
-
+       spin_lock_irqsave(&rtc_lock, flags);
 /*
  * Tell the clock it's being set and stop it.
  */
-
        control = CMOS_READ(RTC_CONTROL);
        CMOS_WRITE(control | RTC_SET, RTC_CONTROL);
 
@@ -138,7 +135,7 @@ static int set_rtc_mmss(unsigned long nowtime)
        CMOS_WRITE(control, RTC_CONTROL);
        CMOS_WRITE(freq_select, RTC_FREQ_SELECT);
 
-       spin_unlock(&rtc_lock);
+       spin_unlock_irqrestore(&rtc_lock, flags);
 
        return retval;
 }
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to