lkml.org 
[lkml]   [2009]   [Aug]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[patch 03/15] reset of cycle_last for tsc clocksource
    From: Martin Schwidefsky <schwidefsky@de.ibm.com>

    change_clocksource resets the cycle_last value to zero then sets
    it to a value read from the clocksource. The reset to zero is
    required only for the TSC clocksource to make the read_tsc function
    work. This is subtle and surprising. Move the reset to a resume
    function in the tsc code.

    Cc: Ingo Molnar <mingo@elte.hu>
    Cc: Daniel Walker <dwalker@fifo99.com>
    Cc: John Stultz <johnstul@us.ibm.com>
    Acked-by: Thomas Gleixner <tglx@linutronix.de>
    Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
    ---
    arch/x86/kernel/tsc.c | 6 ++++++
    kernel/time/timekeeping.c | 1 -
    2 files changed, 6 insertions(+), 1 deletion(-)

    Index: linux-2.6/arch/x86/kernel/tsc.c
    ===================================================================
    --- linux-2.6.orig/arch/x86/kernel/tsc.c
    +++ linux-2.6/arch/x86/kernel/tsc.c
    @@ -744,10 +744,16 @@ static cycle_t __vsyscall_fn vread_tsc(v
    }
    #endif

    +static void resume_tsc(void)
    +{
    + clocksource_tsc.cycle_last = 0;
    +}
    +
    static struct clocksource clocksource_tsc = {
    .name = "tsc",
    .rating = 300,
    .read = read_tsc,
    + .resume = resume_tsc,
    .mask = CLOCKSOURCE_MASK(64),
    .shift = 22,
    .flags = CLOCK_SOURCE_IS_CONTINUOUS |
    Index: linux-2.6/kernel/time/timekeeping.c
    ===================================================================
    --- linux-2.6.orig/kernel/time/timekeeping.c
    +++ linux-2.6/kernel/time/timekeeping.c
    @@ -295,7 +295,6 @@ static void change_clocksource(void)
    if (old->disable)
    old->disable(old);

    - clock->cycle_last = 0;
    clock->cycle_last = clock->read(clock);
    clock->error = 0;
    clock->xtime_nsec = 0;
    --
    blue skies,
    Martin.

    "Reality continues to ruin my life." - Calvin.



    \
     
     \ /
      Last update: 2009-08-14 15:57    [W:0.020 / U:1.460 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site