From patchwork Fri Oct 18 11:52:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 21127 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f199.google.com (mail-vc0-f199.google.com [209.85.220.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C573C246F1 for ; Fri, 18 Oct 2013 11:54:05 +0000 (UTC) Received: by mail-vc0-f199.google.com with SMTP id lf12sf1603224vcb.6 for ; Fri, 18 Oct 2013 04:54:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=mime-version:x-gm-message-state:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=6V+DCZV2bqSK3cas5w2f9oHVYFAij1HueTcpHNfHGY8=; b=WMrclIwSbJQVmdFDOIyCq0Kn10bSaL/QKRWXTl75145yO1TYhMH1xNQMibtulEJNzW piFMSFsyfot25oxdkGcvCDnbIzuY4TJY/Vd1i6oMThonn+n3BCwN/HStnqIDAQ5OXtXh mJBXG7l/FhfZBWk9FTAhQmyThmRPBS8CH9F+sbfYOnaBa2FRlNMv1klFl7VVgYUmAdmz IzWBQuOqz634Hlij50fQQ231wRkRIVedxUpB7eQWuc2L5gSgxhmALUZrj1cThDltTfdt 5/UUWOTLLIrW7Lr/IqL9hwwK6r/nUde9AQu5VULx9XRgg1cvcqvtWOsideA9P4F9oewT EvHA== X-Received: by 10.236.73.164 with SMTP id v24mr2268419yhd.24.1382097245544; Fri, 18 Oct 2013 04:54:05 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.71.209 with SMTP id x17ls1253600qeu.83.gmail; Fri, 18 Oct 2013 04:54:05 -0700 (PDT) X-Received: by 10.220.164.202 with SMTP id f10mr32516vcy.25.1382097245412; Fri, 18 Oct 2013 04:54:05 -0700 (PDT) Received: from mail-vc0-f177.google.com (mail-vc0-f177.google.com [209.85.220.177]) by mx.google.com with ESMTPS id qu3si228700vec.102.2013.10.18.04.54.05 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 18 Oct 2013 04:54:05 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.177 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.177; Received: by mail-vc0-f177.google.com with SMTP id ib11so286139vcb.22 for ; Fri, 18 Oct 2013 04:54:05 -0700 (PDT) X-Gm-Message-State: ALoCoQkQ+GV3dYD8lMPh4oOolInrqOmYpN0TSqUL/Iodbs/yR4Bv6yMGpiqo4RmDwfD3DSgznSTa X-Received: by 10.220.184.70 with SMTP id cj6mr66398vcb.23.1382097245334; Fri, 18 Oct 2013 04:54:05 -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.220.174.196 with SMTP id u4csp29499vcz; Fri, 18 Oct 2013 04:54:04 -0700 (PDT) X-Received: by 10.180.211.71 with SMTP id na7mr2608853wic.5.1382097244456; Fri, 18 Oct 2013 04:54:04 -0700 (PDT) Received: from mail-we0-f172.google.com (mail-we0-f172.google.com [74.125.82.172]) by mx.google.com with ESMTPS id hu4si419144wjb.92.2013.10.18.04.54.04 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 18 Oct 2013 04:54:04 -0700 (PDT) Received-SPF: neutral (google.com: 74.125.82.172 is neither permitted nor denied by best guess record for domain of vincent.guittot@linaro.org) client-ip=74.125.82.172; Received: by mail-we0-f172.google.com with SMTP id q58so3652231wes.3 for ; Fri, 18 Oct 2013 04:54:04 -0700 (PDT) X-Received: by 10.180.160.212 with SMTP id xm20mr2080699wib.23.1382097244019; Fri, 18 Oct 2013 04:54:04 -0700 (PDT) Received: from localhost.localdomain (LPuteaux-156-14-44-212.w82-127.abo.wanadoo.fr. [82.127.83.212]) by mx.google.com with ESMTPSA id lr3sm25000673wic.5.2013.10.18.04.54.02 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 18 Oct 2013 04:54:03 -0700 (PDT) From: Vincent Guittot To: linux-kernel@vger.kernel.org, peterz@infradead.org, mingo@kernel.org, pjt@google.com, Morten.Rasmussen@arm.com, cmetcalf@tilera.com, tony.luck@intel.com, alex.shi@intel.com, preeti@linux.vnet.ibm.com, linaro-kernel@lists.linaro.org Cc: rjw@sisk.pl, paulmck@linux.vnet.ibm.com, corbet@lwn.net, tglx@linutronix.de, len.brown@intel.com, arjan@linux.intel.com, amit.kucheria@linaro.org, l.majewski@samsung.com, Vincent Guittot Subject: [RFC][PATCH v5 14/14] cpuidle: set the current wake up latency Date: Fri, 18 Oct 2013 13:52:27 +0200 Message-Id: <1382097147-30088-14-git-send-email-vincent.guittot@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1382097147-30088-1-git-send-email-vincent.guittot@linaro.org> References: <1382097147-30088-1-git-send-email-vincent.guittot@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: vincent.guittot@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.177 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: , Save the current wake up latency of a core. This latency is not always the latency of a defined c-state but can also be an intermediate value when a core is ready to shutdown (timer migration, cache flush ...) but wait for the last core of the cluster to finalize the cluster power down. This latter use case is not manage by the current version of the patch because it implies that the cpuidle drivers set the wake up latency instead of the cpuidle core. Signed-off-by: Vincent Guittot Conflicts: drivers/cpuidle/cpuidle.c --- drivers/cpuidle/cpuidle.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c index d75040d..7b6553b 100644 --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include "cpuidle.h" @@ -42,6 +43,12 @@ void disable_cpuidle(void) off = 1; } +static void cpuidle_set_current_state(int cpu, int latency) +{ + struct sched_pm *stat = &per_cpu(sched_stat, cpu); + + atomic_set(&(stat->wake_latency), latency); +} /** * cpuidle_play_dead - cpu off-lining * @@ -79,12 +86,16 @@ int cpuidle_enter_state(struct cpuidle_device *dev, struct cpuidle_driver *drv, ktime_t time_start, time_end; s64 diff; + cpuidle_set_current_state(dev->cpu, target_state->exit_latency); + time_start = ktime_get(); entered_state = target_state->enter(dev, drv, index); time_end = ktime_get(); + cpuidle_set_current_state(dev->cpu, 0); + local_irq_enable(); diff = ktime_to_us(ktime_sub(time_end, time_start));