2003-03-25 20:26:00

by john stultz

[permalink] [raw]
Subject: [RFC] linux-2.5.66_lost-ticks-fix_A0

All,
I found a broken corner case with my earlier lost-ticks patch, so I'm
planning on submitting this fix to solve the issue.

The problem arises because we're doing two reads from the time source in
the timer_interrupt:
detect_lost_tick();
timer->mark_offset();

The problem with this being that even though we're in the interrupt
handler and properly locking our variables. The time sources keep on
ticking, so the two references to the time source are obviously not
atomic.

For example

time function
-------------------------
@1990 detect_lost_tick()
- calculate # of lost ticks (none, we're < 2000)
@2003 timer->mark_offset()
- overwrite last_tsc_low/last_cyclone_timer
- write 3 into delay_at_last_interrupt


Thus jiffies is only incremented once, but delay_at_last_interrupt is
too small so we get a time inconsistency.

This patch resolves the issue by doing the lost-tick compensation inside
timer->mark_offset(), thus there is only one read of the time-source per
interrupt.

Comments, flames and suggestions welcome.

thanks
-john


Attachments:
linux-2.5.66_lost-tick-fix_A0.patch (3.46 kB)
signature.asc (232.00 B)
This is a digitally signed message part
Download all attachments