From patchwork Tue Jul 17 18:05:39 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: john stultz X-Patchwork-Id: 10066 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 5887523E2F for ; Tue, 17 Jul 2012 18:07:35 +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 0E2B0A182AE for ; Tue, 17 Jul 2012 18:07:34 +0000 (UTC) Received: by ghbz12 with SMTP id z12so757905ghb.11 for ; Tue, 17 Jul 2012 11:07:34 -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=LEBbi5M40E9S6+RIAFX+82uHfjjTtXB2+rlnezoW3aw=; b=MQlRPJ3e1GngJNWLtjtyr4zxyeCWHRac8iR3MdXtAtLRrRG9vVncRLr/lHv4OlqbdU 2lDVtokzEKcR6x1F5PDUUd4EuDYsQJeSB7SrbGH/WbU5eHep40F+9jYIqk4qY0uDt4M8 A11fKx7myqQeLpd7+rYgjWfpwxiAsGzTvpbZN8LfJiAmSv/XYB84yErao4AGgt38ts8/ IuMNuM41LofB7lpoNKEK10RaD0W/oaOfdLVCHdHW3ASfG6wFWngvfzQ2a93w7QViaQEu zfBGtXVm+yhPq2TvSZYd1oIzE6fBOgPl3dmoeTML4KlClNSZ1BDHPJxAchRG/U6tq1xg An0g== Received: by 10.50.87.227 with SMTP id bb3mr2175844igb.57.1342548454216; Tue, 17 Jul 2012 11:07:34 -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 lc2csp22955ibb; Tue, 17 Jul 2012 11:07:33 -0700 (PDT) Received: by 10.182.14.101 with SMTP id o5mr4878189obc.1.1342548453018; Tue, 17 Jul 2012 11:07:33 -0700 (PDT) Received: from e32.co.us.ibm.com (e32.co.us.ibm.com. [32.97.110.150]) by mx.google.com with ESMTPS id r4si19083471obz.57.2012.07.17.11.07.32 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 17 Jul 2012 11:07:32 -0700 (PDT) Received-SPF: pass (google.com: domain of johnstul@us.ibm.com designates 32.97.110.150 as permitted sender) client-ip=32.97.110.150; Authentication-Results: mx.google.com; spf=pass (google.com: domain of johnstul@us.ibm.com designates 32.97.110.150 as permitted sender) smtp.mail=johnstul@us.ibm.com Received: from /spool/local by e32.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 17 Jul 2012 12:07:32 -0600 Received: from d03dlp03.boulder.ibm.com (9.17.202.179) by e32.co.us.ibm.com (192.168.1.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 17 Jul 2012 12:06:47 -0600 Received: from d03relay04.boulder.ibm.com (d03relay04.boulder.ibm.com [9.17.195.106]) by d03dlp03.boulder.ibm.com (Postfix) with ESMTP id C328C19D8052 for ; Tue, 17 Jul 2012 18:06:43 +0000 (WET) Received: from d03av04.boulder.ibm.com (d03av04.boulder.ibm.com [9.17.195.170]) by d03relay04.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q6HI6Enj112048 for ; Tue, 17 Jul 2012 12:06:18 -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 q6HI6B9Y019628 for ; Tue, 17 Jul 2012 12:06:11 -0600 Received: from kernel.stglabs.ibm.com (kernel.stglabs.ibm.com [9.114.214.19]) by d03av04.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q6HI60xm018372; Tue, 17 Jul 2012 12:06:09 -0600 From: John Stultz To: stable@vger.kernel.org Cc: Thomas Gleixner , John Stultz , Prarit Bhargava , Linux Kernel Subject: [PATCH 08/11] 2.6.35.x: hrtimers: Move lock held region in hrtimer_interrupt() Date: Tue, 17 Jul 2012 14:05:39 -0400 Message-Id: <1342548342-19683-9-git-send-email-johnstul@us.ibm.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1342548342-19683-1-git-send-email-johnstul@us.ibm.com> References: <1342548342-19683-1-git-send-email-johnstul@us.ibm.com> X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12071718-2356-0000-0000-0000006EFC55 X-Gm-Message-State: ALoCoQlwfFLXfWu965HVflVfq2nMuc5VUHucbRUHRJBWvwatENKEZth3D8MAcwm0s7WsG1Oxh2tr From: Thomas Gleixner This is a backport of 196951e91262fccda81147d2bcf7fdab08668b40 We need to update the base offsets from this code and we need to do that under base->lock. Move the lock held region around the ktime_get() calls. The ktime_get() calls are going to be replaced with a function which gets the time and the offsets atomically. Signed-off-by: Thomas Gleixner Reviewed-by: Ingo Molnar Acked-by: Peter Zijlstra Acked-by: Prarit Bhargava Cc: stable@vger.kernel.org Signed-off-by: John Stultz Link: http://lkml.kernel.org/r/1341960205-56738-6-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/hrtimer.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c index c1f7d12..2f05eb1 100644 --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c @@ -1279,11 +1279,10 @@ void hrtimer_interrupt(struct clock_event_device *dev) cpu_base->nr_events++; dev->next_event.tv64 = KTIME_MAX; + raw_spin_lock(&cpu_base->lock); entry_time = now = ktime_get(); retry: expires_next.tv64 = KTIME_MAX; - - raw_spin_lock(&cpu_base->lock); /* * We set expires_next to KTIME_MAX here with cpu_base->lock * held to prevent that a timer is enqueued in our queue via @@ -1358,6 +1357,7 @@ retry: * interrupt routine. We give it 3 attempts to avoid * overreacting on some spurious event. */ + raw_spin_lock(&cpu_base->lock); now = ktime_get(); cpu_base->nr_retries++; if (++retries < 3) @@ -1370,6 +1370,7 @@ retry: */ cpu_base->nr_hangs++; cpu_base->hang_detected = 1; + raw_spin_unlock(&cpu_base->lock); delta = ktime_sub(now, entry_time); if (delta.tv64 > cpu_base->max_hang_time.tv64) cpu_base->max_hang_time = delta;