Skip to content

Commit 09e66e8

Browse files
johnstultz-workbwhacks
authored andcommitted
timekeeping: Fix CLOCK_MONOTONIC inconsistency during leapsecond
This is a backport of fad0c66 which resolves a bug the previous commit. 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> 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> Cc: Linux Kernel <linux-kernel@vger.kernel.org> Signed-off-by: John Stultz <johnstul@us.ibm.com> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
1 parent 7611766 commit 09e66e8

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎kernel/time/timekeeping.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -938,6 +938,7 @@ static cycle_t logarithmic_accumulation(cycle_t offset, int shift)
938938
xtime.tv_sec++;
939939
leap = second_overflow(xtime.tv_sec);
940940
xtime.tv_sec += leap;
941+
wall_to_monotonic.tv_sec -= leap;
941942
}
942943

943944
/* Accumulate raw time */
@@ -1048,7 +1049,7 @@ static void update_wall_time(void)
10481049
xtime.tv_sec++;
10491050
leap = second_overflow(xtime.tv_sec);
10501051
xtime.tv_sec += leap;
1051-
1052+
wall_to_monotonic.tv_sec -= leap;
10521053
}
10531054

10541055
/* check to see if there is a new clocksource to use */

0 commit comments

Comments
 (0)