Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754780AbbBTOPt (ORCPT ); Fri, 20 Feb 2015 09:15:49 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40720 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751181AbbBTOPs (ORCPT ); Fri, 20 Feb 2015 09:15:48 -0500 Message-ID: <54E7417B.1090900@redhat.com> Date: Fri, 20 Feb 2015 09:15:23 -0500 From: Prarit Bhargava User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20131028 Thunderbird/17.0.10 MIME-Version: 1.0 To: Jiri Bohac CC: linux-kernel@vger.kernel.org, John Stultz , Thomas Gleixner , Miroslav Lichvar , Peter Zijlstra Subject: Re: [PATCH] time, ntp: Do not update time_state in middle of leap second [v3] References: <1423749499-18520-1-git-send-email-prarit@redhat.com> <20150219170048.GB25948@midget.suse.cz> In-Reply-To: <20150219170048.GB25948@midget.suse.cz> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2113 Lines: 65 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. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/