Skip to content

Commit fad0c66

Browse files
johnstultz-workKAGA-KOKO
authored andcommitted
timekeeping: Fix CLOCK_MONOTONIC inconsistency during leapsecond
Commit 6b43ae8 (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> Cc: stable@kernel.org Link: http://lkml.kernel.org/r/1338400497-12420-1-git-send-email-john.stultz@linaro.org Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
1 parent 9171c67 commit fad0c66

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎kernel/time/timekeeping.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -962,6 +962,7 @@ static cycle_t logarithmic_accumulation(cycle_t offset, int shift)
962962
timekeeper.xtime.tv_sec++;
963963
leap = second_overflow(timekeeper.xtime.tv_sec);
964964
timekeeper.xtime.tv_sec += leap;
965+
timekeeper.wall_to_monotonic.tv_sec -= leap;
965966
}
966967

967968
/* Accumulate raw time */
@@ -1077,6 +1078,7 @@ static void update_wall_time(void)
10771078
timekeeper.xtime.tv_sec++;
10781079
leap = second_overflow(timekeeper.xtime.tv_sec);
10791080
timekeeper.xtime.tv_sec += leap;
1081+
timekeeper.wall_to_monotonic.tv_sec -= leap;
10801082
}
10811083

10821084
timekeeping_update(false);

0 commit comments

Comments
 (0)