]> git.neil.brown.name Git - history.git/commit
[PATCH] ppc64: xtime <-> gettimeofday can get out of sync
authorAnton Blanchard <anton@samba.org>
Tue, 11 Jan 2005 09:43:41 +0000 (01:43 -0800)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Tue, 11 Jan 2005 09:43:41 +0000 (01:43 -0800)
commit984892281e014de2f17ca0dd047728dd7634a885
treeec2afbc57f7961076931d9f74ff361ed4f9247ab
parent9aaf64a0f7cfd94cac1d0be99d2943e1302c0608
[PATCH] ppc64: xtime <-> gettimeofday can get out of sync

I've noticed a problem where xtime and gettimeofday could get out of sync if
interrupts are disabled for too long (eg long kernel code paths or dropping
into the debugger for a while).

We correctly replay lost jiffies but in that loop time_sync_xtime syncs the
intermediate values of xtime up with the current value of gettimeofday.  So
xtime jumps by a bunch and from then on it is ahead of gettimeofday and we
never resync the two.  I guess this is to avoid xtime going backwards.

The patch below creates a __do_gettimeofday where you can pass in a tb value
and sync the intermediate values of xtime properly.

Note that the time_sync_xtime check only stops the seconds from going
backwards, the ns component still could couldnt it?  Considering this is hard
to get right, should we switch to the time interpolator stuff?  The only
problem there is it might be trouble for systemcfg (which exports stuff to do
userspace gettimeofday).

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
arch/ppc64/kernel/time.c