aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/processor_idle.c
diff options
context:
space:
mode:
authorvenkatesh.pallipadi@intel.com <venkatesh.pallipadi@intel.com>2008-01-31 20:35:05 -0500
committerLen Brown <len.brown@intel.com>2008-02-07 02:14:16 -0500
commit9b12e18cdc1553de62d931e73443c806347cd974 (patch)
treed49c467a87bed9160b32ea518c8656d27d462326 /drivers/acpi/processor_idle.c
parentbc71bec91f9875ef825d12104acf3bf4ca215fa4 (diff)
ACPI: cpuidle: Support C1 idle time accounting
Show C1 idle time in /sysfs cpuidle interface. C1 idle time may not be entirely accurate in all cases. It includes the time spent in the interrupt handler after wakeup with "hlt" based C1. But, it will be accurate with "mwait" based C1. Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/processor_idle.c')
-rw-r--r--drivers/acpi/processor_idle.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index 4ba3a9a473dd..fea71597b40a 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -1407,8 +1407,10 @@ static inline void acpi_idle_do_entry(struct acpi_processor_cx *cx)
1407static int acpi_idle_enter_c1(struct cpuidle_device *dev, 1407static int acpi_idle_enter_c1(struct cpuidle_device *dev,
1408 struct cpuidle_state *state) 1408 struct cpuidle_state *state)
1409{ 1409{
1410 u32 t1, t2;
1410 struct acpi_processor *pr; 1411 struct acpi_processor *pr;
1411 struct acpi_processor_cx *cx = cpuidle_get_statedata(state); 1412 struct acpi_processor_cx *cx = cpuidle_get_statedata(state);
1413
1412 pr = processors[smp_processor_id()]; 1414 pr = processors[smp_processor_id()];
1413 1415
1414 if (unlikely(!pr)) 1416 if (unlikely(!pr))
@@ -1418,12 +1420,14 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev,
1418 if (pr->flags.bm_check) 1420 if (pr->flags.bm_check)
1419 acpi_idle_update_bm_rld(pr, cx); 1421 acpi_idle_update_bm_rld(pr, cx);
1420 1422
1423 t1 = inl(acpi_gbl_FADT.xpm_timer_block.address);
1421 acpi_idle_do_entry(cx); 1424 acpi_idle_do_entry(cx);
1425 t2 = inl(acpi_gbl_FADT.xpm_timer_block.address);
1422 1426
1423 local_irq_enable(); 1427 local_irq_enable();
1424 cx->usage++; 1428 cx->usage++;
1425 1429
1426 return 0; 1430 return ticks_elapsed_in_us(t1, t2);
1427} 1431}
1428 1432
1429/** 1433/**
@@ -1660,6 +1664,7 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)
1660 switch (cx->type) { 1664 switch (cx->type) {
1661 case ACPI_STATE_C1: 1665 case ACPI_STATE_C1:
1662 state->flags |= CPUIDLE_FLAG_SHALLOW; 1666 state->flags |= CPUIDLE_FLAG_SHALLOW;
1667 state->flags |= CPUIDLE_FLAG_TIME_VALID;
1663 state->enter = acpi_idle_enter_c1; 1668 state->enter = acpi_idle_enter_c1;
1664 dev->safe_state = state; 1669 dev->safe_state = state;
1665 break; 1670 break;