From patchwork Tue Jul 17 22:05:32 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: john stultz X-Patchwork-Id: 10092 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 0C62423F2A for ; Tue, 17 Jul 2012 22:05:52 +0000 (UTC) Received: from mail-yx0-f180.google.com (mail-yx0-f180.google.com [209.85.213.180]) by fiordland.canonical.com (Postfix) with ESMTP id BAA66A1829A for ; Tue, 17 Jul 2012 22:05:51 +0000 (UTC) Received: by yenq6 with SMTP id q6so1059455yen.11 for ; Tue, 17 Jul 2012 15:05:51 -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=sOUEIO2S+pyiUHSVm2FLPCC64YoZpZXvau1hPihNQWE=; b=EQg7d9Lc/+7Rm+WrIYAjYL/yya7L90YlAjQXFPQjFf1VC83ttGwz9xY7COpBZeUO23 e/x/2UHkkuvH6Jr9WMX8FOP7RFIyVFMXz4qdL2SazuI+1BI7Y12G0xPHxwktPjvo7gox x2SLpUpLoZzkCMJDJpuC/Ntwwnj8RnSWBCzIZUUeaDEPlth+pgxt6aMWpLQVTkteyzw6 vXtV9eJD2he2wTM4CWbIe1h4e3tz31CNgG1v5VXxV/yihSVJ63tGo6klC9JEFuMPlmxH q0IRq3I3phrkVNcrGv4Ymiw+qq2ammCpRZ6uy4uUaX9lI9PjAaq+N/IIQNzfozAoIhw8 1SZw== Received: by 10.50.87.227 with SMTP id bb3mr188141igb.57.1342562750981; Tue, 17 Jul 2012 15:05:50 -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 lc2csp25038ibb; Tue, 17 Jul 2012 15:05:48 -0700 (PDT) Received: by 10.50.173.66 with SMTP id bi2mr159223igc.74.1342562747982; Tue, 17 Jul 2012 15:05:47 -0700 (PDT) Received: from e8.ny.us.ibm.com (e8.ny.us.ibm.com. [32.97.182.138]) by mx.google.com with ESMTPS id hx1si18234620igc.62.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.138 as permitted sender) client-ip=32.97.182.138; Authentication-Results: mx.google.com; spf=pass (google.com: domain of johnstul@us.ibm.com designates 32.97.182.138 as permitted sender) smtp.mail=johnstul@us.ibm.com Received: from /spool/local by e8.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 17 Jul 2012 18:05:47 -0400 Received: from d01dlp03.pok.ibm.com (9.56.224.17) by e8.ny.us.ibm.com (192.168.1.108) 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 d01dlp03.pok.ibm.com (Postfix) with ESMTP id 21D1EC90058 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 q6HM5hNU346206 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 q6HM5hCr022986 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 q6HM5hMg022948; Tue, 17 Jul 2012 19:05:43 -0300 From: John Stultz To: stable@vger.kernel.org Cc: Thomas Gleixner , John Stultz , Prarit Bhargava , Linux Kernel Subject: [PATCH 08/11] 2.6.32.x: hrtimers: Move lock held region in hrtimer_interrupt() Date: Tue, 17 Jul 2012 18:05:32 -0400 Message-Id: <1342562735-55870-9-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-9360-0000-0000-0000087F7112 X-Gm-Message-State: ALoCoQnysUVOb4M16EG7Cw4/zchWo4kkYHWrf7ZnzCjJVgKbuZ7IH9zWTxH9qtS/PiCdZLCeh6LP 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 c4acec7..8ba6d31 100644 --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c @@ -1263,11 +1263,10 @@ void hrtimer_interrupt(struct clock_event_device *dev) cpu_base->nr_events++; dev->next_event.tv64 = KTIME_MAX; + spin_lock(&cpu_base->lock); entry_time = now = ktime_get(); retry: expires_next.tv64 = KTIME_MAX; - - 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 @@ -1342,6 +1341,7 @@ retry: * interrupt routine. We give it 3 attempts to avoid * overreacting on some spurious event. */ + spin_lock(&cpu_base->lock); now = ktime_get(); cpu_base->nr_retries++; if (++retries < 3) @@ -1354,6 +1354,7 @@ retry: */ cpu_base->nr_hangs++; cpu_base->hang_detected = 1; + 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;