diff options
author | Deepthi Dharwar <deepthi@linux.vnet.ibm.com> | 2011-10-28 06:50:09 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2011-11-06 21:13:30 -0500 |
commit | e978aa7d7d57d04eb5f88a7507c4fb98577def77 (patch) | |
tree | d6d6dfe1dba4d4749c7eafe348351aa499c3c5eb /drivers/idle/intel_idle.c | |
parent | c3b92c8787367a8bb53d57d9789b558f1295cc96 (diff) |
cpuidle: Move dev->last_residency update to driver enter routine; remove dev->last_state
Cpuidle governor only suggests the state to enter using the
governor->select() interface, but allows the low level driver to
override the recommended state. The actual entered state
may be different because of software or hardware demotion. Software
demotion is done by the back-end cpuidle driver and can be accounted
correctly. Current cpuidle code uses last_state field to capture the
actual state entered and based on that updates the statistics for the
state entered.
Ideally the driver enter routine should update the counters,
and it should return the state actually entered rather than the time
spent there. The generic cpuidle code should simply handle where
the counters live in the sysfs namespace, not updating the counters.
Reference:
https://lkml.org/lkml/2011/3/25/52
Signed-off-by: Deepthi Dharwar <deepthi@linux.vnet.ibm.com>
Signed-off-by: Trinabh Gupta <g.trinabh@gmail.com>
Tested-by: Jean Pihet <j-pihet@ti.com>
Reviewed-by: Kevin Hilman <khilman@ti.com>
Acked-by: Arjan van de Ven <arjan@linux.intel.com>
Acked-by: Kevin Hilman <khilman@ti.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/idle/intel_idle.c')
-rw-r--r-- | drivers/idle/intel_idle.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c index a46dddf61078..a1c888d2216a 100644 --- a/drivers/idle/intel_idle.c +++ b/drivers/idle/intel_idle.c | |||
@@ -81,7 +81,7 @@ static unsigned int mwait_substates; | |||
81 | static unsigned int lapic_timer_reliable_states = (1 << 1); /* Default to only C1 */ | 81 | static unsigned int lapic_timer_reliable_states = (1 << 1); /* Default to only C1 */ |
82 | 82 | ||
83 | static struct cpuidle_device __percpu *intel_idle_cpuidle_devices; | 83 | static struct cpuidle_device __percpu *intel_idle_cpuidle_devices; |
84 | static int intel_idle(struct cpuidle_device *dev, struct cpuidle_state *state); | 84 | static int intel_idle(struct cpuidle_device *dev, int index); |
85 | 85 | ||
86 | static struct cpuidle_state *cpuidle_state_table; | 86 | static struct cpuidle_state *cpuidle_state_table; |
87 | 87 | ||
@@ -209,12 +209,13 @@ static struct cpuidle_state atom_cstates[MWAIT_MAX_NUM_CSTATES] = { | |||
209 | /** | 209 | /** |
210 | * intel_idle | 210 | * intel_idle |
211 | * @dev: cpuidle_device | 211 | * @dev: cpuidle_device |
212 | * @state: cpuidle state | 212 | * @index: index of cpuidle state |
213 | * | 213 | * |
214 | */ | 214 | */ |
215 | static int intel_idle(struct cpuidle_device *dev, struct cpuidle_state *state) | 215 | static int intel_idle(struct cpuidle_device *dev, int index) |
216 | { | 216 | { |
217 | unsigned long ecx = 1; /* break on interrupt flag */ | 217 | unsigned long ecx = 1; /* break on interrupt flag */ |
218 | struct cpuidle_state *state = &dev->states[index]; | ||
218 | unsigned long eax = (unsigned long)cpuidle_get_statedata(state); | 219 | unsigned long eax = (unsigned long)cpuidle_get_statedata(state); |
219 | unsigned int cstate; | 220 | unsigned int cstate; |
220 | ktime_t kt_before, kt_after; | 221 | ktime_t kt_before, kt_after; |
@@ -256,7 +257,10 @@ static int intel_idle(struct cpuidle_device *dev, struct cpuidle_state *state) | |||
256 | if (!(lapic_timer_reliable_states & (1 << (cstate)))) | 257 | if (!(lapic_timer_reliable_states & (1 << (cstate)))) |
257 | clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &cpu); | 258 | clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &cpu); |
258 | 259 | ||
259 | return usec_delta; | 260 | /* Update cpuidle counters */ |
261 | dev->last_residency = (int)usec_delta; | ||
262 | |||
263 | return index; | ||
260 | } | 264 | } |
261 | 265 | ||
262 | static void __setup_broadcast_timer(void *arg) | 266 | static void __setup_broadcast_timer(void *arg) |