Re: PROBLEM: Linux updates RTC secretly when clock synchronizes

Ian Maclaine-cross (iml@ilm.mech.unsw.edu.au)
Thu, 8 Nov 2001 16:09:38 +1100


Hi!
On Tue, Nov 06, 2001 at 11:18:46AM +0100, Pavel Machek wrote:
[snip]
> > I agree with you, Pavel. Commenting out the 11 minute update
> > code is a better solution. :)
>
> Are you going to try to push patch trhough linus?

Yes, I will prepare a patch for the 2.5 series. Thanks to all for
their contributions.

Please find following a short, crude and preliminary, 2.4.12 i386
patch which I am now testing on my AMD K6-III machine. Reasons for
commenting out the 11 minute update code are in my previous
linux-kernel email. My patched compressed kernel is 156 bytes smaller.
It has been running normally with clock synchronized to NTP for two
days and has left the RTC to drift freely.

diff -u --recursive linux.old/arch/i386/kernel/time.c linux/arch/i386/kernel/time.c
--- linux.old/arch/i386/kernel/time.c Tue Sep 18 16:03:09 2001
+++ linux/arch/i386/kernel/time.c Tue Nov 6 21:03:46 2001
@@ -313,6 +313,8 @@
write_unlock_irq(&xtime_lock);
}

+#ifdef UPDATE_RTC
+
/*
* In order to set the CMOS clock precisely, set_rtc_mmss has to be
* called 500 ms after the second nowtime has started, because when
@@ -384,6 +386,8 @@
/* last time the cmos clock got updated */
static long last_rtc_update;

+#endif
+
int timer_ack;

/*
@@ -426,6 +430,8 @@
smp_local_timer_interrupt(regs);
#endif

+#ifdef UPDATE_RTC
+
/*
* If we have an externally synchronized Linux clock, then update
* CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be
@@ -440,6 +446,7 @@
else
last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */
}
+#endif

#ifdef CONFIG_MCA
if( MCA_bus ) {

-- 
Regards,
Ian Maclaine-cross (iml@debian.org)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/