diff options
author | John Stultz <john.stultz@linaro.org> | 2012-07-17 13:33:50 -0400 |
---|---|---|
committer | Luis Henriques <luis.henriques@canonical.com> | 2012-07-23 05:50:33 -0400 |
commit | 2c8c6d0ec2b34d7d34107f76308993829be74228 (patch) | |
tree | b17ea872a952da9175c7dd84b9d6d80fe178db97 | |
parent | 16ad6d6597bb8d4c19c296266767ae2593ce9e6b (diff) |
timekeeping: Fix CLOCK_MONOTONIC inconsistency during leapsecond
BugLink: http://bugs.launchpad.net/bugs/1026850
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>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
-rw-r--r-- | kernel/time/timekeeping.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index c444da085a2..ac5b225f6a0 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c | |||
@@ -824,6 +824,7 @@ static cycle_t logarithmic_accumulation(cycle_t offset, int shift) | |||
824 | xtime.tv_sec++; | 824 | xtime.tv_sec++; |
825 | leap = second_overflow(xtime.tv_sec); | 825 | leap = second_overflow(xtime.tv_sec); |
826 | xtime.tv_sec += leap; | 826 | xtime.tv_sec += leap; |
827 | wall_to_monotonic.tv_sec -= leap; | ||
827 | } | 828 | } |
828 | 829 | ||
829 | /* Accumulate raw time */ | 830 | /* Accumulate raw time */ |
@@ -934,7 +935,7 @@ static void update_wall_time(void) | |||
934 | xtime.tv_sec++; | 935 | xtime.tv_sec++; |
935 | leap = second_overflow(xtime.tv_sec); | 936 | leap = second_overflow(xtime.tv_sec); |
936 | xtime.tv_sec += leap; | 937 | xtime.tv_sec += leap; |
937 | 938 | wall_to_monotonic.tv_sec -= leap; | |
938 | } | 939 | } |
939 | 940 | ||
940 | /* check to see if there is a new clocksource to use */ | 941 | /* check to see if there is a new clocksource to use */ |