From patchwork Mon Jun 15 18:55:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 49924 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f69.google.com (mail-wg0-f69.google.com [74.125.82.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 932F1211FD for ; Mon, 15 Jun 2015 18:55:30 +0000 (UTC) Received: by wgbhy7 with SMTP id hy7sf14333578wgb.3 for ; Mon, 15 Jun 2015 11:55:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:mime-version:in-reply-to:references :date:message-id:subject:from:to:cc:content-type:sender:precedence :list-id:x-original-sender:x-original-authentication-results :mailing-list:list-post:list-help:list-archive:list-unsubscribe; bh=mq+cwABc6kOSXDnsQB+8o0L6iGCg8vpKXWqVUgztqGM=; b=NyGqp0Ewdun6Hf5COM48rHjHwGbmiWjPOUnBsxFs1f2M9QxW/7JZ2tqSaTrxCJDAKM aNGi9aH2BJ2o3siqn1EYQ9MKrR9GCwNbbbBcem9iPwsHYb0zn4KBFI/bFNAw0yVBs2Pb eVsy8l3hzO2aRPAPGpywH9N1UIg69cxccqcAFXk0rFvX4wAOnCSG880vGXCWW2Bihh54 JfrPRTeixyMyCFx5nQu+U112truIAanvij/kehuDlsU4DrnZitZHHm8dpRc+HptX5+3Q IUJ6Ck83VzhJCdivU9KEgmwkihqrm97ozJqTfWH4Vvw5Gp0d8EytOmVJfesP/09cavGm 1oKQ== X-Gm-Message-State: ALoCoQnik2fbDGbWyvHQ6FiyrCYAZyPPqspgujbZROX6y1+CQpR8TTEDm4DKfDVEVeQfA8fi629Q X-Received: by 10.112.188.233 with SMTP id gd9mr1399599lbc.12.1434394529889; Mon, 15 Jun 2015 11:55:29 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.184.168 with SMTP id ev8ls872849lac.44.gmail; Mon, 15 Jun 2015 11:55:29 -0700 (PDT) X-Received: by 10.152.27.74 with SMTP id r10mr28987009lag.31.1434394529709; Mon, 15 Jun 2015 11:55:29 -0700 (PDT) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id to6si6305095lbb.131.2015.06.15.11.55.29 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Jun 2015 11:55:29 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by lacny3 with SMTP id ny3so44099658lac.3 for ; Mon, 15 Jun 2015 11:55:29 -0700 (PDT) X-Received: by 10.112.97.194 with SMTP id ec2mr1569120lbb.88.1434394529455; Mon, 15 Jun 2015 11:55:29 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp1609637lbb; Mon, 15 Jun 2015 11:55:28 -0700 (PDT) X-Received: by 10.68.101.65 with SMTP id fe1mr47400707pbb.40.1434394527386; Mon, 15 Jun 2015 11:55:27 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y5si19105546pas.76.2015.06.15.11.55.26; Mon, 15 Jun 2015 11:55:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755423AbbFOSzS (ORCPT + 30 others); Mon, 15 Jun 2015 14:55:18 -0400 Received: from mail-ig0-f173.google.com ([209.85.213.173]:36006 "EHLO mail-ig0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754183AbbFOSzK (ORCPT ); Mon, 15 Jun 2015 14:55:10 -0400 Received: by igbiq7 with SMTP id iq7so25619446igb.1 for ; Mon, 15 Jun 2015 11:55:10 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.107.15.213 with SMTP id 82mr14489959iop.44.1434394510032; Mon, 15 Jun 2015 11:55:10 -0700 (PDT) Received: by 10.50.130.148 with HTTP; Mon, 15 Jun 2015 11:55:09 -0700 (PDT) In-Reply-To: <557ED740.7030000@redhat.com> References: <1434063297-28657-1-git-send-email-john.stultz@linaro.org> <557ECEB8.6010804@redhat.com> <557ED740.7030000@redhat.com> Date: Mon, 15 Jun 2015 11:55:09 -0700 Message-ID: Subject: Re: [PATCH 0/5 v2] Fixes for leapsecond expiring early ABS_TIME CLOCK_REALTIME timers From: John Stultz To: Prarit Bhargava Cc: lkml , Daniel Bristot de Oliveira , Richard Cochran , Jan Kara , Jiri Bohac , Thomas Gleixner , Ingo Molnar , Shuah Khan Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: john.stultz@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , On Mon, Jun 15, 2015 at 6:46 AM, Prarit Bhargava wrote: > On 06/15/2015 09:10 AM, Prarit Bhargava wrote: >> I'm testing this on a few more large CPU count systems. So far, so good ... >> > > John, unfortunately I'm seeing failures across a lot of the large systems > dev/early-leap-timer as of this AM > [snip] > [root@intel-chiefriver-04 ~]# ./leap-a-day -s > Setting time to speed up testing > This runs continuously. Press ctrl-c to stop > > Setting time to Mon Jun 15 19:59:50 2015 > Scheduling leap second for Mon Jun 15 20:00:00 2015 > Setting timer for Mon Jun 15 20:00:00 2015 > Mon Jun 15 19:59:57 2015 + 18177 us (0) TIME_INS > Mon Jun 15 19:59:57 2015 + 526181 us (0) TIME_INS > Mon Jun 15 19:59:58 2015 + 37418 us (0) TIME_INS > Mon Jun 15 19:59:58 2015 + 546474 us (0) TIME_INS > Mon Jun 15 19:59:59 2015 + 55724 us (0) TIME_INS > Mon Jun 15 19:59:59 2015 + 566970 us (0) TIME_INS > Mon Jun 15 19:59:59 2015 + 6013 us (1) TIME_OOP - TIMER FIRED > Error: Early timer expiration! > Error: Incorrect NTP state? > Mon Jun 15 19:59:59 2015 + 6040 us (1) TIME_OOP > Mon Jun 15 19:59:59 2015 + 517240 us (1) TIME_OOP > Mon Jun 15 20:00:00 2015 + 28504 us (1) TIME_WAIT > Mon Jun 15 20:00:00 2015 + 539745 us (1) TIME_WAIT > Mon Jun 15 20:00:01 2015 + 50978 us (1) TIME_WAIT > Mon Jun 15 20:00:01 2015 + 560360 us (1) TIME_WAIT > Mon Jun 15 20:00:02 2015 + 69952 us (1) TIME_WAIT Hrm.. I'm unable so far to reproduce this. Attached is a simple trace debug patch, would you mind running the test, and when the failure occurs send me the output from cat /sys/kernel/debug/tracing/trace (along with the test output for the failure). (Do make sure you have tracing enabled in your kernel config) thanks -john diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 5d67ffb..b613a27 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -545,9 +545,13 @@ EXPORT_SYMBOL_GPL(pvclock_gtod_unregister_notifier); static inline void tk_update_leap_state(struct timekeeper *tk) { tk->next_leap_ktime = ntp_get_next_leap(); - if (tk->next_leap_ktime.tv64 != KTIME_MAX) + if (tk->next_leap_ktime.tv64 != KTIME_MAX) { /* Convert to monotonic time */ + trace_printk("Setting leap %lld (from %lld - %lld)\n", + ktime_sub(tk->next_leap_ktime, tk->offs_real).tv64, + tk->next_leap_ktime.tv64, tk->offs_real.tv64); tk->next_leap_ktime = ktime_sub(tk->next_leap_ktime, tk->offs_real); + } } /* @@ -1978,8 +1982,10 @@ ktime_t ktime_get_update_offsets_now(unsigned int *cwsseq, ktime_t *offs_real, } /* Handle leapsecond insertion adjustments */ - if (unlikely(base.tv64 >= tk->next_leap_ktime.tv64)) + if (unlikely(base.tv64 >= tk->next_leap_ktime.tv64)) { + trace_printk("Inserting leap %lld >= %lld\n", base.tv64, tk->next_leap_ktime.tv64); *offs_real = ktime_sub(tk->offs_real, ktime_set(1, 0)); + } } while (read_seqcount_retry(&tk_core.seq, seq));