PM : cpuidle - Update statistics for correct state
PATCH v2 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 | 29 +++++++++++++++++++---------- 1 files changed, 19 insertions(+), 10 deletions(-)
arch/arm/mach-omap2/cpuidle34xx.c +19 -10
@@ -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; - - current_cx_state = *cx; +u32 mpu_state, core_state;/* 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); + } } + current_cx_state = *cx; + + 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
Quoted 36 lines · ext Sanjeev Premi
When '
enable_off_mode' is 0, and (mpu_state<PWRDM_POWER_RET) the local variablesmpu_stateandcore_stateare 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.Signed-off-by Sanjeev Premi <[email protected]>--- arch/arm/mach-omap2/cpuidle34xx.c | 29 +++++++++++++++++++---------- 1 files changed, 19 insertions(+), 10 deletions(-)arch/arm/mach-omap2/cpuidle34xx.c +5
-6@@ -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; - - current_cx_state = *cx; +u32 mpu_state, core_state;/* 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 static int omap3_enter_idle(struct cpuidle_device *dev, · line 93
Quoted 10 lines
arch/arm/mach-omap2/cpuidle34xx.c +5
-4if (!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);
There is still C3 where OFF is used for MPU. This needs to be taken into account.
Quoted 21 lines
arch/arm/mach-omap2/cpuidle34xx.c +9
-0+ } } + current_cx_state = *cx; + + 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 · 6 lines
1.5.6 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 5 lines
Jouni Högander -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 49 lines
-----Original Message-----
From: Högander Jouni [mailto:[email protected]]
Sent: Monday, March 09, 2009 3:38 PM
To: Premi, Sanjeev
Cc: [email protected]
Subject: Re: [PATCHv2] PM : cpuidle - Update statistics for correct stateQuoted 2 lines · ext Sanjeev Premi
When '
enable_off_mode' is 0, and (mpu_state<PWRDM_POWER_RET) the local variablesmpu_stateandcore_stateare modified; butthe usage
Quoted 8 lines
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.Signed-off-by Sanjeev Premi <[email protected]>--- arch/arm/mach-omap2/cpuidle34xx.c | 29+++++++++++++++++++----------
arch/arm/mach-omap2/cpuidle34xx.c static int omap3_enter_idle(struct
Quoted 8 lines
1 files changed, 19 insertions(+), 10 deletions(-)arch/arm/mach-omap2/cpuidle34xx.c +0
-0@@ -76,23 +76,32 @@ static int omap3_enter_idle(struct
cpuidle_deviceQuoted 7 lines
arch/arm/mach-omap2/cpuidle34xx.c +1
-3*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; - - current_cx_state = *cx; +u32 mpu_state, core_state;arch/arm/mach-omap2/cpuidle34xx.c static int omap3_enter_idle(struct cpuidle_device *dev,
Quoted 10 lines
arch/arm/mach-omap2/cpuidle34xx.c +3
-3/* 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.
Quoted 14 lines
arch/arm/mach-omap2/cpuidle34xx.c static int omap3_enter_idle(struct cpuidle_device *dev, · line 93
Quoted 11 lines
arch/arm/mach-omap2/cpuidle34xx.c +6
-4+*/ 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);There is still C3 where OFF is used for MPU. This needs to be taken into account.
[sp] Thanks. Good catch!
I wasn't happy doing the "OMAP3_STATEn - 1"; but could not find a better way. It should be C2 as defined now.
On another note, would it make sense to swap the definitions for C3 and C4. C3 : MPU CSWR + CORE CSWR
C4 : MPU OFF + CORE Actove
Quoted 21 lines
Quoted 18 lines
arch/arm/mach-omap2/cpuidle34xx.c +9
-1+ } } + current_cx_state = *cx; + + 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
Quoted 2 lines
--
To unsubscribe from this list: send the line "unsubscribelinux-omap"
Quoted 8 lines
Quoted 1 line
in the body of a message to [email protected] More
majordomo
Quoted 1 line
--
Jouni Högander--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 64 lines · Sanjeev
Quoted 49 lines
-----Original Message-----
From: Högander Jouni [mailto:[email protected]]
Sent: Monday, March 09, 2009 3:38 PM
To: Premi, Sanjeev
Cc: [email protected]
Subject: Re: [PATCHv2] PM : cpuidle - Update statistics for correct stateQuoted 2 lines · ext Sanjeev Premi
When '
enable_off_mode' is 0, and (mpu_state<PWRDM_POWER_RET) the local variablesmpu_stateandcore_stateare modified; butthe usage
Quoted 8 lines
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.Signed-off-by Sanjeev Premi <[email protected]>--- arch/arm/mach-omap2/cpuidle34xx.c | 29+++++++++++++++++++----------
arch/arm/mach-omap2/cpuidle34xx.c static int omap3_enter_idle(struct
Quoted 8 lines
1 files changed, 19 insertions(+), 10 deletions(-)arch/arm/mach-omap2/cpuidle34xx.c +0
-0@@ -76,23 +76,32 @@ static int omap3_enter_idle(struct
cpuidle_deviceQuoted 7 lines
arch/arm/mach-omap2/cpuidle34xx.c +1
-3*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; - - current_cx_state = *cx; +u32 mpu_state, core_state;arch/arm/mach-omap2/cpuidle34xx.c static int omap3_enter_idle(struct cpuidle_device *dev,
Quoted 10 lines
arch/arm/mach-omap2/cpuidle34xx.c +3
-3/* 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.
Quoted 14 lines
arch/arm/mach-omap2/cpuidle34xx.c static int omap3_enter_idle(struct cpuidle_device *dev, · line 93
Quoted 11 lines
arch/arm/mach-omap2/cpuidle34xx.c +6
-4+*/ 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);There is still C3 where OFF is used for MPU. This needs to be taken into account.
Quoted 3 lines
[sp] Thanks. Good catch!
I wasn't happy doing the "OMAP3_STATEn- 1"; but could not find a better way. It should be C2 as defined now.
This means C4 is not used if off mode is not enabled? I think this is not wanted. Would it be possible to remove "OFF" C states when enable_off_mode is written to 0 and add them back when 1 written?
Quoted 4 lines
On another note, would it make sense to swap the definitions for C3 and C4. C3 : MPU CSWR + CORE CSWR
C4 : MPU OFF + CORE Actove
No it doesn't. They are organized by latency.
One grounding for current implementation is that enable_off_mode is more or less testing interface. In final solution it might be even removed. Adjusting states directly still shows guite accurate information on used C-states.
Quoted 30 lines
Quoted 30 lines
Quoted 19 lines
arch/arm/mach-omap2/cpuidle34xx.c +9
-1+ } } + current_cx_state = *cx; + + 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
Quoted 2 lines
--
To unsubscribe from this list: send the line "unsubscribelinux-omap"
Quoted 1 line
in the body of a message to [email protected] More
majordomo
Quoted 1 line
--
Jouni Högander
Signature · 5 lines
Jouni Högander -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 86 lines
-----Original Message-----
From: Högander Jouni [mailto:[email protected]]
Sent: Monday, March 09, 2009 4:07 PM
To: Premi, Sanjeev
Cc: [email protected]
Subject: Re: [PATCHv2] PM : cpuidle - Update statistics for correct stateQuoted 6 lines · Sanjeev
Quoted 6 lines
-----Original Message-----
From: Högander Jouni [mailto:[email protected]]
Sent: Monday, March 09, 2009 3:38 PM
To: Premi, Sanjeev
Cc: [email protected]
Subject: Re: [PATCHv2] PM : cpuidle - Update statisticsfor correct
Quoted 5 lines
Quoted 5 lines
state
Quoted 1 line · ext Sanjeev Premi
When '
enable_off_mode' is 0, and (mpu_state<
PWRDM_POWER_RET) theQuoted 3 lines
Quoted 3 lines
Quoted 1 line
local variables
mpu_stateandcore_stateare modified; butthe usage
Quoted 1 line
count for the original state selected by the governor
are updated.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
This patch updates the '
last_state' in the cpuidledriver to ensure
Quoted 15 lines
Quoted 15 lines
Quoted 5 lines
that statistics for the correct state are updated.
Signed-off-by Sanjeev Premi <[email protected]>--- arch/arm/mach-omap2/cpuidle34xx.c | 29+++++++++++++++++++----------
arch/arm/mach-omap2/cpuidle34xx.c static int omap3_enter_idle(struct
Quoted 8 lines
1 files changed, 19 insertions(+), 10 deletions(-)arch/arm/mach-omap2/cpuidle34xx.c +0
-0@@ -76,23 +76,32 @@ static int omap3_enter_idle(struct
cpuidle_deviceQuoted 2 lines
Quoted 2 lines
arch/arm/mach-omap2/cpuidle34xx.c static int omap3_enter_idle(struct · line 77
Quoted 2 lines
arch/arm/mach-omap2/cpuidle34xx.c +0
-0*dev, { struct omap3_processor_cx *cx =
cpuidle_get_statedata(state);Quoted 2 lines
Quoted 2 lines
arch/arm/mach-omap2/cpuidle34xx.c static int omap3_enter_idle(struct · line 79
Quoted 2 lines
arch/arm/mach-omap2/cpuidle34xx.c +0
-1struct timespec ts_preidle, ts_postidle, ts_idle; - u32 mpu_state = cx->mpu_state, core_state =
cx->core_state;Quoted 14 lines
Quoted 14 lines
arch/arm/mach-omap2/cpuidle34xx.c static int omap3_enter_idle(struct cpuidle_device *dev,
Quoted 13 lines
arch/arm/mach-omap2/cpuidle34xx.c +4
-5- - current_cx_state = *cx; +u32 mpu_state, core_state;/* 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.
Quoted 8 lines
Quoted 8 lines
arch/arm/mach-omap2/cpuidle34xx.c static int omap3_enter_idle(struct cpuidle_device *dev,
Quoted 8 lines
arch/arm/mach-omap2/cpuidle34xx.c +3
-4+*/ 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]);
Quoted 5 lines
Quoted 5 lines
arch/arm/mach-omap2/cpuidle34xx.c static int omap3_enter_idle(struct cpuidle_device *dev, · line 93
Quoted 3 lines
arch/arm/mach-omap2/cpuidle34xx.c +3
-0+ dev->last_state = state ; + + cx =cpuidle_get_statedata (state);There is still C3 where OFF is used for MPU. This needs to
be taken
Quoted 4 lines
Quoted 1 line
into account.
[sp] Thanks. Good catch!
I wasn't happy doing the "OMAP3_STATEn- 1"; but could
Quoted 7 lines
not find a better way.
Quoted 1 line
It should be C2 as defined now.
This means C4 is not used if off mode is not enabled? I think this is not wanted. Would it be possible to remove "OFF" C states when
enable_off_modeis written to 0 and add them back when 1 written?
[sp] That should be possible. We could use the 'valid' field
for the purpose.
Quoted 7 lines
Quoted 2 lines
On another note, would it make sense to swap the
definitions for C3 and C4.
Quoted 2 lines
C3 : MPU CSWR + CORE CSWR
C4 : MPU OFF + CORE ActoveNo it doesn't. They are organized by latency.
[sp] Okay. That was a loud thinking from my side :)
Quoted 37 lines
One grounding for current implementation is that
enable_off_modeis more or less testing interface. In final solution it might be even removed. Adjusting states directly still shows guite accurate information on used C-states.Quoted 22 lines
Quoted 22 lines
Quoted 19 lines
arch/arm/mach-omap2/cpuidle34xx.c +9
-1+ } } + current_cx_state = *cx; + + 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
Quoted 2 lines
--
To unsubscribe from this list: send the line "unsubscribelinux-omap"
Quoted 8 lines
Quoted 8 lines
Quoted 1 line
in the body of a message to [email protected] More
majordomo
Quoted 1 line
--
Jouni Högander
Quoted 4 lines
--
Jouni Högander--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 89 lines · Sanjeev
Quoted 89 lines
-----Original Message-----
From: Högander Jouni [mailto:[email protected]]
Sent: Monday, March 09, 2009 4:07 PM
To: Premi, Sanjeev
Cc: [email protected]
Subject: Re: [PATCHv2] PM : cpuidle - Update statistics for correct stateQuoted 6 lines · Sanjeev
Quoted 6 lines
-----Original Message-----
From: Högander Jouni [mailto:[email protected]]
Sent: Monday, March 09, 2009 3:38 PM
To: Premi, Sanjeev
Cc: [email protected]
Subject: Re: [PATCHv2] PM : cpuidle - Update statisticsfor correct
Quoted 5 lines
Quoted 5 lines
state
Quoted 1 line · ext Sanjeev Premi
When '
enable_off_mode' is 0, and (mpu_state<
PWRDM_POWER_RET) theQuoted 3 lines
Quoted 3 lines
Quoted 1 line
local variables
mpu_stateandcore_stateare modified; butthe usage
Quoted 1 line
count for the original state selected by the governor
are updated.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
This patch updates the '
last_state' in the cpuidledriver to ensure
Quoted 15 lines
Quoted 15 lines
Quoted 5 lines
that statistics for the correct state are updated.
Signed-off-by Sanjeev Premi <[email protected]>--- arch/arm/mach-omap2/cpuidle34xx.c | 29+++++++++++++++++++----------
arch/arm/mach-omap2/cpuidle34xx.c static int omap3_enter_idle(struct
Quoted 8 lines
1 files changed, 19 insertions(+), 10 deletions(-)arch/arm/mach-omap2/cpuidle34xx.c +0
-0@@ -76,23 +76,32 @@ static int omap3_enter_idle(struct
cpuidle_deviceQuoted 2 lines
Quoted 2 lines
arch/arm/mach-omap2/cpuidle34xx.c static int omap3_enter_idle(struct · line 77
Quoted 2 lines
arch/arm/mach-omap2/cpuidle34xx.c +0
-0*dev, { struct omap3_processor_cx *cx =
cpuidle_get_statedata(state);Quoted 2 lines
Quoted 2 lines
arch/arm/mach-omap2/cpuidle34xx.c static int omap3_enter_idle(struct · line 79
Quoted 2 lines
arch/arm/mach-omap2/cpuidle34xx.c +0
-1struct timespec ts_preidle, ts_postidle, ts_idle; - u32 mpu_state = cx->mpu_state, core_state =
cx->core_state;Quoted 14 lines
Quoted 14 lines
arch/arm/mach-omap2/cpuidle34xx.c static int omap3_enter_idle(struct cpuidle_device *dev,
Quoted 13 lines
arch/arm/mach-omap2/cpuidle34xx.c +4
-5- - current_cx_state = *cx; +u32 mpu_state, core_state;/* 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.
Quoted 8 lines
Quoted 8 lines
arch/arm/mach-omap2/cpuidle34xx.c static int omap3_enter_idle(struct cpuidle_device *dev,
Quoted 8 lines
arch/arm/mach-omap2/cpuidle34xx.c +3
-4+*/ 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]);
Quoted 5 lines
Quoted 5 lines
arch/arm/mach-omap2/cpuidle34xx.c static int omap3_enter_idle(struct cpuidle_device *dev, · line 93
Quoted 3 lines
arch/arm/mach-omap2/cpuidle34xx.c +3
-0+ dev->last_state = state ; + + cx =cpuidle_get_statedata (state);There is still C3 where OFF is used for MPU. This needs to
be taken
Quoted 4 lines
Quoted 1 line
into account.
[sp] Thanks. Good catch!
I wasn't happy doing the "OMAP3_STATEn- 1"; but couldnot find a better way.
Quoted 1 line
It should be C2 as defined now.
Quoted 7 lines
Quoted 4 lines
This means C4 is not used if off mode is not enabled? I think this is not wanted. Would it be possible to remove "OFF" C states when
enable_off_modeis written to 0 and add them back when 1 written?[sp] That should be possible. We could use the 'valid' field
for the purpose.
I would gladly take a patch which uses the 'valid' field for this and then the enter hook whould drop to the next lower valid state if the state requested is not valid.
Kevin
Quoted 47 lines
Quoted 8 lines
Quoted 3 lines
On another note, would it make sense to swap the
definitions for C3 and C4.
Quoted 2 lines
C3 : MPU CSWR + CORE CSWR
C4 : MPU OFF + CORE ActoveNo it doesn't. They are organized by latency.
[sp] Okay. That was a loud thinking from my side :)
Quoted 37 lines
One grounding for current implementation is that
enable_off_modeis more or less testing interface. In final solution it might be even removed. Adjusting states directly still shows guite accurate information on used C-states.Quoted 30 lines
Quoted 30 lines
Quoted 19 lines
arch/arm/mach-omap2/cpuidle34xx.c +9
-1+ } } + current_cx_state = *cx; + + 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
Quoted 2 lines
--
To unsubscribe from this list: send the line "unsubscribelinux-omap"
Quoted 1 line
in the body of a message to [email protected] More
majordomo
Quoted 1 line
--
Jouni Högander
Quoted 7 lines
Quoted 4 lines
--
Jouni Högander--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 105 lines
-----Original Message-----
From: Kevin Hilman [mailto:[email protected]]
Sent: Monday, March 09, 2009 11:31 PM
To: Premi, Sanjeev
Cc: Högander Jouni; [email protected]
Subject: Re: [PATCHv2] PM : cpuidle - Update statistics for correct stateQuoted 8 lines · Sanjeev
Quoted 8 lines
-----Original Message-----
From: Högander Jouni [mailto:[email protected]]
Sent: Monday, March 09, 2009 4:07 PM
To: Premi, Sanjeev
Cc: [email protected]
Subject: Re: [PATCHv2] PM : cpuidle - Update statisticsfor correct
Quoted 74 lines
Quoted 74 lines
state
Quoted 6 lines · Sanjeev
Quoted 6 lines
-----Original Message-----
From: Högander Jouni [mailto:[email protected]]
Sent: Monday, March 09, 2009 3:38 PM
To: Premi, Sanjeev
Cc: [email protected]
Subject: Re: [PATCHv2] PM : cpuidle - Update statisticsfor correct
Quoted 5 lines
Quoted 5 lines
state
Quoted 1 line · ext Sanjeev Premi
When '
enable_off_mode' is 0, and (mpu_state<
PWRDM_POWER_RET) theQuoted 3 lines
Quoted 3 lines
Quoted 1 line
local variables
mpu_stateandcore_stateare modified; butthe usage
Quoted 1 line
count for the original state selected by the governor
are updated.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
This patch updates the '
last_state' in the cpuidledriver to ensure
Quoted 15 lines
Quoted 15 lines
Quoted 5 lines
that statistics for the correct state are updated.
Signed-off-by Sanjeev Premi <[email protected]>--- arch/arm/mach-omap2/cpuidle34xx.c | 29+++++++++++++++++++----------
arch/arm/mach-omap2/cpuidle34xx.c static int omap3_enter_idle(struct
Quoted 8 lines
1 files changed, 19 insertions(+), 10 deletions(-)arch/arm/mach-omap2/cpuidle34xx.c +0
-0@@ -76,23 +76,32 @@ static int omap3_enter_idle(struct
cpuidle_deviceQuoted 2 lines
Quoted 2 lines
arch/arm/mach-omap2/cpuidle34xx.c static int omap3_enter_idle(struct · line 77
Quoted 2 lines
arch/arm/mach-omap2/cpuidle34xx.c +0
-0*dev, { struct omap3_processor_cx *cx =
cpuidle_get_statedata(state);Quoted 2 lines
Quoted 2 lines
arch/arm/mach-omap2/cpuidle34xx.c static int omap3_enter_idle(struct · line 79
Quoted 2 lines
arch/arm/mach-omap2/cpuidle34xx.c +0
-1struct timespec ts_preidle, ts_postidle, ts_idle; - u32 mpu_state = cx->mpu_state, core_state =
cx->core_state;Quoted 14 lines
Quoted 14 lines
arch/arm/mach-omap2/cpuidle34xx.c static int omap3_enter_idle(struct · line 86
Quoted 13 lines
arch/arm/mach-omap2/cpuidle34xx.c +4
-5- - current_cx_state = *cx; +u32 mpu_state, core_state;/* 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.
Quoted 8 lines
Quoted 8 lines
arch/arm/mach-omap2/cpuidle34xx.c static int omap3_enter_idle(struct · line 90
Quoted 8 lines
arch/arm/mach-omap2/cpuidle34xx.c +3
-4+*/ 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]);
Quoted 5 lines
Quoted 5 lines
arch/arm/mach-omap2/cpuidle34xx.c static int omap3_enter_idle(struct · line 93
Quoted 3 lines
arch/arm/mach-omap2/cpuidle34xx.c +3
-0+ dev->last_state = state ; + + cx =cpuidle_get_statedata (state);There is still C3 where OFF is used for MPU. This needs to
be taken
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
into account.
[sp] Thanks. Good catch!
I wasn't happy doing the "OMAP3_STATEn- 1"; but couldnot find a better way.
Quoted 1 line
It should be C2 as defined now.
This means C4 is not used if off mode is not enabled? I
think this is
Quoted 3 lines
Quoted 2 lines
not wanted. Would it be possible to remove "OFF" C states when
enable_off_modeis written to 0 and add them back when 1 written?
Quoted 8 lines
Quoted 2 lines
[sp] That should be possible. We could use the 'valid' field
for the purpose.I would gladly take a patch which uses the 'valid' field for this and then the enter hook whould drop to the next lower valid state if the state requested is not valid.
Kevin
[sp] I have not yet tested it (working offline for sometime).
But, wanted to share the changes for an early review.
Initially, I was trying see if the CPUIDLE framework could use ".valid" as an additional argument in cpuidle_state. But, may be that's for later...
arch/arm/mach-omap2/cpuidle34xx.c +31 -0
@@ -88,16 +88,19 @@ static int omap3_enter_idle(struct cpuidle_device *dev, goto return_sleep_time;/* +* Check if the chosen idle state is valid. +* If no, drop down to a lower valid state. Expects the lowest +* state will always be active. */ +if (!cx->valid) { +for (idx = (cx->type -1 ); idx ==1 ; idx--) { +if (omap3_power_states[idx].valid) +break ; } + state = &(dev->states[idx]); + dev->last_state = state ; + + cx =cpuidle_get_statedata (state); } current_cx_state = *cx;
@@ -150,6 +153,26 @@ static int omap3_enter_idle_bm(struct cpuidle_device *dev,return omap3_enter_idle (dev, new_state); } +/** +* omap3_toggle_off_states - Enable / Disable validity of idle states +* @flag: Enable/ Disable support for OFF mode +* +* Called as result of change to "enable_off_mode". +*/ +void omap3_toggle_off_states (unsigned short flag) +{ +if (flag) { + omap3_power_states[OMAP3_STATE_C3 ].valid =1 ; + omap3_power_states[OMAP3_STATE_C5 ].valid =1 ; + omap3_power_states[OMAP3_STATE_C6 ].valid =1 ; + } +else { + omap3_power_states[OMAP3_STATE_C3 ].valid =0 ; + omap3_power_states[OMAP3_STATE_C5 ].valid =0 ; + omap3_power_states[OMAP3_STATE_C6 ].valid =0 ; + } +} + DEFINE_PER_CPU(struct cpuidle_device, omap3_idle_dev);/* omap3_init_power_states - Initialises the OMAP3 specific C states.
arch/arm/mach-omap2/pm.c +4 -0
@@ -47,6 +47,8 @@ atomic_t sleep_block = ATOMIC_INIT(0);static int vdd1_locked;static int vdd2_locked; +extern void omap3_toggle_off_states (unsigned short ); +static ssize_t idle_show (struct kobject *,struct kobj_attribute *,char *);static ssize_t idle_store (struct kobject *k,struct kobj_attribute *,const char *buf,size_t n);
@@ -112,6 +114,8 @@ static ssize_t idle_store(struct kobject *kobj, struct kobj_ }else if (attr == &enable_off_mode_attr) { enable_off_mode = value;omap3_pm_off_mode_enable (enable_off_mode); +if (cpu_is_omap34xx ()) +omap3_toggle_off_states (value); }else if (attr == &voltage_off_while_idle_attr) { voltage_off_while_idle = value;if (voltage_off_while_idle)
Quoted 53 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 10 lines
Quoted 6 lines
Quoted 1 line
On another note, would it make sense to swap the
definitions for C3 and C4.
Quoted 2 lines
C3 : MPU CSWR + CORE CSWR
C4 : MPU OFF + CORE ActoveNo it doesn't. They are organized by latency.
[sp] Okay. That was a loud thinking from my side :)
Quoted 2 lines
One grounding for current implementation is that
enable_off_modeisQuoted 38 lines
Quoted 38 lines
more or less testing interface. In final solution it might be even removed. Adjusting states directly still shows guite accurate information on used C-states.
Quoted 22 lines
Quoted 22 lines
Quoted 19 lines
arch/arm/mach-omap2/cpuidle34xx.c +9
-1+ } } + current_cx_state = *cx; + + 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
Quoted 2 lines
--
To unsubscribe from this list: send the line "unsubscribelinux-omap"
Quoted 8 lines
Quoted 8 lines
Quoted 1 line
in the body of a message to [email protected] More
majordomo
Quoted 1 line
--
Jouni Högander--
Jouni Högander
Quoted 8 lines
Quoted 2 lines
Quoted 1 line
--
To unsubscribe from this list: send the line "unsubscribe
linux-omap"
Quoted 1 line
in the body of a message to [email protected] More
majordomo
Quoted 1 line
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 9 lines · Sanjeev
Quoted 6 lines
I would gladly take a patch which uses the 'valid' field for this and then the enter hook whould drop to the next lower valid state if the state requested is not valid.
Kevin
[sp] I have not yet tested it (working offline for sometime).
But, wanted to share the changes for an early review.
Thanks, some comments below.
Quoted 3 lines
Initially, I was trying see if the CPUIDLE framework could use ".valid" as an additional argument in
cpuidle_state. But, may be that's for later...
Yeah, I looked at that too, but it currently doesn't have a concept of valid states, so for now I recommend we implement that in the OMAP-specific code as you have done.
Quoted 5 lines
arch/arm/mach-omap2/cpuidle34xx.c +0
-0
arch/arm/mach-omap2/cpuidle34xx.c static int omap3_enter_idle(struct cpuidle_device *dev, · line 96
Quoted 9 lines
arch/arm/mach-omap2/cpuidle34xx.c +5
-0@@ -88,16 +88,19 @@ static int omap3_enter_idle(struct cpuidle_device *dev, goto return_sleep_time;/* +* Check if the chosen idle state is valid. +* If no, drop down to a lower valid state. Expects the lowest +* state will always be active. */ +if (!cx->valid) { +for (idx = (cx->type -1 ); idx ==1 ; idx--) {
^^^^^^^^
I think you mean idx >= 1 here.
Also, while you're working on this, could you fix this up so the omap3_power_states[] array is zero based insted of 1-based, it would make this code and the other code walking this array easier to follow.
That means defining OMAP_STATE_C1 = 0 and so on.
Quoted 12 lines
arch/arm/mach-omap2/cpuidle34xx.c +6
-0+if (omap3_power_states[idx].valid) +break ; } + state = &(dev->states[idx]); + dev->last_state = state ; + + cx =cpuidle_get_statedata (state); } current_cx_state = *cx;@@ -150,6 +153,26 @@ static int omap3_enter_idle_bm(struct cpuidle_device *dev,return omap3_enter_idle (dev, new_state);
arch/arm/mach-omap2/cpuidle34xx.c static int omap3_enter_idle_bm(struct cpuidle_device *dev, · line 163
Quoted 10 lines
arch/arm/mach-omap2/cpuidle34xx.c +8
-0} +/** +* omap3_toggle_off_states - Enable / Disable validity of idle states +* @flag: Enable/ Disable support for OFF mode +* +* Called as result of change to "enable_off_mode". +*/ +void omap3_toggle_off_states (unsigned short flag) +{
How about calling this omap3_cpuidle_update_states() and taking no arguments. Rather than the 'flag' argument, internally it just checks the global 'enable_off_mode.'
This allows for potential further expansion down the road of other reasons to update CPUidle valid states. For example, we've talked about updating the CPUidle state latencies on the fly depending on various other chip settings.
arch/arm/mach-omap2/cpuidle34xx.c static int omap3_enter_idle_bm(struct cpuidle_device *dev, · line 175
Quoted 12 lines
arch/arm/mach-omap2/cpuidle34xx.c +12
-0+if (flag) { + omap3_power_states[OMAP3_STATE_C3 ].valid =1 ; + omap3_power_states[OMAP3_STATE_C5 ].valid =1 ; + omap3_power_states[OMAP3_STATE_C6 ].valid =1 ; + } +else { + omap3_power_states[OMAP3_STATE_C3 ].valid =0 ; + omap3_power_states[OMAP3_STATE_C5 ].valid =0 ; + omap3_power_states[OMAP3_STATE_C6 ].valid =0 ; + } +} +
Rather than set set specific OMAP3_STATE_Cx values, it would be better to just walk the array, and check for [mpu|core]_state = PWRDM_POWER_OFF. If the state has either set, then update the valid flag.
arch/arm/mach-omap2/pm.c atomic_t sleep_block = ATOMIC_INIT(0); · line 51
Quoted 13 lines
arch/arm/mach-omap2/cpuidle34xx.c +0
-0DEFINE_PER_CPU(struct cpuidle_device, omap3_idle_dev);/* omap3_init_power_states - Initialises the OMAP3 specific C states. arch/arm/mach-omap2/pm.c +2
-0@@ -47,6 +47,8 @@ atomic_t sleep_block = ATOMIC_INIT(0);static int vdd1_locked;static int vdd2_locked; +extern void omap3_toggle_off_states (unsigned short ); +
Move the definition into pm.h as omap3_cpuidle_update_states(void) as described above.
arch/arm/mach-omap2/pm.c static ssize_t idle_store(struct kobject *kobj, struct kobj_ · line 118
Quoted 9 lines
arch/arm/mach-omap2/pm.c +2
-0static ssize_t idle_show (struct kobject *,struct kobj_attribute *,char *);static ssize_t idle_store (struct kobject *k,struct kobj_attribute *,const char *buf,size_t n);@@ -112,6 +114,8 @@ static ssize_t idle_store(struct kobject *kobj, struct kobj_ }else if (attr == &enable_off_mode_attr) { enable_off_mode = value;omap3_pm_off_mode_enable (enable_off_mode); +if (cpu_is_omap34xx ()) +omap3_toggle_off_states (value);
Then, don't modify pm.c, rather just call omap3_cpuidle_update_states() from omap3_pm_off_mode_enable().
Kevin
Quoted 45 lines
-----Original Message-----
From: Kevin Hilman [mailto:[email protected]]
Sent: Thursday, March 12, 2009 5:31 AM
To: Premi, Sanjeev
Cc: Högander Jouni; [email protected]
Subject: Re: [PATCHv2] PM : cpuidle - Update statistics for correct stateQuoted 2 lines · Sanjeev
Quoted 2 lines
I would gladly take a patch which uses the 'valid' field
for this and
Quoted 1 line
Quoted 1 line
then the enter hook whould drop to the next lower valid
state if the
Quoted 6 lines
Quoted 3 lines
state requested is not valid.
Kevin
[sp] I have not yet tested it (working offline for sometime).
But, wanted to share the changes for an early review.Thanks, some comments below.
Quoted 3 lines
Initially, I was trying see if the CPUIDLE framework could use ".valid" as an additional argument in
cpuidle_state. But, may be that's for later...Yeah, I looked at that too, but it currently doesn't have a concept of valid states, so for now I recommend we implement that in the OMAP-specific code as you have done.
arch/arm/mach-omap2/cpuidle34xx.c static int omap3_enter_idle(struct
Quoted 5 lines
(quoted diff) +0
-0b/arch/arm/mach-omap2/cpuidle34xx index c25158c..9493553 100644
arch/arm/mach-omap2/cpuidle34xx.c +0
-0@@ -88,16 +88,19 @@ static int omap3_enter_idle(struct
cpuidle_device*dev,arch/arm/mach-omap2/cpuidle34xx.c static int omap3_enter_idle(struct cpuidle_device *dev,
Quoted 5 lines
arch/arm/mach-omap2/cpuidle34xx.c +2
-0goto return_sleep_time;/* +* Check if the chosen idle state is valid. +* If no, drop down to a lower valid state. Expects
Quoted 8 lines
the lowest
arch/arm/mach-omap2/cpuidle34xx.c static int omap3_enter_idle(struct cpuidle_device *dev, · line 96
Quoted 4 lines
arch/arm/mach-omap2/cpuidle34xx.c +3
-0+* state will always be active. */ +if (!cx->valid) { +for (idx = (cx->type -1 ); idx ==1 ; idx--) {^^^^^^^^I think you mean idx >= 1 here.
[sp] Yes. A typo. Still haven't tried this patch myself.
Quoted 7 lines
Also, while you're working on this, could you fix this up so the omap3_power_states[] array is zero based insted of 1-based, it would make this code and the other code walking this array easier to follow.
That means defining
OMAP_STATE_C1= 0 and so on.
[sp] Definitely.
Quoted 83 lines
arch/arm/mach-omap2/cpuidle34xx.c static int omap3_enter_idle_bm(struct
Quoted 12 lines
arch/arm/mach-omap2/cpuidle34xx.c +6
-0+if (omap3_power_states[idx].valid) +break ; } + state = &(dev->states[idx]); + dev->last_state = state ; + + cx =cpuidle_get_statedata (state); } current_cx_state = *cx;@@ -150,6 +153,26 @@ static int omap3_enter_idle_bm(struct
cpuidle_device*dev,arch/arm/mach-omap2/cpuidle34xx.c static int omap3_enter_idle_bm(struct cpuidle_device *dev,
Quoted 4 lines
arch/arm/mach-omap2/cpuidle34xx.c +2
-0return omap3_enter_idle (dev, new_state); } +/** +* omap3_toggle_off_states - Enable / Disable validity of idle states
arch/arm/mach-omap2/cpuidle34xx.c static int omap3_enter_idle_bm(struct cpuidle_device *dev,
Quoted 5 lines
arch/arm/mach-omap2/cpuidle34xx.c +5
-0+* @flag: Enable/ Disable support for OFF mode +* +* Called as result of change to "enable_off_mode". +*/ +void omap3_toggle_off_states (unsigned short flag) {How about calling this
omap3_cpuidle_update_states()and taking no arguments. Rather than the 'flag' argument, internally it just checks the global 'enable_off_mode.'This allows for potential further expansion down the road of other reasons to update CPUidle valid states. For example, we've talked about updating the CPUidle state latencies on the fly depending on various other chip settings.
arch/arm/mach-omap2/cpuidle34xx.c static int omap3_enter_idle_bm(struct cpuidle_device *dev, · line 175
Quoted 12 lines
arch/arm/mach-omap2/cpuidle34xx.c +12
-0+if (flag) { + omap3_power_states[OMAP3_STATE_C3 ].valid =1 ; + omap3_power_states[OMAP3_STATE_C5 ].valid =1 ; + omap3_power_states[OMAP3_STATE_C6 ].valid =1 ; + } +else { + omap3_power_states[OMAP3_STATE_C3 ].valid =0 ; + omap3_power_states[OMAP3_STATE_C5 ].valid =0 ; + omap3_power_states[OMAP3_STATE_C6 ].valid =0 ; + } +} +Rather than set set specific
OMAP3_STATE_Cxvalues, it would be better to just walk the array, and check for [mpu|core]_state =PWRDM_POWER_OFF.
If the state has either set, then update the valid flag.arch/arm/mach-omap2/cpuidle34xx.c static int omap3_enter_idle_bm(struct cpuidle_device *dev,
Quoted 3 lines
arch/arm/mach-omap2/cpuidle34xx.c +0
-0DEFINE_PER_CPU(struct cpuidle_device, omap3_idle_dev);/* omap3_init_power_states - Initialises the OMAP3 specific C states.
Review
Quoted 1 line
(quoted diff) +0
-0
b/arch/arm/mach-omap2/pm.cindexarch/arm/mach-omap2/pm.c atomic_t sleep_block = ATOMIC_INIT(0);
Quoted 4 lines
61c6dfb..6785850 100644
arch/arm/mach-omap2/pm.c +0
-0@@ -47,6 +47,8 @@ atomic_t sleep_block = ATOMIC_INIT(0);static int
arch/arm/mach-omap2/pm.c atomic_t sleep_block = ATOMIC_INIT(0); · line 51
Quoted 4 lines
arch/arm/mach-omap2/pm.c +2
-0vdd1_locked;static int vdd2_locked; +extern void omap3_toggle_off_states (unsigned short ); +Move the definition into
pm.hasomap3_cpuidle_update_states(void)as described above.arch/arm/mach-omap2/pm.c atomic_t sleep_block = ATOMIC_INIT(0); · line 51
Quoted 1 line
arch/arm/mach-omap2/pm.c +0
-0static ssize_t idle_show(struct kobject *, struct
kobj_attribute*,arch/arm/mach-omap2/pm.c atomic_t sleep_block = ATOMIC_INIT(0); · line 52
Quoted 1 line
arch/arm/mach-omap2/pm.c +0
-0char *); static ssize_t idle_store(struct kobject *k,struct
kobj_attribute*,arch/arm/mach-omap2/pm.c atomic_t sleep_block = ATOMIC_INIT(0); · line 53
Quoted 1 line
arch/arm/mach-omap2/pm.c +0
-0const char *buf, size_t n); @@-112,6 +114,8
arch/arm/mach-omap2/pm.c static ssize_t idle_store(struct kobject *kobj, struct kobj_ · line 118
Quoted 6 lines
@@ static
ssize_tidle_store(struct kobject *kobj, structkobj_} else if (attr == &enable_off_mode_attr) { enable_off_mode = value; omap3_pm_off_mode_enable(enable_off_mode);arch/arm/mach-omap2/pm.c +2
-0+if (cpu_is_omap34xx ()) +omap3_toggle_off_states (value);
Quoted 6 lines
Then, don't modify
pm.c, rather just callomap3_cpuidle_update_states()fromomap3_pm_off_mode_enable().Kevin
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html