linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: daniel.lezcano@linaro.org (Daniel Lezcano)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC patch 01/11] cpuidle : handle clockevent notify from the cpuidle framework
Date: Fri, 15 Mar 2013 15:27:00 +0100	[thread overview]
Message-ID: <1363357630-22214-2-git-send-email-daniel.lezcano@linaro.org> (raw)
In-Reply-To: <1363357630-22214-1-git-send-email-daniel.lezcano@linaro.org>

When a cpu enters a deep idle state, the local timers are stopped and
the time framework falls back to the timer device used as a broadcast
timer.

The different cpuidle drivers are calling clockevents_notify ENTER/EXIT
when the idle state stops the local timer.

The proposed patch introduces a new flag CPUIDLE_FLAG_TIMER_STOP to let
the cpuidle framework to call clockevents_notify instead of duplicating
again and again these lines in all the cpuidle drivers.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 drivers/cpuidle/cpuidle.c |    9 +++++++++
 include/linux/cpuidle.h   |    1 +
 2 files changed, 10 insertions(+)

diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index eba6929..c500370 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -8,6 +8,7 @@
  * This code is licenced under the GPL.
  */
 
+#include <linux/clockchips.h>
 #include <linux/kernel.h>
 #include <linux/mutex.h>
 #include <linux/sched.h>
@@ -146,12 +147,20 @@ int cpuidle_idle_call(void)
 
 	trace_cpu_idle_rcuidle(next_state, dev->cpu);
 
+	if (drv->states[next_state].flags & CPUIDLE_FLAG_TIMER_STOP)
+		clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER,
+				   &dev->cpu);
+
 	if (cpuidle_state_is_coupled(dev, drv, next_state))
 		entered_state = cpuidle_enter_state_coupled(dev, drv,
 							    next_state);
 	else
 		entered_state = cpuidle_enter_state(dev, drv, next_state);
 
+	if (drv->states[next_state].flags & CPUIDLE_FLAG_TIMER_STOP)
+		clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT,
+				   &dev->cpu);
+
 	trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, dev->cpu);
 
 	/* give the governor an opportunity to reflect on the outcome */
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index 480c14d..a837b33 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -57,6 +57,7 @@ struct cpuidle_state {
 /* Idle State Flags */
 #define CPUIDLE_FLAG_TIME_VALID	(0x01) /* is residency time measurable? */
 #define CPUIDLE_FLAG_COUPLED	(0x02) /* state applies to multiple cpus */
+#define CPUIDLE_FLAG_TIMER_STOP (0x04)  /* timer is stopped on this state */
 
 #define CPUIDLE_DRIVER_FLAGS_MASK (0xFFFF0000)
 
-- 
1.7.9.5

  reply	other threads:[~2013-03-15 14:27 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-15 14:26 [RFC patch 00/11] cpuidle : ARM driver to rule them all Daniel Lezcano
2013-03-15 14:27 ` Daniel Lezcano [this message]
2013-03-15 14:27 ` [RFC patch 02/11] cpuidle / arm : a single cpuidle driver Daniel Lezcano
2013-03-15 14:47   ` Arnd Bergmann
2013-03-15 15:07     ` Daniel Lezcano
2013-03-25 18:27       ` Catalin Marinas
2013-03-25 18:35         ` Daniel Lezcano
2013-03-26  4:31   ` Santosh Shilimkar
2013-03-26 10:58     ` Daniel Lezcano
2013-03-26 11:17       ` Andrew Lunn
2013-03-26 11:44         ` Daniel Lezcano
2013-03-26 23:27           ` Rafael J. Wysocki
2013-03-15 14:27 ` [RFC patch 03/11] cpuidle / ux500 : use common ARM " Daniel Lezcano
2013-03-15 14:27 ` [RFC patch 04/11] cpuidle / omap3 " Daniel Lezcano
2013-03-15 14:27 ` [RFC patch 05/11] cpuidle / davinci : use common ARM driver Daniel Lezcano
2013-03-15 14:27 ` [RFC patch 06/11] cpuidle / at91 : use common ARM cpuidle driver Daniel Lezcano
2013-03-15 14:27 ` [RFC patch 07/11] cpuidle / shmobile " Daniel Lezcano
2013-03-15 14:27 ` [RFC patch 08/11] cpuidle / imx " Daniel Lezcano
2013-03-15 14:27 ` [RFC patch 09/11] cpuidle / s3c64xx " Daniel Lezcano
2013-03-15 14:27 ` [RFC patch 10/11] cpuidle / calxeda " Daniel Lezcano
2013-03-15 14:27 ` [RFC patch 11/11] cpuidle / kirkwood " Daniel Lezcano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1363357630-22214-2-git-send-email-daniel.lezcano@linaro.org \
    --to=daniel.lezcano@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).