From patchwork Tue Jul 17 22:05:30 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: john stultz X-Patchwork-Id: 10090 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 84C2A23F2A for ; Tue, 17 Jul 2012 22:05:50 +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 3DCD3A18074 for ; Tue, 17 Jul 2012 22:05:50 +0000 (UTC) Received: by ghbz12 with SMTP id z12so1056593ghb.11 for ; Tue, 17 Jul 2012 15:05:49 -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=eUNO0rlbOdV25pf/Yl95qQ1kD42ZS+nOZngq6/lTnHo=; b=iNUp19Wy+nb7i8EbrOtdQcm2ElS5m7FwvvgH1Nf3x0K36sDeh1q3Y7XOncOonwcrBD eVwTGPcwsYAxVd3puDNx/7Ta19dPYCwnnqs1Pk8lFOv89N3d1dWPldZavzoESJRJqInN xSIwJxhEXo91TEB8IluamyLRMDzr3BsnM5WBRAmrjIHBPx2mdwFmOpo7yq+XQG1laosu Gn3/JPc0V1Sz/vYWgktHjpHlsw9/aXWC+6duw4L9H/aX42rOy/zccHiWOCgci7Efgi7k C34kpXRborUHsoUx15Gm+1ihTOa+QdDaztLhFFaISc/rWHeTCb+Gn8zBNopUH411nZQk o8gQ== Received: by 10.50.57.167 with SMTP id j7mr188141igq.53.1342562749569; Tue, 17 Jul 2012 15:05:49 -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 lc2csp25033ibb; Tue, 17 Jul 2012 15:05:47 -0700 (PDT) Received: by 10.50.173.69 with SMTP id bi5mr219904igc.38.1342562747331; Tue, 17 Jul 2012 15:05:47 -0700 (PDT) Received: from e2.ny.us.ibm.com (e2.ny.us.ibm.com. [32.97.182.142]) by mx.google.com with ESMTPS id nx9si18250792igc.17.2012.07.17.15.05.47 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 17 Jul 2012 15:05:47 -0700 (PDT) Received-SPF: pass (google.com: domain of johnstul@us.ibm.com designates 32.97.182.142 as permitted sender) client-ip=32.97.182.142; Authentication-Results: mx.google.com; spf=pass (google.com: domain of johnstul@us.ibm.com designates 32.97.182.142 as permitted sender) smtp.mail=johnstul@us.ibm.com Received: from /spool/local by e2.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 17 Jul 2012 18:05:46 -0400 Received: from d01dlp02.pok.ibm.com (9.56.224.85) by e2.ny.us.ibm.com (192.168.1.102) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 17 Jul 2012 18:05:44 -0400 Received: from d01relay02.pok.ibm.com (d01relay02.pok.ibm.com [9.56.227.234]) by d01dlp02.pok.ibm.com (Postfix) with ESMTP id 2AFD86E804F for ; Tue, 17 Jul 2012 18:05:44 -0400 (EDT) Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay02.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q6HM5hHT384862 for ; Tue, 17 Jul 2012 18:05:43 -0400 Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) by d01av03.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q6HM5hmv022973 for ; Tue, 17 Jul 2012 19:05:43 -0300 Received: from kernel.stglabs.ibm.com (kernel.stglabs.ibm.com [9.114.214.19]) by d01av03.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q6HM5hMe022948; Tue, 17 Jul 2012 19:05:43 -0300 From: John Stultz To: stable@vger.kernel.org Cc: John Stultz , Thomas Gleixner , Prarit Bhargava , Linux Kernel Subject: [PATCH 06/11] 2.6.32.x: timekeeping: Fix leapsecond triggered load spike issue Date: Tue, 17 Jul 2012 18:05:30 -0400 Message-Id: <1342562735-55870-7-git-send-email-johnstul@us.ibm.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1342562735-55870-1-git-send-email-johnstul@us.ibm.com> References: <1342562735-55870-1-git-send-email-johnstul@us.ibm.com> X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12071722-5112-0000-0000-00000A296A3A X-Gm-Message-State: ALoCoQn94AmgBGY7vf76yl0kKC5JRFeg+0R48ics5ucioDuVYzzhX7QK9m+rw9ohN6LY+pIMECdx 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 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index a969adf..1e9808d 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -790,6 +790,8 @@ 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(); } raw_time.tv_nsec += timekeeper.raw_interval;