aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorDeepthi Dharwar <deepthi@linux.vnet.ibm.com>2011-10-28 06:50:33 -0400
committerLen Brown <len.brown@intel.com>2011-11-06 21:13:49 -0500
commit4202735e8ab6ecfb0381631a0d0b58fefe0bd4e2 (patch)
tree189e5aab466995128c5a9d5a2a4075a5db530674 /drivers/acpi
parentb25edc42bfb9602f0503474b2c94701d5536ce60 (diff)
cpuidle: Split cpuidle_state structure and move per-cpu statistics fields
This is the first step towards global registration of cpuidle states. The statistics used primarily by the governor are per-cpu and have to be split from rest of the fields inside cpuidle_state, which would be made global i.e. single copy. The driver_data field is also per-cpu and moved. 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/acpi')
-rw-r--r--drivers/acpi/processor_idle.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index 9cd08cecb347..b98c75285690 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -745,14 +745,13 @@ static inline void acpi_idle_do_entry(struct acpi_processor_cx *cx)
745 * 745 *
746 * This is equivalent to the HALT instruction. 746 * This is equivalent to the HALT instruction.
747 */ 747 */
748static int acpi_idle_enter_c1(struct cpuidle_device *dev, 748static int acpi_idle_enter_c1(struct cpuidle_device *dev, int index)
749 int index)
750{ 749{
751 ktime_t kt1, kt2; 750 ktime_t kt1, kt2;
752 s64 idle_time; 751 s64 idle_time;
753 struct acpi_processor *pr; 752 struct acpi_processor *pr;
754 struct cpuidle_state *state = &dev->states[index]; 753 struct cpuidle_state_usage *state_usage = &dev->states_usage[index];
755 struct acpi_processor_cx *cx = cpuidle_get_statedata(state); 754 struct acpi_processor_cx *cx = cpuidle_get_statedata(state_usage);
756 755
757 pr = __this_cpu_read(processors); 756 pr = __this_cpu_read(processors);
758 dev->last_residency = 0; 757 dev->last_residency = 0;
@@ -790,12 +789,11 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev,
790 * @dev: the target CPU 789 * @dev: the target CPU
791 * @index: the index of suggested state 790 * @index: the index of suggested state
792 */ 791 */
793static int acpi_idle_enter_simple(struct cpuidle_device *dev, 792static int acpi_idle_enter_simple(struct cpuidle_device *dev, int index)
794 int index)
795{ 793{
796 struct acpi_processor *pr; 794 struct acpi_processor *pr;
797 struct cpuidle_state *state = &dev->states[index]; 795 struct cpuidle_state_usage *state_usage = &dev->states_usage[index];
798 struct acpi_processor_cx *cx = cpuidle_get_statedata(state); 796 struct acpi_processor_cx *cx = cpuidle_get_statedata(state_usage);
799 ktime_t kt1, kt2; 797 ktime_t kt1, kt2;
800 s64 idle_time_ns; 798 s64 idle_time_ns;
801 s64 idle_time; 799 s64 idle_time;
@@ -875,12 +873,11 @@ static DEFINE_SPINLOCK(c3_lock);
875 * 873 *
876 * If BM is detected, the deepest non-C3 idle state is entered instead. 874 * If BM is detected, the deepest non-C3 idle state is entered instead.
877 */ 875 */
878static int acpi_idle_enter_bm(struct cpuidle_device *dev, 876static int acpi_idle_enter_bm(struct cpuidle_device *dev, int index)
879 int index)
880{ 877{
881 struct acpi_processor *pr; 878 struct acpi_processor *pr;
882 struct cpuidle_state *state = &dev->states[index]; 879 struct cpuidle_state_usage *state_usage = &dev->states_usage[index];
883 struct acpi_processor_cx *cx = cpuidle_get_statedata(state); 880 struct acpi_processor_cx *cx = cpuidle_get_statedata(state_usage);
884 ktime_t kt1, kt2; 881 ktime_t kt1, kt2;
885 s64 idle_time_ns; 882 s64 idle_time_ns;
886 s64 idle_time; 883 s64 idle_time;
@@ -1004,6 +1001,7 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)
1004 int i, count = CPUIDLE_DRIVER_STATE_START; 1001 int i, count = CPUIDLE_DRIVER_STATE_START;
1005 struct acpi_processor_cx *cx; 1002 struct acpi_processor_cx *cx;
1006 struct cpuidle_state *state; 1003 struct cpuidle_state *state;
1004 struct cpuidle_state_usage *state_usage;
1007 struct cpuidle_device *dev = &pr->power.dev; 1005 struct cpuidle_device *dev = &pr->power.dev;
1008 1006
1009 if (!pr->flags.power_setup_done) 1007 if (!pr->flags.power_setup_done)
@@ -1026,6 +1024,7 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)
1026 for (i = 1; i < ACPI_PROCESSOR_MAX_POWER && i <= max_cstate; i++) { 1024 for (i = 1; i < ACPI_PROCESSOR_MAX_POWER && i <= max_cstate; i++) {
1027 cx = &pr->power.states[i]; 1025 cx = &pr->power.states[i];
1028 state = &dev->states[count]; 1026 state = &dev->states[count];
1027 state_usage = &dev->states_usage[count];
1029 1028
1030 if (!cx->valid) 1029 if (!cx->valid)
1031 continue; 1030 continue;
@@ -1036,7 +1035,7 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)
1036 !(acpi_gbl_FADT.flags & ACPI_FADT_C2_MP_SUPPORTED)) 1035 !(acpi_gbl_FADT.flags & ACPI_FADT_C2_MP_SUPPORTED))
1037 continue; 1036 continue;
1038#endif 1037#endif
1039 cpuidle_set_statedata(state, cx); 1038 cpuidle_set_statedata(state_usage, cx);
1040 1039
1041 snprintf(state->name, CPUIDLE_NAME_LEN, "C%d", i); 1040 snprintf(state->name, CPUIDLE_NAME_LEN, "C%d", i);
1042 strncpy(state->desc, cx->desc, CPUIDLE_DESC_LEN); 1041 strncpy(state->desc, cx->desc, CPUIDLE_DESC_LEN);