Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754696AbbBTRTS (ORCPT ); Fri, 20 Feb 2015 12:19:18 -0500 Received: from cantor2.suse.de ([195.135.220.15]:51355 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752165AbbBTRTQ (ORCPT ); Fri, 20 Feb 2015 12:19:16 -0500 Date: Fri, 20 Feb 2015 18:19:15 +0100 From: Jiri Bohac To: Prarit Bhargava Cc: Jiri Bohac , 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] Message-ID: <20150220171915.GA32136@midget.suse.cz> References: <1423749499-18520-1-git-send-email-prarit@redhat.com> <20150219170048.GB25948@midget.suse.cz> <54E7417B.1090900@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <54E7417B.1090900@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2971 Lines: 77 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 SUSE Labs, SUSE CZ -- 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/