lkml.org 
[lkml]   [2005]   [Jan]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH] Fix a bug in timer_suspend() on x86_64
    Date
    Hi,

    This patch is intended to fix a bug in timer_suspend() on x86_64 that causes
    hard lockups on suspend with swsusp and provide some optimizations. It is
    based on the Nigel Cunningham's patches to to reduce delay in
    arch/kernel/time.c. The patch is against 2.6.10-mm3 and 2.6.11-rc1. Please
    consider for applying.

    Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>

    --- linux-2.6.10-mm3-orig/arch/x86_64/kernel/time.c 2005-01-13
    01:46:10.000000000 +0100
    +++ linux-2.6.10-mm3/arch/x86_64/kernel/time.c 2005-01-13 01:32:05.000000000
    +0100
    @@ -955,16 +955,19 @@

    __setup("report_lost_ticks", time_setup);

    -static long clock_cmos_diff, sleep_start;
    +static long clock_cmos_diff;
    +static unsigned long sleep_start;

    static int timer_suspend(struct sys_device *dev, u32 state)
    {
    /*
    * Estimate time zone so that set_time can update the clock
    */
    - clock_cmos_diff = -get_cmos_time();
    + long cmos_time = get_cmos_time();
    +
    + clock_cmos_diff = -cmos_time;
    clock_cmos_diff += get_seconds();
    - sleep_start = jiffies;
    + sleep_start = cmos_time;
    return 0;
    }

    @@ -973,7 +976,7 @@
    unsigned long flags;
    unsigned long sec;
    unsigned long ctime = get_cmos_time();
    - unsigned long sleep_length = ctime - sleep_start;
    + unsigned long sleep_length = (ctime - sleep_start) * HZ;

    if (vxtime.hpet_address)
    hpet_reenable();
    @@ -983,7 +986,8 @@
    xtime.tv_sec = sec;
    xtime.tv_nsec = 0;
    write_sequnlock_irqrestore(&xtime_lock,flags);
    - jiffies += sleep_length * HZ;
    + jiffies += sleep_length;
    + wall_jiffies += sleep_length;
    return 0;
    }

    --
    - Would you tell me, please, which way I ought to go from here?
    - That depends a good deal on where you want to get to.
    -- Lewis Carroll "Alice's Adventures in Wonderland"
    -
    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/

    \
     
     \ /
      Last update: 2005-03-22 14:09    [W:0.023 / U:30.288 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site