linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: tip-bot for John Stultz <john.stultz@linaro.org>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, john.stultz@linaro.org,
	hpa@zytor.com, mingo@kernel.org, richardcochran@gmail.com,
	tglx@linutronix.de
Subject: [tip:timers/urgent] timekeeping: Fix CLOCK_MONOTONIC inconsistency during leapsecond
Date: Mon, 4 Jun 2012 12:52:59 -0700	[thread overview]
Message-ID: <tip-fad0c66c4bb836d57a5f125ecd38bed653ca863a@git.kernel.org> (raw)
In-Reply-To: <1338400497-12420-1-git-send-email-john.stultz@linaro.org>

Commit-ID:  fad0c66c4bb836d57a5f125ecd38bed653ca863a
Gitweb:     http://git.kernel.org/tip/fad0c66c4bb836d57a5f125ecd38bed653ca863a
Author:     John Stultz <john.stultz@linaro.org>
AuthorDate: Wed, 30 May 2012 10:54:57 -0700
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Mon, 4 Jun 2012 21:46:29 +0200

timekeeping: Fix CLOCK_MONOTONIC inconsistency during leapsecond

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>
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>
---
 kernel/time/timekeeping.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index 6e46cac..6f46a00 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -962,6 +962,7 @@ static cycle_t logarithmic_accumulation(cycle_t offset, int shift)
 		timekeeper.xtime.tv_sec++;
 		leap = second_overflow(timekeeper.xtime.tv_sec);
 		timekeeper.xtime.tv_sec += leap;
+		timekeeper.wall_to_monotonic.tv_sec -= leap;
 	}
 
 	/* Accumulate raw time */
@@ -1077,6 +1078,7 @@ static void update_wall_time(void)
 		timekeeper.xtime.tv_sec++;
 		leap = second_overflow(timekeeper.xtime.tv_sec);
 		timekeeper.xtime.tv_sec += leap;
+		timekeeper.wall_to_monotonic.tv_sec -= leap;
 	}
 
 	timekeeping_update(false);

      reply	other threads:[~2012-06-04 19:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-30 17:54 [PATCH] time: Fix CLOCK_MONOTONIC inconsistency during leapsecond John Stultz
2012-06-04 19:52 ` tip-bot for John Stultz [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-fad0c66c4bb836d57a5f125ecd38bed653ca863a@git.kernel.org \
    --to=john.stultz@linaro.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=richardcochran@gmail.com \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).