From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <1767bb4e53e7173810f6d87c41c86ce0.axp-list@archive.invalid> X-Archive-Original-Message-ID: <199802251844.TAA19098@gueuze.ens-lyon.fr> Date: Wed, 25 Feb 1998 19:44:01 +0100 (MET) From: Loic Prylli Subject: Re: Self-build PC164SX-kernel: clock twice too fase In-Reply-To: <199802241042.LAA02008@stefan.sime.com> Hello, I may have solve the problem of clock running twice too fast: The time reported by our PWS500a (aka MIATA) was also running much too fast (more than two hours per day). It seems that the interrupt handler is called at least twice for some ticks (the hardware interrupt state has probably not been reset properly after the first interrupt). Here is the experiment I have done to understand the problem: At first I just try to adjust the microsecond per tick variable (with tickadj from xntp package). I needed a microseond per tick value of ~835 instead of 977 as would imply (HZ= 1024). Suprisingly, under high HD activity the clock was accelerating by more than 10% (enough to prevent any possible synchronisationby NTP). Ethernet activity would make it go slower by about 10% also. I insert some code to measure the interval in processor cycles between two calls to the timer_interrupt routine. An histogram told that about one time out of six, the interval between calls to the timer_interrupt routine was of the order of one microsecond, the rest of the time is was a normal interval of about 1ms. So I just inserted a test at the beginning of the timer_interrupt, if there has not been a significant number of clock cycles since last call, the routine returns immediatly. Here an extract of the patch: --- linux/arch/alpha/kernel/time.c~ Wed Feb 18 11:50:56 1998 +++ linux/arch/alpha/kernel/time.c Wed Feb 18 11:53:05 1998 @@ -68,6 +68,8 @@ now = rpcc(); delta = now - state.last_time; state.last_time = now; + if (delta < state.cycles_per_tick / 16) + return; if (delta > state.max_cycles_per_tick) { int i, missed_ticks; Also on our PWS hwrpb->cycle_freq is set to 0 (this can be seen in /proc/cpuinfo) , I wonder if the line below in time_init() instruction dangerous? (well is seems to work as is x/0 = 0 until now)? Does anybody now how to obtain the cycle_freq on this architecture? state.scaled_ticks_per_cycle = ((unsigned long) HZ << FIX_SHIFT) / hwrpb->cycle_freq; Lastly, I have made a patch to give gettimeofday microsecond resolution, if anybody is interested to test it, I will send it. Regards, Loic PS: this the third time since a week I try to send this message, maybe messages originating from an e-mail adress not subscribed to the list are silently dropped? Hope this time you will get it. -- To unsubscribe: send e-mail to axp-list-request@redhat.com with 'unsubscribe' as the subject. Do not send it to axp-list@redhat.com