From patchwork Thu Sep 27 06:36:01 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fan Wu X-Patchwork-Id: 1511971 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 46F93DFE80 for ; Thu, 27 Sep 2012 06:41:42 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TH7ku-0001aF-KJ; Thu, 27 Sep 2012 06:39:28 +0000 Received: from na3sys009aog124.obsmtp.com ([74.125.149.151]) by merlin.infradead.org with smtps (Exim 4.76 #1 (Red Hat Linux)) id 1TH7kr-0001Zp-5Q for linux-arm-kernel@lists.infradead.org; Thu, 27 Sep 2012 06:39:26 +0000 Received: from MSI-MTA.marvell.com ([65.219.4.132]) (using TLSv1) by na3sys009aob124.postini.com ([74.125.148.12]) with SMTP ID DSNKUGP0jHBa0A0OdbKZVQLEWoaf2h1wcvxx@postini.com; Wed, 26 Sep 2012 23:39:25 PDT Received: from maili.marvell.com ([10.68.76.210]) by MSI-MTA.marvell.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 26 Sep 2012 23:36:03 -0700 Received: from localhost (unknown [10.38.34.220]) by maili.marvell.com (Postfix) with ESMTP id 1982A4E510; Wed, 26 Sep 2012 23:36:04 -0700 (PDT) From: Fan Wu To: Russell King , Nicolas Pitre , Will Deacon , H Hartley Sweeten , Tony Lindgren Subject: [PATCH] ARM:CPUIDLE: Fix wrongly used idle control counter Date: Thu, 27 Sep 2012 14:36:01 +0800 Message-Id: <1348727761-16485-1-git-send-email-fwu@marvell.com> X-Mailer: git-send-email 1.7.0.4 X-OriginalArrivalTime: 27 Sep 2012 06:36:03.0970 (UTC) FILETIME=[5DF20E20:01CD9C7A] X-Spam-Note: CRM114 invocation failed X-Spam-Score: -4.2 (----) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-4.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [74.125.149.151 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: fwu , YiLu Mao , Ning Jiang , linux-arm-kernel@lists.infradead.org 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: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: fwu 1. On ARM platform, "nohlt" can be used to prevent core from idle process, returning immediately. 2. There are two interface, exported for other modules, named disable_hlt and enable_hlt and used to enable/disable the cpuidle mechanism by increasing/decreasing "hlt_counter". So, the more "hlt_counter" is, the more user want to disable cpuidle. Disable_hlt and enable_hlt are paired operation, when you first call disable_hlt and then enable_hlt, the semantics are right, but if you call enable_hlt and then disable_hlt, it is wrong. 3. Change "hlt_counter > 0" can fix the problem. The judgement whethere the cpuidle is disabled need to check whether the "hlt_counter > 0" rather than "hlt_counter != 0". Change-Id: Ibd5ea805b0c01fe326833d333ce5d72e0447430a Signed-off-by: fwu Signed-off-by: YiLu Mao Signed-off-by: Ning Jiang --- arch/arm/kernel/process.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c index 693b744..4dc2fee 100644 --- a/arch/arm/kernel/process.c +++ b/arch/arm/kernel/process.c @@ -204,7 +204,7 @@ void cpu_idle(void) #ifdef CONFIG_PL310_ERRATA_769419 wmb(); #endif - if (hlt_counter) { + if (hlt_counter > 0) { local_irq_enable(); cpu_relax(); } else if (!need_resched()) {