From patchwork Fri Jul 13 05:21:50 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 9967 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 1ABAD23F4C for ; Fri, 13 Jul 2012 05:22:37 +0000 (UTC) Received: from mail-ob0-f180.google.com (mail-ob0-f180.google.com [209.85.214.180]) by fiordland.canonical.com (Postfix) with ESMTP id B2534A1814F for ; Fri, 13 Jul 2012 05:22:36 +0000 (UTC) Received: by obbuo19 with SMTP id uo19so4519050obb.11 for ; Thu, 12 Jul 2012 22:22:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-content-scanned:x-cbid:x-gm-message-state; bh=zfKOJd3/MG0qfrZXLHL7Q5QxIgleiuLp/1h3jCpw6Lc=; b=G35E7POFNd2lRunW/vql8M7+4/bC442x40FRiI6f8uNVmBLKbnqLtX5mXD7Z2hVtt+ TEyqYIRvf3Dd+d20MmJjV2fF0/CxBRpmJY5vSfGcI+qiKC/IFdH65Byzr1496ror6hIu NuZAg/I+XAGjTf+tfoVSG2PY1v1LNYcp3d9kycU9lgcu5Q+2+WOtKnQJ00cPROwjPaGJ 373kgC7DwitDIi3+jC+5KXSzy1/S3Ac7qwqIyKQW7E0d99w9sQNLzEjCJQbvXUdLoT/V KmyPygOMMpUT8gA5F0ydz1npX236xjKRnS5ZMD+Hy5eqYhuk3QPnfwSS+GesiQRLmKhB DN4w== Received: by 10.50.193.196 with SMTP id hq4mr207597igc.57.1342156955867; Thu, 12 Jul 2012 22:22:35 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.241.2 with SMTP id lc2csp11718ibb; Thu, 12 Jul 2012 22:22:34 -0700 (PDT) Received: by 10.50.216.202 with SMTP id os10mr248666igc.17.1342156953436; Thu, 12 Jul 2012 22:22:33 -0700 (PDT) Received: from e39.co.us.ibm.com (e39.co.us.ibm.com. [32.97.110.160]) by mx.google.com with ESMTPS id dg6si9156590icc.32.2012.07.12.22.22.33 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 12 Jul 2012 22:22:33 -0700 (PDT) Received-SPF: neutral (google.com: 32.97.110.160 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=32.97.110.160; Authentication-Results: mx.google.com; spf=neutral (google.com: 32.97.110.160 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) smtp.mail=john.stultz@linaro.org Received: from /spool/local by e39.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 12 Jul 2012 23:22:31 -0600 Received: from d03dlp03.boulder.ibm.com (9.17.202.179) by e39.co.us.ibm.com (192.168.1.139) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 12 Jul 2012 23:22:22 -0600 Received: from d03relay03.boulder.ibm.com (d03relay03.boulder.ibm.com [9.17.195.228]) by d03dlp03.boulder.ibm.com (Postfix) with ESMTP id DFAE719D8053 for ; Fri, 13 Jul 2012 05:22:19 +0000 (WET) Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by d03relay03.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q6D5MLBJ248640 for ; Thu, 12 Jul 2012 23:22:21 -0600 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q6D5MJcZ017743 for ; Thu, 12 Jul 2012 23:22:20 -0600 Received: from kernel.stglabs.ibm.com (kernel.stglabs.ibm.com [9.114.214.19]) by d03av02.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q6D5MIiM017604; Thu, 12 Jul 2012 23:22:19 -0600 From: John Stultz To: Linux Kernel Cc: John Stultz , Ingo Molnar , Peter Zijlstra , Richard Cochran , Prarit Bhargava , Thomas Gleixner , stable@vger.kernel.org Subject: [PATCH 1/8] ntp: Fix STA_INS/DEL clearing bug Date: Fri, 13 Jul 2012 01:21:50 -0400 Message-Id: <1342156917-25092-2-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1342156917-25092-1-git-send-email-john.stultz@linaro.org> References: <1342156917-25092-1-git-send-email-john.stultz@linaro.org> X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12071305-4242-0000-0000-0000024F2247 X-Gm-Message-State: ALoCoQmqoGeffAOrHqICzVX+WTHQkUnVE+1OhSVQhOyxBOClkIxb73RE0q6YZDoJFEFUi6zhi60A From: John Stultz In commit 6b43ae8a619d17c4935c3320d2ef9e92bdeed05d, I introduced a bug that kept the STA_INS or STA_DEL bit from being cleared from time_status via adjtimex() without forcing STA_PLL first. Usually once the STA_INS is set, it isn't cleared until the leap second is applied, so its unlikely this affected anyone. However during testing I noticed it took some effort to cancel a leap second once STA_INS was set. This issue affects 3.4 and up. Since this isn't urgent (issue is only observed in testing, the behavior doesn't affect ntpd, nor is a leapsecond due for at least ~6 months), and we're late in the 3.5-rc cycle, I'm holding this off for 3.6 merge window, where I'll then backport to 3.5-stable and 3.4-stable. CC: Ingo Molnar CC: Peter Zijlstra CC: Richard Cochran CC: Prarit Bhargava CC: Thomas Gleixner CC: stable@vger.kernel.org Signed-off-by: John Stultz --- kernel/time/ntp.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c index 70b33ab..b7fbadc 100644 --- a/kernel/time/ntp.c +++ b/kernel/time/ntp.c @@ -409,7 +409,9 @@ int second_overflow(unsigned long secs) time_state = TIME_DEL; break; case TIME_INS: - if (secs % 86400 == 0) { + if (!(time_status & STA_INS)) + time_state = TIME_OK; + else if (secs % 86400 == 0) { leap = -1; time_state = TIME_OOP; time_tai++; @@ -418,7 +420,9 @@ int second_overflow(unsigned long secs) } break; case TIME_DEL: - if ((secs + 1) % 86400 == 0) { + if (!(time_status & STA_DEL)) + time_state = TIME_OK; + else if ((secs + 1) % 86400 == 0) { leap = 1; time_tai--; time_state = TIME_WAIT;