[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.64.0812030436590.24668@localhost.localdomain>
Date: Wed, 3 Dec 2008 04:48:16 +0100 (CET)
From: Roman Zippel <zippel@...ux-m68k.org>
To: "Zhang, Yanmin" <yanmin_zhang@...ux.intel.com>
cc: john stultz <johnstul@...ibm.com>,
lkml <linux-kernel@...r.kernel.org>, alex.shi@...el.com,
Thomas Gleixner <tglx@...x.de>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [RFC][PATCH] Catch xtime_nsec underflows and fix them
Hi,
On Wed, 3 Dec 2008, Zhang, Yanmin wrote:
> > This doesn't explain the problem entirely, I considered a negative
> > xtime_nsec before, but xtime_nsec+offset should still be positive
> xtime_nsec underflows after clocksource_adjust. Before clocksource_adjust,
> xtime_nsec is a small positive.
>
> 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.
> > and
> > produce the correct result, at least I can't find anything in
> > getnstimeofday().
> The testing uses vsyscall to get call gettimeofday. vsyscall_gtod_data.wall_time_nsec
> is a u32 while timespec->tv_nsec is a signed long.
Ok, I was missing this part, I looked at the 32bit version of
getnstimeofday() and there xtime.tv_nsec was correctly sign extended.
To be safe for the future wall_time_nsec should also be a s32.
bye, Roman
Powered by blists - more mailing lists