[PATCH -mm] gtod persistent clock resume fix

From: Thomas Gleixner
Date: Thu Feb 01 2007 - 08:03:18 EST


The reworked highres/dyntick code made a thinko in the resume code
visible, which was magically working in the old queue.

On resume we add the slept time to xtime. This delta must be adjusted in
wall_to_monotonic as well. The update of jiffies64 is bogus and a
leftover of the code which was taken from arch/i386/kernel/time.c.

On suspend the current state of xtime, wall_to_monotonic and jiffies is
frozen. After resume we need to add the slept time to xtime, but we need
to subtract it from wall_to_monotonic, so the monotonic time is resuming
from exactly the point where it was suspended. jiffies are restarting
from the same point as well.

This solves the resume waittime observed by Karsten Wiese.

Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>

Index: linux-2.6.20-rc6-mm/kernel/timer.c
===================================================================
--- linux-2.6.20-rc6-mm.orig/kernel/timer.c
+++ linux-2.6.20-rc6-mm/kernel/timer.c
@@ -985,8 +985,9 @@ static int timekeeping_resume(struct sys

if (now && (now > timekeeping_suspend_time)) {
unsigned long sleep_length = now - timekeeping_suspend_time;
+
xtime.tv_sec += sleep_length;
- jiffies_64 += (u64)sleep_length * HZ;
+ wall_to_monotonic.tv_sec -= sleep_length;
}
/* re-base the last cycle value */
clock->cycle_last = clocksource_read(clock);
@@ -994,7 +995,7 @@ static int timekeeping_resume(struct sys
timekeeping_suspended = 0;
write_sequnlock_irqrestore(&xtime_lock, flags);

- clockevents_notify(CLOCK_EVT_NOTIFY_RESUME, NULL);
+ touch_softlockup_watchdog();
/* Resume hrtimers */
clock_was_set();



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