Re: gettimeofday nanoseconds patch (makes it possible for theposix-timer functions to return higher accuracy)

From: Christoph Lameter
Date: Thu Jul 15 2004 - 10:33:45 EST


On Wed, 14 Jul 2004, David Mosberger wrote:

> >>>>> On Wed, 14 Jul 2004 17:48:06 -0700, john stultz <johnstul@xxxxxxxxxx> said:
>
> John> Although you still have the issue w/ NTP adjustments being
> John> ignored, but last time I looked at the time_interpolator code,
> John> it seemed it was being ignored there too, so at least your not
> John> doing worse then the ia64 do_gettimeofday(). [If I'm doing the
> John> time_interpolator code a great injustice with the above,
> John> someone please correct me]
>
> The existing time-interpolator code for ia64 never lets time go
> backwards (in the absence of a settimeofday(), of course). There is
> no need to special-case NTP.
>
> With Christoph's changes, NTP is an issue again, however.

The new code gains scalability and speed by avoiding the cmpxchg in the
old code. No check is done anymore that the resulting offset is really
later than the last time returned. In order to insure monotonic time the
underlying clock used must also be monotonic. The new code cannot handle
fluctuating time sources like unsynchronized ITCs. If the time source is
fluctuating then a function may be defined to be the source of time. This
function may do a compare to the last value returned in order to insure
that the clock stays monotonic and does not go backward. Doing so may slow
things down to the way they were before.

The old code only insured that the interpolated offset in nanoseconds
after a timer tick never goes backward. Negative corrections to xtime
could also result in time going backward since the offset is
always added to xtime. Both the old and the new code use the logic in
time_interpolator_update (invoked when xtime is advanced) to compensate
for this situation.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/