From patchwork Wed May 30 17:54:57 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 9046 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 9A8EB23E49 for ; Wed, 30 May 2012 17:56:28 +0000 (UTC) Received: from mail-yx0-f180.google.com (mail-yx0-f180.google.com [209.85.213.180]) by fiordland.canonical.com (Postfix) with ESMTP id 5FAE7A18136 for ; Wed, 30 May 2012 17:56:28 +0000 (UTC) Received: by yenq6 with SMTP id q6so100513yen.11 for ; Wed, 30 May 2012 10:56:27 -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:x-content-scanned:x-cbid :x-gm-message-state; bh=Cmhh+wuO5uTP3vSRn33W7hFWM60IqCi0vtf6xLr1Ho8=; b=ZV7RhyyxhT/9xYkXYMRLsqaOQAcAZgOrZbXz1B80A3FPCnY1mrbW1ZbihcvC+yL6CQ T3Sd1splmaF5/AKOLDOrpcyQLILR1WePW2y11ZbXipz9pm8IrkxUtIcOlxkTMKmPEXWD Q5p/XqSKvxtVzu+kVJLrw4JucerMtMnsbkO/5e8Om5fvoZlG8sQkruYBqlx5LdVgGtlE j2BPQYzByMywU1qe3Hxh1JZhEtOgweQBOa8ctW9RiyxtcTgXwXjQjpSHT3siqjS/6SUG uFAhrRMjVKxcvOOMq4NzY0/B0usViqjd3tj6ESzjp8jmIQbHN1MxSkhCLmCgbRwEDHVp QdGw== Received: by 10.50.40.193 with SMTP id z1mr11665957igk.0.1338400587442; Wed, 30 May 2012 10:56:27 -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.24.148 with SMTP id v20csp208321ibb; Wed, 30 May 2012 10:56:26 -0700 (PDT) Received: by 10.60.8.35 with SMTP id o3mr16008513oea.45.1338400586242; Wed, 30 May 2012 10:56:26 -0700 (PDT) Received: from e31.co.us.ibm.com (e31.co.us.ibm.com. [32.97.110.149]) by mx.google.com with ESMTPS id m4si212413obc.100.2012.05.30.10.56.25 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 30 May 2012 10:56:26 -0700 (PDT) Received-SPF: pass (google.com: domain of jstultz@us.ibm.com designates 32.97.110.149 as permitted sender) client-ip=32.97.110.149; Authentication-Results: mx.google.com; spf=pass (google.com: domain of jstultz@us.ibm.com designates 32.97.110.149 as permitted sender) smtp.mail=jstultz@us.ibm.com Received: from /spool/local by e31.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 30 May 2012 11:56:24 -0600 Received: from d03dlp02.boulder.ibm.com (9.17.202.178) by e31.co.us.ibm.com (192.168.1.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 30 May 2012 11:55:59 -0600 Received: from d03relay01.boulder.ibm.com (d03relay01.boulder.ibm.com [9.17.195.226]) by d03dlp02.boulder.ibm.com (Postfix) with ESMTP id 13F903E4004F; Wed, 30 May 2012 11:55:55 -0600 (MDT) Received: from d03av04.boulder.ibm.com (d03av04.boulder.ibm.com [9.17.195.170]) by d03relay01.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q4UHtW7B032000; Wed, 30 May 2012 11:55:32 -0600 Received: from d03av04.boulder.ibm.com (loopback [127.0.0.1]) by d03av04.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q4UHt5JN023499; Wed, 30 May 2012 11:55:05 -0600 Received: from kernel.beaverton.ibm.com (kernel.beaverton.ibm.com [9.47.67.96]) by d03av04.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q4UHt3WV023015; Wed, 30 May 2012 11:55:04 -0600 Received: by kernel.beaverton.ibm.com (Postfix, from userid 1056) id 6C953C0620; Wed, 30 May 2012 10:55:02 -0700 (PDT) From: John Stultz To: linux-kernel@vger.kernel.org Cc: John Stultz , stable@kernel.org, Thomas Gleixner Subject: [PATCH] time: Fix CLOCK_MONOTONIC inconsistency during leapsecond Date: Wed, 30 May 2012 10:54:57 -0700 Message-Id: <1338400497-12420-1-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.7.3.2.146.gca209 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12053017-7282-0000-0000-00000976C667 X-Gm-Message-State: ALoCoQnn5Jjqy75nTB9Mf4xMrGHNpWPUH/asIlpN/4nS8nCxKC24Ovx06RG9OCchRX9ExDHINAzL Make sure we update wall_to_monotonic when adding a leapsecond. This could otherwise cause discontinuities in CLOCK_MONOTONIC. This fixes a regression caused by 6b43ae8a619d17c4935c3320d2ef9e92bdeed05d CC: stable@kernel.org CC: Thomas Gleixner Reported-by: Richard Cochran Tested-by: Richard Cochran Signed-off-by: John Stultz --- kernel/time/timekeeping.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 6e46cac..6f46a00 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -962,6 +962,7 @@ static cycle_t logarithmic_accumulation(cycle_t offset, int shift) timekeeper.xtime.tv_sec++; leap = second_overflow(timekeeper.xtime.tv_sec); timekeeper.xtime.tv_sec += leap; + timekeeper.wall_to_monotonic.tv_sec -= leap; } /* Accumulate raw time */ @@ -1077,6 +1078,7 @@ static void update_wall_time(void) timekeeper.xtime.tv_sec++; leap = second_overflow(timekeeper.xtime.tv_sec); timekeeper.xtime.tv_sec += leap; + timekeeper.wall_to_monotonic.tv_sec -= leap; } timekeeping_update(false);