aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpuidle
diff options
context:
space:
mode:
authorPreeti U Murthy <preeti@linux.vnet.ibm.com>2014-02-07 03:06:52 -0500
committerThomas Gleixner <tglx@linutronix.de>2014-02-07 09:34:29 -0500
commitba8f20c2eb4158a443e9d6a909aee5010efa0c69 (patch)
tree9646e019095f28aaecf8d2a009a439f71504940e /drivers/cpuidle
parentda7e6f45c34d39186b72328bacc4dd86bff60e0a (diff)
cpuidle: Handle clockevents_notify(BROADCAST_ENTER) failure
Some archs set the CPUIDLE_FLAG_TIMER_STOP flag for idle states in which the local timers stop. The cpuidle_idle_call() currently handles such idle states by calling into the broadcast framework so as to wakeup CPUs at their next wakeup event. With the hrtimer mode of broadcast, the BROADCAST_ENTER call into the broadcast frameowork can fail for archs that do not have an external clock device to handle wakeups and the CPU in question has thus to be made the stand by CPU. This patch handles such cases by failing the call into cpuidle so that the arch can take some default action. The arch will certainly not enter a similar idle state because a failed cpuidle call will also implicitly indicate that the broadcast framework has not registered this CPU to be woken up. Hence we are safe if we fail the cpuidle call. In the process move the functions that trace idle statistics just before and after the entry and exit into idle states respectively. In other scenarios where the call to cpuidle fails, we end up not tracing idle entry and exit since a decision on an idle state could not be taken. Similarly when the call to broadcast framework fails, we skip tracing idle statistics because we are in no further position to take a decision on an alternative idle state to enter into. Signed-off-by: Preeti U Murthy <preeti@linux.vnet.ibm.com> Cc: deepthi@linux.vnet.ibm.com Cc: paulmck@linux.vnet.ibm.com Cc: fweisbec@gmail.com Cc: paulus@samba.org Cc: srivatsa.bhat@linux.vnet.ibm.com Cc: svaidy@linux.vnet.ibm.com Cc: peterz@infradead.org Cc: benh@kernel.crashing.org Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Cc: linuxppc-dev@lists.ozlabs.org Link: http://lkml.kernel.org/r/20140207080652.17187.66344.stgit@preeti.in.ibm.com Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'drivers/cpuidle')
-rw-r--r--drivers/cpuidle/cpuidle.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index a55e68f2cfc8..09d05ab262be 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -140,12 +140,14 @@ int cpuidle_idle_call(void)
140 return 0; 140 return 0;
141 } 141 }
142 142
143 trace_cpu_idle_rcuidle(next_state, dev->cpu);
144
145 broadcast = !!(drv->states[next_state].flags & CPUIDLE_FLAG_TIMER_STOP); 143 broadcast = !!(drv->states[next_state].flags & CPUIDLE_FLAG_TIMER_STOP);
146 144
147 if (broadcast) 145 if (broadcast &&
148 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &dev->cpu); 146 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &dev->cpu))
147 return -EBUSY;
148
149
150 trace_cpu_idle_rcuidle(next_state, dev->cpu);
149 151
150 if (cpuidle_state_is_coupled(dev, drv, next_state)) 152 if (cpuidle_state_is_coupled(dev, drv, next_state))
151 entered_state = cpuidle_enter_state_coupled(dev, drv, 153 entered_state = cpuidle_enter_state_coupled(dev, drv,
@@ -153,11 +155,11 @@ int cpuidle_idle_call(void)
153 else 155 else
154 entered_state = cpuidle_enter_state(dev, drv, next_state); 156 entered_state = cpuidle_enter_state(dev, drv, next_state);
155 157
158 trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, dev->cpu);
159
156 if (broadcast) 160 if (broadcast)
157 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &dev->cpu); 161 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &dev->cpu);
158 162
159 trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, dev->cpu);
160
161 /* give the governor an opportunity to reflect on the outcome */ 163 /* give the governor an opportunity to reflect on the outcome */
162 if (cpuidle_curr_governor->reflect) 164 if (cpuidle_curr_governor->reflect)
163 cpuidle_curr_governor->reflect(dev, entered_state); 165 cpuidle_curr_governor->reflect(dev, entered_state);