[RFC] linux-2.5.66_lost-ticks-fix_A0

From: john stultz (johnstul@us.ibm.com)
Date: Tue Mar 25 2003 - 15:30:59 EST


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





-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Mar 31 2003 - 22:00:21 EST