Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752664AbbBFKhV (ORCPT ); Fri, 6 Feb 2015 05:37:21 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33184 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751182AbbBFKhQ (ORCPT ); Fri, 6 Feb 2015 05:37:16 -0500 Date: Fri, 6 Feb 2015 11:38:15 +0100 From: Miroslav Lichvar To: Prarit Bhargava Cc: John Stultz , Thomas Gleixner , linux-kernel@vger.kernel.org Subject: Re: [PATCH] time, ntp: Do not update time_state in middle of leap Message-ID: <20150206103815.GB23998@localhost> References: <20150204163005.GF26460@localhost> <54D36E08.1060400@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <54D36E08.1060400@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1776 Lines: 41 On Thu, Feb 05, 2015 at 08:20:08AM -0500, Prarit Bhargava wrote: > On 02/04/2015 11:30 AM, Miroslav Lichvar wrote: > > If after that, adjtimex() will return with TIME_ERROR as expected, or > > not? > > It is possible that an adjtimex() will set the time_state here back to TIME_OK > and return TIME_OK to userspace. Again, and I want to stress this, this is > extremely unlikely to happen. I only hit this due to a bug in a test program. > But at the end of the day, it is possible that this happens and we should > protect against it. Could it break any applications? I guess PLL is normally disabled only when a time synchronization process ends. FWIW, the reference nanokernel implementation has this too. > >> - if ((time_status & STA_PLL) && !(txc->status & STA_PLL)) { > >> + if ((time_status & STA_PLL) && !(txc->status & STA_PLL) && > >> + (time_state != TIME_OOP)) { > >> time_state = TIME_OK; > >> time_status = STA_UNSYNC; > >> /* restart PPS frequency calibration */ > > > > Shouldn't be time_status reset and the PPS calibration restarted even > > when state is TIME_OOP? > > No, this should only happen after the leap second is done IMO (which should be > no more than 2 seconds later). But that will not happen automatically, the application would have to enable and disable the PLL again. Interestingly, the "time_status = STA_UNSYNC" assignment doesn't seem to do anything here, as the variable is always reset couple lines after that, STA_UNSYNC is not a readonly flag. -- Miroslav Lichvar -- 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/