public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Prarit Bhargava <prarit@redhat.com>
To: Jiri Bohac <jbohac@suse.cz>
Cc: 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 09:15:23 -0500	[thread overview]
Message-ID: <54E7417B.1090900@redhat.com> (raw)
In-Reply-To: <20150219170048.GB25948@midget.suse.cz>



On 02/19/2015 12:00 PM, Jiri Bohac wrote:
> Hi,
> 
> I'm trying to understand what exactly is going on here...
> 
> On Thu, Feb 12, 2015 at 08:58:19AM -0500, Prarit Bhargava wrote:
>> The test did the following in userspace:
>>
>>         tx.modes = ADJ_STATUS;
>>         tx.status = STA_INS;
>>
>> 	/* send leap second request */
>>         ret = adjtimex(&tx);
>>
>>         /* Check adjtimex output every half second */
>>         now = tx.time.tv_sec;
>>         while (now < next_leap+2) {
>>                 char buf[26];
>>                 ret = adjtimex(&tx);
>>
>>                 ctime_r(&tx.time.tv_sec, buf);
>>                 buf[strlen(buf)-1] = 0; /*remove trailing\n */
>>
>>                 printf("%s + %6ld us\t%s\n",
>>                                 buf,
>>                                 tx.time.tv_usec,
>>                                 time_state_str(ret));
>>                 now = tx.time.tv_sec;
>>                 /* Sleep for another half second */
>>                 ts.tv_sec = 0;
>>                 ts.tv_nsec = NSEC_PER_SEC/2;
>>                 clock_nanosleep(CLOCK_MONOTONIC, 0, &ts, NULL);
>>         }
>>
>> After some investigation it was noted that the test contained a small error:
>> the test does not reinitialize tx.status and reissues the STA_INS every
>> 1/2 second.
> 
> 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

> 
> Is that ntpd running in parallel with your test program?  If that

No -- ntpd is disabled (chronyd in the case of systemd + current Fedora).

P.

  reply	other threads:[~2015-02-20 14:15 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 [this message]
2015-02-20 17:19     ` Jiri Bohac

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=54E7417B.1090900@redhat.com \
    --to=prarit@redhat.com \
    --cc=jbohac@suse.cz \
    --cc=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mlichvar@redhat.com \
    --cc=peterz@infradead.org \
    --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