lkml.org 
[lkml]   [2008]   [May]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] NTP: Make the RTC sync mode 11-minute again
 As a result of the rewrite to drive the RTC sync from NTP code to use a
timer, the piece of code responsible for doing this is triggered each time
do_adjtimex() is called. Which may be as often as once per 64 seconds as
this is the minimum interval between NTP packets used by the daemon.
Make the interval 11 minutes again, by not reactivating the timer if
pending already.

Note with this approach, there is a small window where the timer has
expired, but has not been rearmed yet, for example when the handler is
still early in sync_cmos_clock() by the time this function is called.
The likelihood of this event is epsilon and it should not be enough of a
problem to justify designing a mutex solution to avoid it -- if the
scenario happens either the RTC will be updated twice or mod_timer() will
be called from sync_cmos_clock() even before the newly-armed timer
expires, cancelling the additional update.

Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org>
---
Tested successfully at the run time with a MIPS64 system (Broadcom
SWARM). Please apply.

Maciej

patch-2.6.26-rc1-20080505-ntp-11min-0
diff -up --recursive --new-file linux-2.6.26-rc1-20080505.macro/kernel/time/ntp.c linux-2.6.26-rc1-20080505/kernel/time/ntp.c
--- linux-2.6.26-rc1-20080505.macro/kernel/time/ntp.c 2008-05-05 02:56:03.000000000 +0000
+++ linux-2.6.26-rc1-20080505/kernel/time/ntp.c 2008-05-12 01:51:21.000000000 +0000
@@ -263,7 +263,7 @@ static void sync_cmos_clock(unsigned lon

static void notify_cmos_timer(void)
{
- if (!no_sync_cmos_clock)
+ if (!no_sync_cmos_clock && !timer_pending(&sync_cmos_timer))
mod_timer(&sync_cmos_timer, jiffies + 1);
}


\
 
 \ /
  Last update: 2008-05-12 16:31    [W:0.036 / U:0.516 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site