public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiri Bohac <jbohac@suse.cz>
To: Prarit Bhargava <prarit@redhat.com>
Cc: Jiri Bohac <jbohac@suse.cz>,
	linux-kernel@vger.kernel.org,
	John Stultz <john.stultz@linaro.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Miroslav Lichvar <mlichvar@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>
Subject: Re: [PATCH] time, ntp: Do not update time_state in middle of leap second [v3]
Date: Fri, 20 Feb 2015 18:19:15 +0100	[thread overview]
Message-ID: <20150220171915.GA32136@midget.suse.cz> (raw)
In-Reply-To: <54E7417B.1090900@redhat.com>

On Fri, Feb 20, 2015 at 09:15:23AM -0500, Prarit Bhargava wrote:
> On 02/19/2015 12:00 PM, Jiri Bohac wrote:
> > Prarit, can you explain who sets the STA_PLL flag, so that
> > process_adj_status() detects a STA_PLL->!STA_PLL transition and
> > goes to the branch that sets time_state = TIME_OK?
> 
> Jiri,
> 
> The test being run is:
> 
> https://github.com/johnstultz-work/timetests/blob/master/leap-a-day.c
> 
> prior to commit
> 
> https://github.com/johnstultz-work/timetests/commit/be4526e8b5d48cd108a8d2cf7f5c8fd763acf421


I can't make sense of the output of your test:

On Thu, Feb 12, 2015 at 08:58:19AM -0500, Prarit Bhargava wrote:
> [  942.952833] time_state [1] change from TIME_OK to TIME_INS
> 
> Fri Feb 13 18:59:51 2015 + 318126 us    TIME_INS
> Fri Feb 13 18:59:51 2015 + 818167 us    TIME_INS
> Fri Feb 13 18:59:52 2015 + 318208 us    TIME_INS
> Fri Feb 13 18:59:52 2015 + 818248 us    TIME_INS
> Fri Feb 13 18:59:53 2015 + 318290 us    TIME_INS
> Fri Feb 13 18:59:53 2015 + 818331 us    TIME_INS
> Fri Feb 13 18:59:54 2015 + 318372 us    TIME_INS
> Fri Feb 13 18:59:54 2015 + 818413 us    TIME_INS
> Fri Feb 13 18:59:55 2015 + 318454 us    TIME_INS
> Fri Feb 13 18:59:55 2015 + 818495 us    TIME_INS
> Fri Feb 13 18:59:56 2015 + 318534 us    TIME_INS
> Fri Feb 13 18:59:56 2015 + 818575 us    TIME_INS

Why did the test program print the above lines? It's supposed to
sleep until 3 seconds prior to the midnight:

	/* Wake up 3 seconds before leap */
	ts.tv_sec = next_leap - 3;
	ts.tv_nsec = 0;
	while(clock_nanosleep(CLOCK_REALTIME, TIMER_ABSTIME, &ts, NULL))
		printf("Something woke us up, returning to sleep\n");


> Fri Feb 13 18:59:57 2015 + 318617 us    TIME_INS
> Fri Feb 13 18:59:57 2015 + 818660 us    TIME_INS
> Fri Feb 13 18:59:58 2015 + 318702 us    TIME_INS
> Fri Feb 13 18:59:58 2015 + 818744 us    TIME_INS
> Fri Feb 13 18:59:59 2015 + 318785 us    TIME_INS
> Fri Feb 13 18:59:59 2015 + 818837 us    TIME_INS
> 
> [  952.953143] time_state [4] change from TIME_INS to TIME_OOP
> [  952.953150] Clock: inserting leap second 23:59:60 UTC
> [  953.299905] process_adj_status: insert_leap_sec[1223] setting time_state back
> to TIME_OK [1, 1]   <<< adjtimex() call every 1/2 second
> [  953.299913] time_state [9] change from TIME_OOP to TIME_OK

2) The only place where the test program sets STA_PLL is in 
clear_time_state(); It clears it right after that.

clear_time_state() is not called inside the while "(now < next_leap+2)" loop,
except in the SIGINT/SIGKILL handler. Did you send signals to the program
at this point?

If not, I can't understand how the status went from STA_PLL to !STA_PLL
and thus why time_state went to TIME_OK

-- 
Jiri Bohac <jbohac@suse.cz>
SUSE Labs, SUSE CZ


      reply	other threads:[~2015-02-20 17:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-12 13:58 [PATCH] time, ntp: Do not update time_state in middle of leap second [v3] Prarit Bhargava
2015-02-17 23:16 ` John Stultz
2015-02-18 17:14   ` Jiri Bohac
2015-02-18 17:38     ` Jiri Bohac
2015-02-20 14:12   ` Prarit Bhargava
2015-02-19 17:00 ` Jiri Bohac
2015-02-20 14:15   ` Prarit Bhargava
2015-02-20 17:19     ` Jiri Bohac [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=20150220171915.GA32136@midget.suse.cz \
    --to=jbohac@suse.cz \
    --cc=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mlichvar@redhat.com \
    --cc=peterz@infradead.org \
    --cc=prarit@redhat.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