From patchwork Tue Jul 17 17:33:53 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: john stultz X-Patchwork-Id: 10059 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 8393A23F2A for ; Tue, 17 Jul 2012 17:37:59 +0000 (UTC) Received: from mail-gh0-f180.google.com (mail-gh0-f180.google.com [209.85.160.180]) by fiordland.canonical.com (Postfix) with ESMTP id 39D80A1826C for ; Tue, 17 Jul 2012 17:37:59 +0000 (UTC) Received: by ghbz12 with SMTP id z12so717810ghb.11 for ; Tue, 17 Jul 2012 10:37:58 -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=5naUow43djGNjniS3yfNnvYKUi24TonXrn03qRZCJzg=; b=L6xRh+lBxCa2u9NP8u/Ff5UjnxKhz55APnw17i53WNPoEz4D3ATBHB3e9HVSpYk9Ai s8cSItI5KQA6WQhNzl9xpONjdYt86Q0nnrYRgKCprA+NwIg2+yCHt0WhXVaNz4kRJj6Y 4guZz/FjTRJaaiZMdKbKSBYnC2Hk76hnmtSfMkzdLMIlNyS8diDz1IkpD2O6JI2eqBFg LMIhG6ZIotqM5qLimbaLBiJGMH4C0aoXddSOmO5z8sTRTX5OrKLAH5XlwwwQOMooxB1w AOAOWY4K0IAoF046qzoYbpV0bYPxQl5ntneekkKKwKPr6PZTk+I+UKPesOnNfs3ch46y S6Vg== Received: by 10.50.195.234 with SMTP id ih10mr2221502igc.0.1342546678356; Tue, 17 Jul 2012 10:37:58 -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 lc2csp22568ibb; Tue, 17 Jul 2012 10:37:57 -0700 (PDT) Received: by 10.182.207.6 with SMTP id ls6mr4575000obc.36.1342546677837; Tue, 17 Jul 2012 10:37:57 -0700 (PDT) Received: from e37.co.us.ibm.com (e37.co.us.ibm.com. [32.97.110.158]) by mx.google.com with ESMTPS id d10si19006474obl.96.2012.07.17.10.37.57 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 17 Jul 2012 10:37:57 -0700 (PDT) Received-SPF: pass (google.com: domain of johnstul@us.ibm.com designates 32.97.110.158 as permitted sender) client-ip=32.97.110.158; Authentication-Results: mx.google.com; spf=pass (google.com: domain of johnstul@us.ibm.com designates 32.97.110.158 as permitted sender) smtp.mail=johnstul@us.ibm.com Received: from /spool/local by e37.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 17 Jul 2012 11:37:57 -0600 Received: from d03dlp01.boulder.ibm.com (9.17.202.177) by e37.co.us.ibm.com (192.168.1.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 17 Jul 2012 11:37:42 -0600 Received: from d03relay03.boulder.ibm.com (d03relay03.boulder.ibm.com [9.17.195.228]) by d03dlp01.boulder.ibm.com (Postfix) with ESMTP id C05AFC4000A for ; Tue, 17 Jul 2012 17:37:38 +0000 (WET) Received: from d03av06.boulder.ibm.com (d03av06.boulder.ibm.com [9.17.195.245]) by d03relay03.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q6HHbSAP110682 for ; Tue, 17 Jul 2012 11:37:35 -0600 Received: from d03av06.boulder.ibm.com (loopback [127.0.0.1]) by d03av06.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q6HHZMNx016588 for ; Tue, 17 Jul 2012 11:35:22 -0600 Received: from kernel.stglabs.ibm.com (kernel.stglabs.ibm.com [9.114.214.19]) by d03av06.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q6HHZEE7015928; Tue, 17 Jul 2012 11:35:21 -0600 From: John Stultz To: stable@vger.kernel.org Cc: John Stultz , Thomas Gleixner , Prarit Bhargava , Linux Kernel Subject: [PATCH 06/11] 3.0.x: timekeeping: Fix leapsecond triggered load spike issue Date: Tue, 17 Jul 2012 13:33:53 -0400 Message-Id: <1342546438-17534-7-git-send-email-johnstul@us.ibm.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1342546438-17534-1-git-send-email-johnstul@us.ibm.com> References: <1342546438-17534-1-git-send-email-johnstul@us.ibm.com> X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12071717-7408-0000-0000-000006D68DE6 X-Gm-Message-State: ALoCoQkmO37RP1DfXF0akjzXcmI271yd5BQdNlxXMtDTTI1p6P7eMmJ7cOMvr6p2DePSq4tWgKNt This is a backport of 4873fa070ae84a4115f0b3c9dfabc224f1bc7c51 The timekeeping code misses an update of the hrtimer subsystem after a leap second happened. Due to that timers based on CLOCK_REALTIME are either expiring a second early or late depending on whether a leap second has been inserted or deleted until an operation is initiated which causes that update. Unless the update happens by some other means this discrepancy between the timekeeping and the hrtimer data stays forever and timers are expired either early or late. The reported immediate workaround - $ data -s "`date`" - is causing a call to clock_was_set() which updates the hrtimer data structures. See: http://www.sheeri.com/content/mysql-and-leap-second-high-cpu-and-fix Add the missing clock_was_set() call to update_wall_time() in case of a leap second event. The actual update is deferred to softirq context as the necessary smp function call cannot be invoked from hard interrupt context. Signed-off-by: John Stultz Reported-by: Jan Engelhardt Reviewed-by: Ingo Molnar Acked-by: Peter Zijlstra Acked-by: Prarit Bhargava Cc: stable@vger.kernel.org Link: http://lkml.kernel.org/r/1341960205-56738-3-git-send-email-johnstul@us.ibm.com Signed-off-by: Thomas Gleixner Cc: Prarit Bhargava Cc: Thomas Gleixner Cc: Linux Kernel Signed-off-by: John Stultz --- kernel/time/timekeeping.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 0b582eb..9201474 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -827,6 +827,8 @@ static cycle_t logarithmic_accumulation(cycle_t offset, int shift) leap = second_overflow(xtime.tv_sec); xtime.tv_sec += leap; wall_to_monotonic.tv_sec -= leap; + if (leap) + clock_was_set_delayed(); } /* Accumulate raw time */ @@ -938,6 +940,8 @@ static void update_wall_time(void) leap = second_overflow(xtime.tv_sec); xtime.tv_sec += leap; wall_to_monotonic.tv_sec -= leap; + if (leap) + clock_was_set_delayed(); } timekeeping_update(false);