From: Pasi Savolainen <psavo@iki.fi>
To: linux-kernel@vger.kernel.org
Subject: 2.6.0-test11 brings out gettimeofday() non-monotonicity
Date: Thu, 4 Dec 2003 20:54:08 +0000 (UTC) [thread overview]
Message-ID: <slrnbsv7ng.45b.psavo@varg.dyndns.org> (raw)
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>
next reply other threads:[~2003-12-04 20:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-12-04 20:54 Pasi Savolainen [this message]
2003-12-04 23:06 ` john stultz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=slrnbsv7ng.45b.psavo@varg.dyndns.org \
--to=psavo@iki.fi \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®