public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* gettimeofday question
@ 2001-03-03 12:49 Russell King
  2001-03-03 16:24 ` Russell King
  2001-03-19  7:33 ` Russell King
  0 siblings, 2 replies; 15+ messages in thread
From: Russell King @ 2001-03-03 12:49 UTC (permalink / raw)
  To: linux-kernel

Hi,

I've noticed that one of my machines here suffers from the "time going
backwards problem" and so started thinking about the x86 solution.

I've come to the conclusion that it has a hole which could cause it
to return the wrong time in one specific case:

- in do_gettimeofday(), we disable irqs (read_lock_irqsave)
- the ISA timer wraps, but we've got interrupts disabled, so no update
  of xtime or jiffies occurs
- in do_slow_gettimeoffset(), we read the timer, which has wrapped
- since jiffies_p != jiffies, we do not apply any correction
- our idea of time is now one jiffy slow.

Further more, while do_gettimeofday() is still within the
read_lock_irqsave, we spin_unlock(&i8253_lock) in do_slow_gettimeoffset()
and _re-enable_ interrupts!  This means when we later read xtime, we're
doing it with interrupts enabled.

This applies to both 2.2.18 and 2.4.2.

--
Russell King (rmk@arm.linux.org.uk)                The developer of ARM Linux
             http://www.arm.linux.org.uk/personal/aboutme.html


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2001-03-21 23:31 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-03-03 12:49 gettimeofday question Russell King
2001-03-03 16:24 ` Russell King
2001-03-19  7:33 ` Russell King
2001-03-19 11:39   ` Jamie Lokier
2001-03-19 18:26     ` Eli Carter
2001-03-19 19:06       ` Russell King
2001-03-19 19:49         ` Eli Carter
2001-03-19 21:34           ` Russell King
2001-03-19 22:54             ` Eli Carter
2001-03-19 23:44               ` Russell King
2001-03-20 15:27                 ` Eli Carter
2001-03-21 22:14             ` Eli Carter
2001-03-21 22:27               ` Eli Carter
2001-03-21 23:10                 ` Eli Carter
2001-03-21 23:27               ` Question on binutils release to use Anthony Barbachan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox