tech-kern archive

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

Re: [RFC][ARM32] Time running bug in the NetBSD time network



I agree with you. There was kind of dirty hack.
My deepper investigation shows the current micro-time framework depend
to a condition when the delta (the difference between two neighbour
values has been read in interrupt handler) would be much less than the
timer values range (0 .. timer_max). Otherwise we've got poor
precision for this timer.

Below the new generation of the patch. Now it touches only MD code and
provides smooth time adjustment.

On Tue, May 13, 2008 at 5:31 PM, Joerg Sonnenberger
<joerg%britannica.bec.de@localhost> wrote:
>  > There is a patch to fix the issue (in other words it's workaround and
>  > may be not applicable to
>  > mainstream due to some reasons).

>  This is the wrong patch. Look for the actual time counter and fix the
>  frequency it is using. Many of this have been only lightly tested and it
>  is quite likely that one or two slipped through with the wrong
>  adjustment. If you have a frequency larger than 4GHz, you should just
>  use prescaling.

Index: sys/arch/arm/omap/omap2430_mputmr.c
===================================================================
RCS file: /cvsroot/src/sys/arch/arm/omap/omap2430_mputmr.c,v
retrieving revision 1.2
diff -u -r1.2 omap2430_mputmr.c
--- sys/arch/arm/omap/omap2430_mputmr.c 27 Apr 2008 18:58:45 -0000      1.2
+++ sys/arch/arm/omap/omap2430_mputmr.c 14 May 2008 07:00:27 -0000
@@ -237,7 +237,7 @@

        setclockrate(clock_sc, hz);
        setclockrate(stat_sc, stathz);
-       setclockrate(ref_sc, hz);
+       setclockrate(ref_sc, 0);


        /*
@@ -301,6 +301,16 @@
        uint32_t count_freq;
        static const uint32_t us_per_sec = 1000000;
        
+       if (ints_per_sec == 0) {
+               /*
+                * When ints_per_sec equal to zero there is mean full range
+                * timer usage. Nevertheless autoreload mode is still enabled.
+                */
+               tf->ptv = 0;
+               tf->reload = 0;
+               tf->counts_per_usec = OMAP_MPU_TIMER_CLOCK_FREQ / us_per_sec;
+               return;
+       }

        tf->ptv = 8;
        for (;;) {


-- 
With Best Regards,
Andy Shevchenko


Home | Main Index | Thread Index | Old Index