From: John Stultz Date: Tue, 17 Jul 2012 17:33:50 +0000 (-0400) Subject: timekeeping: Fix CLOCK_MONOTONIC inconsistency during leapsecond X-Git-Tag: v2.6.39-400.9.0~324 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=ce4e4c9464835b2476fac86b5d0beb34016d0bf2;p=users%2Fjedix%2Flinux-maple.git timekeeping: Fix CLOCK_MONOTONIC inconsistency during leapsecond 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 Signed-off-by: John Stultz Tested-by: Richard Cochran Link: http://lkml.kernel.org/r/1338400497-12420-1-git-send-email-john.stultz@linaro.org Signed-off-by: Thomas Gleixner Cc: Prarit Bhargava Cc: Thomas Gleixner Signed-off-by: John Stultz Signed-off-by: Greg Kroah-Hartman (cherry picked from commit c33f2424c3941986d402c81d380d4e805870a20f) Conflicts: kernel/time/timekeeping.c Signed-off-by: Joe Jin --- diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index bd056f01ccf9..4e6cd20a1683 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -833,6 +833,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 */ @@ -943,6 +944,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 */