From patchwork Fri Dec 28 07:13:46 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ??? X-Patchwork-Id: 1914421 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 2D9113FF0F for ; Fri, 28 Dec 2012 07:16:28 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1ToU8c-0006gS-RD; Fri, 28 Dec 2012 07:13:50 +0000 Received: from mail-vc0-f170.google.com ([209.85.220.170]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1ToU8Z-0006fr-JL for linux-arm-kernel@lists.infradead.org; Fri, 28 Dec 2012 07:13:48 +0000 Received: by mail-vc0-f170.google.com with SMTP id fl11so10598446vcb.1 for ; Thu, 27 Dec 2012 23:13:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=O+gOlrOXD6GtYJk4jYoxhJ5WjiMNxr9dV/cSQHsXEBk=; b=gFa3r+xXtLKwBjpftcv9H5lyM+XHS3OFn7+SCqA8612usYrPj/d8EwQjqVXjfuE+2p yMij9t1jk7DyUg0TiIk5FJOV5/aIV1rFKDSkHSuiKdHnk4Y20/Wz0QHVKXiQBv+AYSFY w+fnCSd942OwpgFK1uLUlZNXRVSC/SWCoyT61/pCvtXVBCG1f95WFBmQDuMLnSzDrsF0 emZhjkZN5QGbCKgJD0FZJoW7ZsQGqC60xBM9/7eFecH4bOwlKrqYL8sYA7v1RS2DM9Xb NtyZcfanaMv+4+GApyCDQmsqfoGZAP30pXWNCK5rMkLsBRqJmDAwgh+4e4gt5QmWoNoy sHhw== MIME-Version: 1.0 Received: by 10.52.91.142 with SMTP id ce14mr43788400vdb.84.1356678826173; Thu, 27 Dec 2012 23:13:46 -0800 (PST) Received: by 10.220.2.72 with HTTP; Thu, 27 Dec 2012 23:13:46 -0800 (PST) In-Reply-To: References: Date: Fri, 28 Dec 2012 15:13:46 +0800 Message-ID: Subject: Re: [PATCH 1/1] ARM: ux500:mach-ux500/cpuidle.c spinlock dis-matching From: "steve.zhan" To: daniel.lezcano@linaro.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121228_021347_856670_74E025A8 X-CRM114-Status: GOOD ( 16.51 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (zhanzhenbo[at]gmail.com) -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.220.170 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: linux-arm X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Update modify. ====== steve. 2012/12/28, steve.zhan : > Hi Daniel, > > I think we must unlock the master spinlock even > prcmu_gic_decouple function now always return 0. > Could you give some infos about this? > Thanks. > > diff --git a/arch/arm/mach-ux500/cpuidle.c b/arch/arm/mach-ux500/cpuidle.c > index b54884bd..b0759ce 100644 > --- a/arch/arm/mach-ux500/cpuidle.c > +++ b/arch/arm/mach-ux500/cpuidle.c > @@ -29,6 +29,7 @@ static inline int ux500_enter_idle(struct cpuidle_device > *dev, > { > int this_cpu = smp_processor_id(); > bool recouple = false; > + bool locked = false; > > clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &this_cpu); > > @@ -39,6 +40,8 @@ static inline int ux500_enter_idle(struct cpuidle_device > *dev, > if (!spin_trylock(&master_lock)) > goto wfi; > > + locked = true; > + > /* decouple the gic from the A9 cores */ > if (prcmu_gic_decouple()) > goto out; > @@ -76,7 +79,7 @@ static inline int ux500_enter_idle(struct cpuidle_device > *dev, > /* When we switch to retention, the prcmu is in charge > * of recoupling the gic automatically */ > recouple = false; > - > + locked = false; > spin_unlock(&master_lock); > } > wfi: > @@ -86,7 +89,8 @@ out: > > if (recouple) { > prcmu_gic_recouple(); > - spin_unlock(&master_lock); > + if (locked) > + spin_unlock(&master_lock); > } > > clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &this_cpu); > > > > Steve Zhan > diff --git a/arch/arm/mach-ux500/cpuidle.c b/arch/arm/mach-ux500/cpuidle.c index b54884bd..bbe64b7 100644 --- a/arch/arm/mach-ux500/cpuidle.c +++ b/arch/arm/mach-ux500/cpuidle.c @@ -29,6 +29,7 @@ static inline int ux500_enter_idle(struct cpuidle_device *dev, { int this_cpu = smp_processor_id(); bool recouple = false; + bool locked = false; clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &this_cpu); @@ -39,6 +40,8 @@ static inline int ux500_enter_idle(struct cpuidle_device *dev, if (!spin_trylock(&master_lock)) goto wfi; + locked = true; + /* decouple the gic from the A9 cores */ if (prcmu_gic_decouple()) goto out; @@ -76,7 +79,7 @@ static inline int ux500_enter_idle(struct cpuidle_device *dev, /* When we switch to retention, the prcmu is in charge * of recoupling the gic automatically */ recouple = false; - + locked = false; spin_unlock(&master_lock); } wfi: @@ -84,10 +87,11 @@ wfi: out: atomic_dec(&master); - if (recouple) { + if (recouple) prcmu_gic_recouple(); + + if (locked) spin_unlock(&master_lock); - } clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &this_cpu);