]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
timekeeping: Fix CLOCK_MONOTONIC inconsistency during leapsecond
authorJohn Stultz <john.stultz@linaro.org>
Tue, 17 Jul 2012 17:33:50 +0000 (13:33 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 19 Jul 2012 15:58:27 +0000 (08:58 -0700)
This is a backport of fad0c66c4bb836d57a5f125ecd38bed653ca863a
which resolves a bug the previous commit.

Commit 6b43ae8a61 (ntp: Fix leap-second hrtimer livelock) broke the
leapsecond update of CLOCK_MONOTONIC. The missing leapsecond update to
wall_to_monotonic causes discontinuities in CLOCK_MONOTONIC.

Adjust wall_to_monotonic when NTP inserted a leapsecond.

Reported-by: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Tested-by: Richard Cochran <richardcochran@gmail.com>
Link: http://lkml.kernel.org/r/1338400497-12420-1-git-send-email-john.stultz@linaro.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: John Stultz <johnstul@us.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/time/timekeeping.c

index c444da085a22fa509b0a41a67f960aff8b3823db..ac5b225f6a056275af2cd60993d4fc5c2322b8f3 100644 (file)
@@ -824,6 +824,7 @@ static cycle_t logarithmic_accumulation(cycle_t offset, int shift)
                xtime.tv_sec++;
                leap = second_overflow(xtime.tv_sec);
                xtime.tv_sec += leap;
+               wall_to_monotonic.tv_sec -= leap;
        }
 
        /* Accumulate raw time */
@@ -934,7 +935,7 @@ static void update_wall_time(void)
                xtime.tv_sec++;
                leap = second_overflow(xtime.tv_sec);
                xtime.tv_sec += leap;
-
+               wall_to_monotonic.tv_sec -= leap;
        }
 
        /* check to see if there is a new clocksource to use */