mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: John Stultz <johnstul@us.ibm.com>
To: Richard Cochran <richardcochran@gmail.com>
Cc: linux-kernel@vger.kernel.org, Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH RFC V2 3/6] time: keep track of the pending utc/tai threshold
Date: Tue, 29 May 2012 18:49:30 -0700	[thread overview]
Message-ID: <4FC57CAA.3030809@us.ibm.com> (raw)
In-Reply-To: <4FC57BF9.5010608@linaro.org>

On 05/29/2012 06:46 PM, John Stultz wrote:
> On 05/23/2012 11:57 PM, Richard Cochran wrote:
>> On Thu, May 24, 2012 at 08:43:40AM +0200, Richard Cochran wrote:
>>> BTW you can use the program I have been using to test this at
>>>
>>>     git://github.com/richardcochran/leap.git
>> That program exposes another leap second bug, too, I think. It reads
>> the time via adjtimex in a tight loop, optionally sleeping using
>>
>>     clock_nanosleep(CLOCK_MONOTONIC, 0,&ts, NULL);
>>
>> The program does not wake from this call during a leap second. It is
>> my expectation that CLOCK_MONOTONIC should always work. Why doesn't
>> it?
>
> Sorry for being slow here, just got a chance to look at this.
>
> Does the following patch solve this issue for you?

Sorry, attached the wrong patch (that one doesn't build!).

Try this one.

thanks
-john


Make sure we update wall_to_monotonic when adding a leapsecond.
This could otherwise cause discontinuities in CLOCK_MONOTONIC.

Reported-by: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>

diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index 6e46cac..81c76a9 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 */


  reply	other threads:[~2012-05-30  1:50 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-18 14:09 [PATCH RFC V2 0/6] Fix leap seconds and add tai clock Richard Cochran
2012-05-18 14:09 ` [PATCH RFC V2 1/6] time: remove obsolete declaration Richard Cochran
2012-05-21 23:57   ` John Stultz
2012-05-18 14:09 ` [PATCH RFC V2 2/6] ntp: remove useless parameter Richard Cochran
2012-05-21 23:58   ` John Stultz
2012-05-18 14:09 ` [PATCH RFC V2 3/6] time: keep track of the pending utc/tai threshold Richard Cochran
2012-05-21 18:09   ` John Stultz
2012-05-21 19:08     ` Richard Cochran
2012-05-22 17:39       ` Richard Cochran
2012-05-22 18:06         ` John Stultz
2012-05-23  8:29           ` Richard Cochran
2012-05-23 16:50             ` John Stultz
2012-05-23 19:17               ` Richard Cochran
2012-05-23 20:18                 ` John Stultz
2012-05-24  6:43                   ` Richard Cochran
2012-05-24  6:57                     ` Richard Cochran
2012-05-26 15:07                       ` Richard Cochran
2012-05-30  1:46                       ` John Stultz
2012-05-30  1:49                         ` John Stultz [this message]
2012-05-30  5:11                           ` Richard Cochran
2012-05-30  5:56                             ` John Stultz
2012-05-30  6:19                               ` Richard Cochran
2012-05-30  6:23                                 ` John Stultz
2012-05-30  7:27                                   ` Richard Cochran
2012-05-23 19:42               ` Richard Cochran
2012-05-21 18:21   ` John Stultz
2012-05-21 19:13     ` Richard Cochran
2012-05-18 14:09 ` [PATCH RFC V2 4/6] time: introduce leap second functional interface Richard Cochran
2012-05-21 18:01   ` John Stultz
2012-05-21 19:18     ` Richard Cochran
2012-05-21 20:24       ` John Stultz
2012-05-22  4:25         ` Richard Cochran
2012-05-22 15:10           ` John Stultz
2012-05-18 14:09 ` [PATCH RFC V2 5/6] time: move leap second management into time keeping core Richard Cochran
2012-05-21 18:18   ` John Stultz
2012-05-21 19:24     ` Richard Cochran
2012-05-18 14:09 ` [PATCH RFC V2 6/6] time: Add CLOCK_TAI clockid Richard Cochran

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=4FC57CAA.3030809@us.ibm.com \
    --to=johnstul@us.ibm.com \
    --cc=linux-kernel@vger.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

Powered by JetHome