From patchwork Mon Jan 7 10:58:10 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?5rmb5oyv5rOi?= X-Patchwork-Id: 209895 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:4978:20e::2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id C454B2C0090 for ; Mon, 7 Jan 2013 22:01:48 +1100 (EST) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TsAPc-0006Jo-Nf; Mon, 07 Jan 2013 10:58:36 +0000 Received: from mail-vc0-f172.google.com ([209.85.220.172]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TsAPZ-0006It-Fm for linux-arm-kernel@lists.infradead.org; Mon, 07 Jan 2013 10:58:34 +0000 Received: by mail-vc0-f172.google.com with SMTP id fw7so19199986vcb.17 for ; Mon, 07 Jan 2013 02:58:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=yY2+bqsRGOcDUP6qve+iUqeV6gYBHVm/4855KwLVHq4=; b=0/tnH2PEs/fsEIJAfqpTuyMY6ynE0jRzeI6TfLolbGp5w3hFKDNRQcZp3iWW4CYXh+ YwUoMfzADvEgoyXC7b02qJvZ2/HdKxCI91uDtvJCNdEzchunJ9OH5d4ZWvGbzNU9SRR1 Bt9hs8iDri0JklxGAV2I/vgsvkEg6SnnRYRuKPqjSqEw1U0ydGktinalJD1N1NdmHQdM faYamLAZ12H0jMK8mhG7MXz45Gh6AFWlMFgqEdvr/gGx+PTVCwYUGemcBGXJ2JURuZl8 Yk+gf+yfc81NHkVqnGZL4506ri6+dSbozknr6NZdscocWeiGzrw+inl9U9ZSJcXLbPrm CI0A== Received: by 10.52.98.134 with SMTP id ei6mr71593812vdb.114.1357556310967; Mon, 07 Jan 2013 02:58:30 -0800 (PST) MIME-Version: 1.0 Received: by 10.220.2.72 with HTTP; Mon, 7 Jan 2013 02:58:10 -0800 (PST) In-Reply-To: <50EA8D35.5020501@linaro.org> References: <50E9A4FE.6090807@linaro.org> <50EA8D35.5020501@linaro.org> From: "steve.zhan" Date: Mon, 7 Jan 2013 18:58:10 +0800 Message-ID: Subject: Re: [PATCH 1/1] ARM: ux500:mach-ux500/cpuidle.c spinlock dis-matching To: Daniel Lezcano X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130107_055833_825241_A484CD85 X-CRM114-Status: GOOD ( 19.91 ) 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.172 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-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org List-Id: linux-imx-kernel.lists.patchwork.ozlabs.org Hi Daniel, Thank you. commit 99d0a05d163bd070eba7caab7e772206edbcbbc9 Author: steve.zhan Date: Mon Jan 7 18:19:14 2013 +0800 ARM: ux500: add spin_unlock(&master_lock). Add the missing spin_unlock statement to unlock master_lock when prcmu_gic_decouple() return TRUE Signed-off-by: steve zhan * manually */ ------------- steve zhan 2013/1/7 Daniel Lezcano : > On 01/07/2013 06:50 AM, steve.zhan wrote: >> Hi Daniel, >> >> Happy new year, Thank you for reply. >> Sorry for that i have refer the old patch email. >> I have updated the patch, Pls check the URL: >> http://lists.infradead.org/pipermail/linux-arm-kernel/2012-December/138939.html >> Now i am using gmail GUI tools to send mail, i will switch email tool >> to MUTT to commit the other patchs in the future. > > Ok. > > Please do not introduce a new variable which is at the end pointless and > add more complexity. > > You can simply remove the if statement for prcmu_gic_decouple(), or > unlock if it fails. > > Thanks > -- Daniel > >> -------------- >> steve.zhan >> >> 2013/1/7, Daniel Lezcano : >>> On 12/28/2012 08:06 AM, steve.zhan wrote: >>>> Hi Daniel, >>> >>> Hi Steve, >>> >>> sorry I missed your email. >>> >>>> >>>> I think we must unlock the master spinlock even >>>> prcmu_gic_decouple function now always return 0. >>>> Could you give some infos about this? >>> >>> I agree, that would be cleaner. >>> >>> AFAICS, your patch does not solve the problem because 'recouple' will be >>> false if prcmu_gic_decouple fails, so the lock will never be release. >>> >>> That will be simpler to do: >>> >>> if (prcmu_gic_decouple()) { >>> spin_unlock(&master); >>> goto out; >>> } >>> >>> no ? >>> >>>> 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 >>>> >>> >>> >>> -- >>> Linaro.org │ Open source software for ARM SoCs >>> >>> Follow Linaro: Facebook | >>> Twitter | >>> Blog >>> >>> >> >> > > > -- > Linaro.org │ Open source software for ARM SoCs > > Follow Linaro: Facebook | > Twitter | > Blog > diff --git a/arch/arm/mach-ux500/cpuidle.c b/arch/arm/mach-ux500/cpuidle.c index b54884bd..ce91493 100644 --- a/arch/arm/mach-ux500/cpuidle.c +++ b/arch/arm/mach-ux500/cpuidle.c @@ -40,8 +40,10 @@ static inline int ux500_enter_idle(struct cpuidle_device *dev, goto wfi; /* decouple the gic from the A9 cores */ - if (prcmu_gic_decouple()) + if (prcmu_gic_decouple()) { + spin_unlock(&master_lock); goto out; + } /* If an error occur, we will have to recouple the gic