lkml.org 
[lkml]   [2008]   [Dec]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC][PATCH] Catch xtime_nsec underflows and fix them
Hi,

On Wed, 3 Dec 2008, Zhang, Yanmin wrote:

> > > When xtime_nsec underflows at the first time, xtime.tv_nsec becomes -1.
> > > Later on when the second tick arrives, below statement in the while loop
> > > clock->xtime_nsec += clock->xtime_interval;
> > > will cause clock->xtime_nsec becomes positive again. So the second tick
> > > appears a going-backward time.
> >
> > Yes, but only by 1nsec, so normally it wouldn't be noticable.
> Not 1nsec. At the second tick, go back about 4294967296 nsec (2^32), about
> 4 seconds. That matches the output of testing process.

Above code is not the problem. The error appeared in do_vgettimeofday() as
it only uses unsigned values, so the -1 became 0xffffffff in nsec and the
clock jumped forward 4 seconds and a tick later 4 seconds back.
bye, Roman
\
 
 \ /
  Last update: 2008-12-03 17:13    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site