From patchwork Tue Jul 17 07:05:19 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: john stultz X-Patchwork-Id: 10029 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 E5A3323E1B for ; Tue, 17 Jul 2012 07:05:45 +0000 (UTC) Received: from mail-gg0-f180.google.com (mail-gg0-f180.google.com [209.85.161.180]) by fiordland.canonical.com (Postfix) with ESMTP id B635BA181CC for ; Tue, 17 Jul 2012 07:05:45 +0000 (UTC) Received: by mail-gg0-f180.google.com with SMTP id f1so66005ggn.11 for ; Tue, 17 Jul 2012 00:05:45 -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=EB7BP/97pAr1KjkOCNDte1MG2TLnBXqUXBAI8hG7mqY=; b=EGqFqfXzlzXXmICk5xMMln2XJIG/4NrWbTbwV34zq9shRtpipXjo9KrLdTHwGlMHA2 5LAScXdRgtxRd9QdoPiItYvp7dSDE1+Y+2L54megIjENOpqqc/Elrqf13Tlwbm/VGQh2 Q9aR1PEJCka+WEHvvutRArxsA3urDN9tJrGSpvCzvFu1QRKnwEez5a7HkCd4X81LgZby zkV4ClBGYTQbPFW//7J3Pf12YyiePzVSLvSTNMYrxoGu3OSzr6xZDYJr3WQEOvNkUJhV RirIAP2sfkr3Z7V7etngshahSJ+Ti0XACtTY4iyZaiwD6lv1zHlsFG8c7Qtts10q73fM nwgA== Received: by 10.50.40.193 with SMTP id z1mr504596igk.0.1342508745132; Tue, 17 Jul 2012 00:05:45 -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 lc2csp15896ibb; Tue, 17 Jul 2012 00:05:44 -0700 (PDT) Received: by 10.50.6.230 with SMTP id e6mr443862iga.47.1342508743815; Tue, 17 Jul 2012 00:05:43 -0700 (PDT) Received: from e4.ny.us.ibm.com (e4.ny.us.ibm.com. [32.97.182.144]) by mx.google.com with ESMTPS id hy10si15264487igc.13.2012.07.17.00.05.43 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 17 Jul 2012 00:05:43 -0700 (PDT) Received-SPF: pass (google.com: domain of johnstul@us.ibm.com designates 32.97.182.144 as permitted sender) client-ip=32.97.182.144; Authentication-Results: mx.google.com; spf=pass (google.com: domain of johnstul@us.ibm.com designates 32.97.182.144 as permitted sender) smtp.mail=johnstul@us.ibm.com Received: from /spool/local by e4.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 17 Jul 2012 03:05:43 -0400 Received: from d01dlp01.pok.ibm.com (9.56.224.56) by e4.ny.us.ibm.com (192.168.1.104) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 17 Jul 2012 03:05:42 -0400 Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by d01dlp01.pok.ibm.com (Postfix) with ESMTP id E3E4338C8054 for ; Tue, 17 Jul 2012 03:05:41 -0400 (EDT) Received: from d01av04.pok.ibm.com (d01av04.pok.ibm.com [9.56.224.64]) by d01relay04.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q6H75f0a378220 for ; Tue, 17 Jul 2012 03:05:41 -0400 Received: from d01av04.pok.ibm.com (loopback [127.0.0.1]) by d01av04.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q6H75eBa016316 for ; Tue, 17 Jul 2012 03:05:40 -0400 Received: from kernel.stglabs.ibm.com (kernel.stglabs.ibm.com [9.114.214.19]) by d01av04.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q6H75aBO015997; Tue, 17 Jul 2012 03:05:37 -0400 From: John Stultz To: stable@vger.kernel.org Cc: John Stultz , Thomas Gleixner , Prarit Bhargava , Linux Kernel Subject: [PATCH 06/11] 3.2.x: timekeeping: Fix leapsecond triggered load spike issue Date: Tue, 17 Jul 2012 03:05:19 -0400 Message-Id: <1342508724-14527-7-git-send-email-johnstul@us.ibm.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1342508724-14527-1-git-send-email-johnstul@us.ibm.com> References: <1342508724-14527-1-git-send-email-johnstul@us.ibm.com> X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12071707-3534-0000-0000-00000A81AF24 X-Gm-Message-State: ALoCoQkARKpm0wwdNDL7Ww96JsTBvASfHIbxoAA6KqtCSB8/1Nrqlj2Bb3TXp0KM4cuyQd8fdOva 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 5d55185..8958ad7 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -941,6 +941,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 */ @@ -1052,6 +1054,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);