• Andrew Morton's avatar
    [PATCH] improved core support for time-interpolation · 18783bfd
    Andrew Morton authored
    From: David Mosberger <davidm@napali.hpl.hp.com>
    
    Basically, what the patch does is provide two hooks such that platforms
    (and subplatforms) can provide time-interpolation in a way that guarantees
    that two causally related gettimeofday() calls will never see time going
    backwards (unless there is a settimeofday() call, of course).
    
    There is some evidence that the current scheme does work: we use it on ia64
    both for cycle-counter-based interpolation and the SGI folks use it with a
    chipset-based high-performance counter.
    
    
    It seems like enough platforms do this sort of thing to provide _some_
    support in the core, especially because it's rather tricky to guarantee
    that time never goes backwards (short of a settimeofday, of course).
    
    This patch is based on something Jes Sorensen wrote for the SGI Itanium 2
    platform (which has a chipset-internal high-res clock).  I adapted it so it
    can be used for cycle-counter interpolation also.  The net effect is that
    "last_time_offset" can be removed completely from the kernel.
    
    The basic idea behind the patch is simply: every time you advance xtime by
    N nanoseconds, you call update_wall_time_hook(NSEC).  Every time the time
    gets set (i.e., discontinuity is OK), reset_wall_time_hook() is called.
    18783bfd
timer.c 33 KB