linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* 2.6.0-test11 brings out gettimeofday() non-monotonicity
@ 2003-12-04 20:54 Pasi Savolainen
  2003-12-04 23:06 ` john stultz
  0 siblings, 1 reply; 2+ messages in thread
From: Pasi Savolainen @ 2003-12-04 20:54 UTC (permalink / raw)
  To: linux-kernel

Hi,
I (and several others) have had some problems on dual AMD platform with
time going backwards.
The 2.6.0-test11 -kernel seems to bring it forth very well. I can
trigger this behaviour _almost_ every time, simply by running 'updatedb'.

Result is that 'gettimeofday()' starts jumping backwards.
I used a program (from earlier gettimeofday() monotonicity discusion),
attached below.
- -
$ ./gtod-test | gawk '{ print $5; }' > avtime 
# about 30sec here, then ^C
$ sort avtime | uniq -c
     67 
      1 -
      4 -1:999988
     10 -1:999989
      3 -1:999990
      1 -1:999993
      8 -1:999996
     12 -1:999997
      4 -1:999998
  19611 -3:222832
      1 -3:222833
- -

On the other hand I recently heard from a developer that monotonic_clock
gave in some cases values of about 0xffffffff00000756, which to me looks
like a botched 64bit math. This was happening on UP, AMD board.

I've looked at the i386/kernel/time.co/do_gettimeofday(), but don't find
any fault with it.

- gettimeofday.c -
#include <stdio.h>
#include <sys/types.h>
#include <sys/time.h>

int main( void )
{
        int                     i = 0;

        while( 1 )
        {
                struct timeval          start;
                struct timeval          stop;
                struct timeval          diff;
                int                     rc1;
                int                     rc2;

                if( i++ % 1000000 == 0 )
                        printf( "% 12d: Iterations so far\n", i );

                rc1 = gettimeofday( &start, 0 );
                rc2 = gettimeofday( &stop, 0 );
                timersub( &stop, &start, &diff );

                if( rc1 < 0 || rc2 < 0 )
                        printf( " %12d: rc1=%d rc2=%d.   Failure!\n",
                                i,
                                rc1,
                                rc2
                        );

                if( diff.tv_sec >= 0 && diff.tv_usec >= 0 )
                        continue;

                printf( "% 12d: Time went backwards: %d:%06d\n",
                        i,
                        diff.tv_sec,
                        diff.tv_usec
                );

        }
}
- -

-- 
   Psi -- <http://www.iki.fi/pasi.savolainen>


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: 2.6.0-test11 brings out gettimeofday() non-monotonicity
  2003-12-04 20:54 2.6.0-test11 brings out gettimeofday() non-monotonicity Pasi Savolainen
@ 2003-12-04 23:06 ` john stultz
  0 siblings, 0 replies; 2+ messages in thread
From: john stultz @ 2003-12-04 23:06 UTC (permalink / raw)
  To: Pasi Savolainen; +Cc: lkml

On Thu, 2003-12-04 at 12:54, Pasi Savolainen wrote:
> I (and several others) have had some problems on dual AMD platform with
> time going backwards.

Hmmm. Just to double check, you're not running w/ the amd76x_pm module,
correct? That module has known issues regarding time. 

> The 2.6.0-test11 -kernel seems to bring it forth very well. I can
> trigger this behaviour _almost_ every time, simply by running 'updatedb'.

Can you send any more info about the hardware? dmesg and .config as
well, please. 


> On the other hand I recently heard from a developer that monotonic_clock
> gave in some cases values of about 0xffffffff00000756, which to me looks
> like a botched 64bit math. This was happening on UP, AMD board.

I'd very much like to hear more details about this one. What was the
test case, etc?

thanks
-john


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-12-04 23:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-04 20:54 2.6.0-test11 brings out gettimeofday() non-monotonicity Pasi Savolainen
2003-12-04 23:06 ` john stultz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).