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: 2386601 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id C9B183FD8C for ; Wed, 3 Apr 2013 12:15:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760829Ab3DCMPx (ORCPT ); Wed, 3 Apr 2013 08:15:53 -0400 Received: from mail-wi0-f171.google.com ([209.85.212.171]:41520 "EHLO mail-wi0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760764Ab3DCMPw (ORCPT ); Wed, 3 Apr 2013 08:15:52 -0400 Received: by mail-wi0-f171.google.com with SMTP id hn17so3547606wib.4 for ; Wed, 03 Apr 2013 05:15:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=w45ca/pS+8Oqw/LSfKyvNzT3vmrCbGOD7D7AQ4CEgWg=; b=FqtTHKmORaJlCGgI4fl1ZGcXne36LE6H5kTuTYmBxX2GIy58IAdPje3u6/PpgswCIj uqkvSp2tZutYYc/D6ihF6PCxE7G5jfpMTNwwxIIbrsF3MCd98YsHSa2QTjUgWMWBzvis Dqnm/3a5K53Qd+e9SfdMJl7JacTAE60S0Kpb5A42ZddNgLhpkTbZ0KwRSuqT+jzprU/Z Nd8wf20GObXAvDZzs7qJcabRjyI2LKoXN5Xcq77fF90CiISDhhByBVIwntYorVSDrKY2 3sghk+170fTlgt08jPivBMQ90h3ZqMThNotfpMbA9lkgflS7FnSqev7jG8YUmFSCVLir FI1w== 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: ALoCoQm1Do0YtbA4wSJYm4n0in1NSu0jNZlNAP1f69MqwJsxWzNMTkPg8CKg0b5kXP8/Q2QVLAi+ Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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 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; }