Re: do_posix_clock_monotonic_gettime() returns negative nsec

From: Andrew Morton
Date: Fri Dec 03 2004 - 03:58:26 EST


George Anzinger <george@xxxxxxxxxx> wrote:
>
> > George: You have any comment?
>
> Two, in fact. First, the result here is the sum of wall_to_monotonic and
> getnstimeofday(). If nsec < 0, one or more of these must be also. Both of
> these values are SUPPOSED to be normalized.

As Herbert points out, hpet_time_init() and time_init() and who knows what
else do:

wall_to_monotonic.tv_sec = -xtime.tv_sec;
xtime.tv_nsec = (INITIAL_JIFFIES % HZ) * (NSEC_PER_SEC / HZ);
wall_to_monotonic.tv_nsec = -xtime.tv_nsec;

And this:

* The current time
* wall_to_monotonic is what we need to add to xtime (or xtime corrected
* for sub jiffie times) to get to monotonic time. Monotonic is pegged at zero
* at zero at system boot time, so wall_to_monotonic will be negative,
* however, we will ALWAYS keep the tv_nsec part positive so we can use
* the usual normalization.

So I assume the bug is that time_init() is failing to normalise
wall_to_monotonic?
-
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/