System clock going slow/fast with ntpdate

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I have board with MIPS 34Kc processor and linux-2.6.29 with CONFIG_HZ_250=y set in kernel configuration (i.e 250 timer
interrupts per 1 real second in /proc/interrupts). When I try to synchronize time using ntpdate command, the time gets
synchronized. This resync is being done every 5 min using cron. The clocksource is set to jiffies and is the only source
available. After some time (1 hr and more) the system clock (kernel/software) sometimes starts slowing down and sometime
goes fast. System time increments very slowly i.e 1 sec on system takes 8-9 real seconds (as per wrist watch) or fast 2
sec in 1 real second.

#date 
Tue Oct 25 15:14:05 IST 2016 
 # date 
 Tue Oct 25 15:14:05 IST 2016 
 # date 
 Tue Oct 25 15:14:05 IST 2016 
 # date 
 Tue Oct 25 15:14:05 IST 2016 
 # date 
 Tue Oct 25 15:14:05 IST 2016 
 # date 
 Tue Oct 25 15:14:05 IST 2016 
 # date 
 Tue Oct 25 15:14:05 IST 2016 
 # date 
 Tue Oct 25 15:14:05 IST 2016 
 # date 
 Tue Oct 25 15:14:05 IST 2016 
 # date 
 Tue Oct 25 15:14:06 IST 2016 
 # date 
 Tue Oct 25 15:14:06 IST 2016

(It took 10 date commands to increment from 14:05 to 15:06)

On further analysing the system we found the number of timer interrupts in /proc/interrupts has actually gone down from
250 to 40 every 1 real second

(1) Normal Operation 10 real sec watch window

cat /proc/interrupts

Start of timer  MIPS timer intr count 3856633 
 End of Timer   MIPS timer intr count 3859268

 Timing approximately 10-11 real sec, the interrupts are 263 per sec.

(2) Clock Slow (Less Timer Interrupts)
After ntpdate run for 1 hr once per 5 min

cat /proc/interrupts

 Start of timer  MIPS timer intr count 985072 
 End of Timer   MIPS timer intr count 985492

 985492 - 985072 = 420 in 10 sec (real) = 42 in 1 sec

(3) Fast Clock with ntpdate (More Timer interrupts)

Start of timer  MIPS timer intr count 4068301 
End of Timer   MIPS timer intr count 4073411 
 985492 - 985072 = 5110 in 10 sec (real) = 511 in 1 real sec

ntpdate uses ntp_adjtime()/adjtimex() GNU libc system call for changing system clock and can change it but by a very
small amount.

But the issue is it is changing system clock so much that other application have started behaving erratically, timers
are not expiring in required time etc.. and once the system clock has slowed down/fast it remains in that state.

# cat /sys/devices/system/clocksource/clocksource0/available_clocksource 
 jiffies 
  
 # cat /sys/devices/system/clocksource/clocksource0/current_clocksource   
 jiffies

We are using gcc version 4.5.2  and gnu libc

Please help me in understanding this behaviour of NTP with MIPS Linux and possible fixes if any. Is it a kernel bug or a
configuration issue?

regards,

Deepak Gaur





[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux