From patchwork Tue Mar 10 01:42:25 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sanjeev Premi X-Patchwork-Id: 10758 X-Patchwork-Delegate: khilman@deeprootsystems.com Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n2A1gilX005751 for ; Tue, 10 Mar 2009 01:42:44 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752203AbZCJBmo (ORCPT ); Mon, 9 Mar 2009 21:42:44 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752530AbZCJBmo (ORCPT ); Mon, 9 Mar 2009 21:42:44 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:48091 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752203AbZCJBmn convert rfc822-to-8bit (ORCPT ); Mon, 9 Mar 2009 21:42:43 -0400 Received: from dbdp20.itg.ti.com ([172.24.170.38]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id n2A1gUhJ028473; Mon, 9 Mar 2009 20:42:35 -0500 Received: from dbde70.ent.ti.com (localhost [127.0.0.1]) by dbdp20.itg.ti.com (8.13.8/8.13.8) with ESMTP id n2A1gSSh021482; Tue, 10 Mar 2009 07:12:28 +0530 (IST) Received: from dbde02.ent.ti.com ([172.24.170.145]) by dbde70.ent.ti.com ([172.24.170.148]) with mapi; Tue, 10 Mar 2009 07:12:28 +0530 From: "Premi, Sanjeev" To: =?iso-8859-1?Q?H=F6gander_Jouni?= CC: "linux-omap@vger.kernel.org" Date: Tue, 10 Mar 2009 07:12:25 +0530 Subject: RE: Problems in cpuidle Thread-Topic: Problems in cpuidle Thread-Index: AcmgnrOz/rOv19QbTo+OuyNWca9++QAgdJqw Message-ID: References: <871vt7ko3z.fsf@trdhcp146196.ntc.nokia.com> In-Reply-To: <871vt7ko3z.fsf@trdhcp146196.ntc.nokia.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org > -----Original Message----- > From: Högander Jouni [mailto:jouni.hogander@nokia.com] > Sent: Monday, March 09, 2009 3:36 PM > To: Premi, Sanjeev > Cc: linux-omap@vger.kernel.org > Subject: Re: Problems in cpuidle > > "ext Premi, Sanjeev" writes: > > > While working with cpuidle, I have come across these problems. > > I am also working on the solutions, but would be good to hear more > > thoughts. > > > > 1) The flag 'enable_dyn_sleep' is honoured only in > omap3_idle_bm_check() > > but in the C1 state, omap3_enter_idle() is invoked directly. > > So, the system can transition to deeper idle state(s) > > > > Same is the case with 'sleep_block'. > > > > Possible Solutions: > > a) Call omap3_can_sleep() in omap3_enter_idle(). > > This makes omap3_idle_bm_check() redundant; and > can be removed. > > > > b) Make single entry point for all idle states > > But would be an overkill for C1 state. > > > > c) Change omap3_can_sleep() to check for omap_uart_can_sleep() > > and omap3_fclks_active() only. > > Move check for 'enable_dyn_sleep' and 'sleep_block' into > > omap3_enter_idle() > > > > I believe (c) would be the most optimal. > > Selecting (c) will break traditional pm_idle. Current plan is > to add one more C state (C1) which would prevent mpu/core > sleep transitions. Then remove fclk_active check completely. [sp] I meant doing the same for pm_idle as well. Also, the new cstate will not help with 'sleep' block. The proposed change look like: > > -- > Jouni Högander > > -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/arm/mach-omap2/cpuidle34xx.c b/arch/arm/mach-omap2/cpuidle34xx index 7fc3cb3..c25158c 100644 --- a/arch/arm/mach-omap2/cpuidle34xx.c +++ b/arch/arm/mach-omap2/cpuidle34xx.c @@ -82,6 +82,11 @@ static int omap3_enter_idle(struct cpuidle_device *dev, /* Used to keep track of the total time in idle */ getnstimeofday(&ts_preidle); + if (!enable_dyn_sleep) + goto return_sleep_time; + if (atomic_read(&sleep_block) > 0) + goto return_sleep_time; + /* * Adjust the idle state (if required). * Also, ensure that usage statistics of correct state are updated. diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c index 0716d60..5c7819a 100644 --- a/arch/arm/mach-omap2/pm34xx.c +++ b/arch/arm/mach-omap2/pm34xx.c @@ -476,14 +476,10 @@ static int omap3_fclks_active(void) int omap3_can_sleep(void) { - if (!enable_dyn_sleep) - return 0; if (!omap_uart_can_sleep()) return 0; if (omap3_fclks_active()) return 0; - if (atomic_read(&sleep_block) > 0) - return 0; return 1; } @@ -534,6 +530,11 @@ err: static void omap3_pm_idle(void) { + if (!enable_dyn_sleep) + return; + if (atomic_read(&sleep_block) > 0) + return; + local_irq_disable(); local_fiq_disable();