From patchwork Wed Apr 3 12:15:22 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 15862 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 ABC0823E21 for ; Wed, 3 Apr 2013 12:15:53 +0000 (UTC) Received: from mail-vc0-f200.google.com (mail-vc0-f200.google.com [209.85.220.200]) by fiordland.canonical.com (Postfix) with ESMTP id 3B339A18659 for ; Wed, 3 Apr 2013 12:15:53 +0000 (UTC) Received: by mail-vc0-f200.google.com with SMTP id hf12sf2260687vcb.11 for ; Wed, 03 Apr 2013 05:15:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:x-beenthere:x-received:received-spf :x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=w45ca/pS+8Oqw/LSfKyvNzT3vmrCbGOD7D7AQ4CEgWg=; b=m3KIy90toOPIexONRkUTQl6YJelOXVVGCQwheSA6j0N7d9k5kwSgYDFkpU9c18YPl9 vEOIVflIc4z+KXXZ86qFPGrLNwVqBfd530S9NMJxinbQDeepBAh7608+yIARe7h9+52J LEqs1qEQKxeytA+VIPMFuOf/KMFDgd4gvkYHt6aU8cLUlvEwS4F+gGncj5nAtvpgWY8k jBoALkGuQFZXy+aR7wsgS2mxxCSh+SDCCs9pgCgN7z5H8qSQHCVmnIbFys39XlwPAH8i 9vnqsxnkQJrlER99ZCUihIJqo+AZNDwHtSJE4CZkrNmjvl8UUBST4piSpM3URO3O4X00 H/wg== X-Received: by 10.236.154.6 with SMTP id g6mr704262yhk.28.1364991352701; Wed, 03 Apr 2013 05:15:52 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.47.113 with SMTP id c17ls907189qen.0.gmail; Wed, 03 Apr 2013 05:15:52 -0700 (PDT) X-Received: by 10.58.15.193 with SMTP id z1mr960465vec.40.1364991352567; Wed, 03 Apr 2013 05:15:52 -0700 (PDT) Received: from mail-vb0-x22d.google.com (mail-vb0-x22d.google.com [2607:f8b0:400c:c02::22d]) by mx.google.com with ESMTPS id p8si4637887vdw.140.2013.04.03.05.15.52 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 03 Apr 2013 05:15:52 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c02::22d is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c02::22d; Received: by mail-vb0-f45.google.com with SMTP id w15so384554vbf.32 for ; Wed, 03 Apr 2013 05:15:52 -0700 (PDT) X-Received: by 10.220.154.199 with SMTP id p7mr964825vcw.46.1364991352458; Wed, 03 Apr 2013 05:15:52 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.59.4.204 with SMTP id cg12csp167626ved; Wed, 3 Apr 2013 05:15:51 -0700 (PDT) X-Received: by 10.194.89.169 with SMTP id bp9mr2380142wjb.57.1364991351392; Wed, 03 Apr 2013 05:15:51 -0700 (PDT) Received: from mail-wi0-x234.google.com (mail-wi0-x234.google.com [2a00:1450:400c:c05::234]) by mx.google.com with ESMTPS id r10si6574121wia.107.2013.04.03.05.15.50 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 03 Apr 2013 05:15:51 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:400c:c05::234 is neither permitted nor denied by best guess record for domain of daniel.lezcano@linaro.org) client-ip=2a00:1450:400c:c05::234; Received: by mail-wi0-f180.google.com with SMTP id c10so1436472wiw.13 for ; Wed, 03 Apr 2013 05:15:50 -0700 (PDT) X-Received: by 10.180.97.132 with SMTP id ea4mr2404342wib.23.1364991350892; Wed, 03 Apr 2013 05:15:50 -0700 (PDT) Received: from mai.home (AToulouse-654-1-486-7.w92-146.abo.wanadoo.fr. [92.146.77.7]) by mx.google.com with ESMTPS id bq19sm8729530wib.7.2013.04.03.05.15.47 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 03 Apr 2013 05:15:49 -0700 (PDT) From: Daniel Lezcano To: rjw@sisk.pl Cc: linux-pm@vger.kernel.org, patches@linaro.org, linaro-kernel@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux@arm.linux.org.uk, rnayak@ti.com, swarren@wwwdotorg.org, linux-tegra@vger.kernel.org, horms+renesas@verge.net.au, santosh.shilimkar@ti.com, arnd@arndb.de, lenb@kernel.org, nsekhar@ti.com, josephl@nvidia.com, deepthi@linux.vnet.ibm.com Subject: [PATCH 9/9] POWERPC: pseries: cpuidle: use time keeping flag Date: Wed, 3 Apr 2013 14:15:22 +0200 Message-Id: <1364991322-20585-9-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1364991322-20585-1-git-send-email-daniel.lezcano@linaro.org> References: <1364991322-20585-1-git-send-email-daniel.lezcano@linaro.org> X-Gm-Message-State: ALoCoQm0dElsb9sOjF1d0IOLIa2vpbaV67RxlHNmubFzxgEDQ+7iMZ+9ECQCrH6+2iMbTefD+KIV X-Original-Sender: daniel.lezcano@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c02::22d is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The current code computes the idle time but that can be handled by the cpuidle framework if we enable the .en_core_tk_irqen flag. Set the flag and remove the code related to the time computation. Signed-off-by: Daniel Lezcano Signed-off-by: Deepthi Dharwar --- arch/powerpc/platforms/pseries/processor_idle.c | 35 ++++++++++------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/arch/powerpc/platforms/pseries/processor_idle.c b/arch/powerpc/platforms/pseries/processor_idle.c index 4d806b4..a197120 100644 --- a/arch/powerpc/platforms/pseries/processor_idle.c +++ b/arch/powerpc/platforms/pseries/processor_idle.c @@ -23,8 +23,9 @@ #include "pseries.h" struct cpuidle_driver pseries_idle_driver = { - .name = "pseries_idle", - .owner = THIS_MODULE, + .name = "pseries_idle", + .owner = THIS_MODULE, + .en_core_tk_irqen = 1, }; #define MAX_IDLE_STATE_COUNT 2 @@ -33,10 +34,8 @@ static int max_idle_state = MAX_IDLE_STATE_COUNT - 1; static struct cpuidle_device __percpu *pseries_cpuidle_devices; static struct cpuidle_state *cpuidle_state_table; -static inline void idle_loop_prolog(unsigned long *in_purr, ktime_t *kt_before) +static inline void idle_loop_prolog(unsigned long *in_purr) { - - *kt_before = ktime_get(); *in_purr = mfspr(SPRN_PURR); /* * Indicate to the HV that we are idle. Now would be @@ -45,12 +44,10 @@ static inline void idle_loop_prolog(unsigned long *in_purr, ktime_t *kt_before) get_lppaca()->idle = 1; } -static inline s64 idle_loop_epilog(unsigned long in_purr, ktime_t kt_before) +static inline void idle_loop_epilog(unsigned long in_purr) { get_lppaca()->wait_state_cycles += mfspr(SPRN_PURR) - in_purr; get_lppaca()->idle = 0; - - return ktime_to_us(ktime_sub(ktime_get(), kt_before)); } static int snooze_loop(struct cpuidle_device *dev, @@ -58,10 +55,9 @@ static int snooze_loop(struct cpuidle_device *dev, int index) { unsigned long in_purr; - ktime_t kt_before; int cpu = dev->cpu; - idle_loop_prolog(&in_purr, &kt_before); + idle_loop_prolog(&in_purr); local_irq_enable(); set_thread_flag(TIF_POLLING_NRFLAG); @@ -75,8 +71,8 @@ static int snooze_loop(struct cpuidle_device *dev, clear_thread_flag(TIF_POLLING_NRFLAG); smp_mb(); - dev->last_residency = - (int)idle_loop_epilog(in_purr, kt_before); + idle_loop_epilog(in_purr); + return index; } @@ -102,9 +98,8 @@ static int dedicated_cede_loop(struct cpuidle_device *dev, int index) { unsigned long in_purr; - ktime_t kt_before; - idle_loop_prolog(&in_purr, &kt_before); + idle_loop_prolog(&in_purr); get_lppaca()->donate_dedicated_cpu = 1; ppc64_runlatch_off(); @@ -112,8 +107,9 @@ static int dedicated_cede_loop(struct cpuidle_device *dev, check_and_cede_processor(); get_lppaca()->donate_dedicated_cpu = 0; - dev->last_residency = - (int)idle_loop_epilog(in_purr, kt_before); + + idle_loop_epilog(in_purr); + return index; } @@ -122,9 +118,8 @@ static int shared_cede_loop(struct cpuidle_device *dev, int index) { unsigned long in_purr; - ktime_t kt_before; - idle_loop_prolog(&in_purr, &kt_before); + idle_loop_prolog(&in_purr); /* * Yield the processor to the hypervisor. We return if @@ -135,8 +130,8 @@ static int shared_cede_loop(struct cpuidle_device *dev, */ check_and_cede_processor(); - dev->last_residency = - (int)idle_loop_epilog(in_purr, kt_before); + idle_loop_epilog(in_purr); + return index; }