Skip to contentSkip to conversation

PM : cpuidle - Update statistics for correct state

PATCH Superseded Sanjeev Premi 1 participant 2 messages Mar 7, 2009

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PM : cpuidle - Update statistics for correct state

When 'enable_off_mode' is 0, and (mpu_state < PWRDM_POWER_RET) the local variables mpu_state and core_state are modified; but the usage count for the original state selected by the governor are updated.

This patch updates the 'last_state' in the cpuidle driver to ensure that statistics for the correct state are updated.

---
 arch/arm/mach-omap2/cpuidle34xx.c |   25 +++++++++++++++++--------
 1 files changed, 17 insertions(+), 8 deletions(-)
arch/arm/mach-omap2/cpuidle34xx.c +17 -8
index 62fbb2e..5838838 100644
@@ -76,23 +76,32 @@ static int omap3_enter_idle(struct cpuidle_device *dev,
 {
 	struct omap3_processor_cx *cx = cpuidle_get_statedata(state);
 	struct timespec ts_preidle, ts_postidle, ts_idle;
-	u32 mpu_state = cx->mpu_state, core_state = cx->core_state;
+	u32 mpu_state, core_state;
 
 	current_cx_state = *cx;
 
 	/* Used to keep track of the total time in idle */
 	getnstimeofday(&ts_preidle);
 
-	local_irq_disable();
-	local_fiq_disable();
-
+	/*
+	 * Adjust the idle state (if required).
+	 * Also, ensure that usage statistics of correct state are updated.
+	 */
 	if (!enable_off_mode) {
-		if (mpu_state < PWRDM_POWER_RET)
-			mpu_state = PWRDM_POWER_RET;
-		if (core_state < PWRDM_POWER_RET)
-			core_state = PWRDM_POWER_RET;
+		if (cx->type > OMAP3_STATE_C4) {
+			state = &(dev->states[OMAP3_STATE_C4 - 1]);
+			dev->last_state = state ;
+
+			cx = cpuidle_get_statedata(state);
+		}
 	}
 
+	mpu_state = cx->mpu_state;
+	core_state = cx->core_state;
+
+	local_irq_disable();
+	local_fiq_disable();
+
 	pwrdm_set_next_pwrst(mpu_pd, mpu_state);
 	pwrdm_set_next_pwrst(core_pd, core_state);
 
Signature · 1 line
1.5.6
#1 lore raw

Sorry, missed to included a minor change. Sending updated patch in next mail.

Best regards,
Sanjeev

Quoted 71 lines

-----Original Message-----
From: Premi, Sanjeev
Sent: Sunday, March 08, 2009 12:44 AM
To: [email protected]
Cc: Premi, Sanjeev
Subject: [PATCH] PM : cpuidle - Update statistics for correct state

When 'enable_off_mode' is 0, and (mpu_state < PWRDM_POWER_RET) the local variables mpu_state and core_state are modified; but the usage count for the original state selected by the governor are updated.

This patch updates the 'last_state' in the cpuidle driver to ensure that statistics for the correct state are updated.

---
 arch/arm/mach-omap2/cpuidle34xx.c |   25 +++++++++++++++++--------
 1 files changed, 17 insertions(+), 8 deletions(-)
arch/arm/mach-omap2/cpuidle34xx.c +4 -4
index 62fbb2e..5838838 100644
@@ -76,23 +76,32 @@ static int omap3_enter_idle(struct 
 cpuidle_device *dev,  {
 	struct omap3_processor_cx *cx = cpuidle_get_statedata(state);
 	struct timespec ts_preidle, ts_postidle, ts_idle;
-	u32 mpu_state = cx->mpu_state, core_state = cx->core_state;
+	u32 mpu_state, core_state;
 
 	current_cx_state = *cx;
 
 	/* Used to keep track of the total time in idle */
 	getnstimeofday(&ts_preidle);
 
-	local_irq_disable();
-	local_fiq_disable();
-
+	/*
+	 * Adjust the idle state (if required).
+	 * Also, ensure that usage statistics of correct state 

are updated.

arch/arm/mach-omap2/cpuidle34xx.c +13 -5
+	 */
 	if (!enable_off_mode) {
-		if (mpu_state < PWRDM_POWER_RET)
-			mpu_state = PWRDM_POWER_RET;
-		if (core_state < PWRDM_POWER_RET)
-			core_state = PWRDM_POWER_RET;
+		if (cx->type > OMAP3_STATE_C4) {
+			state = &(dev->states[OMAP3_STATE_C4 - 1]);
+			dev->last_state = state ;
+
+			cx = cpuidle_get_statedata(state);
+		}
 	}
 
+	mpu_state = cx->mpu_state;
+	core_state = cx->core_state;
+
+	local_irq_disable();
+	local_fiq_disable();
+
 	pwrdm_set_next_pwrst(mpu_pd, mpu_state);
 	pwrdm_set_next_pwrst(core_pd, core_state);
 
--

1.5.6