aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorVenkatesh Pallipadi <venkatesh.pallipadi@intel.com>2007-11-19 19:49:00 -0500
committerLen Brown <len.brown@intel.com>2007-11-19 21:32:02 -0500
commit5062911830a66df0c0ad28c387a8c0623cb0d28c (patch)
tree95624d73fa437638ae720217f505492f77f56201 /drivers
parentc9c860e5349ef62cd9226694b3aa625ef66f504e (diff)
cpuidle: add sched_clock_idle_[sleep|wakeup]_event() hooks
Port 2aa44d0567ed21b47b87d68819415d48194cb923 (sched: sched_clock_idle_[sleep|wakeup]_event()) to cpuidle. Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/processor_idle.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index 943a88069001..1af0694e8520 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -1411,6 +1411,8 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
1411 struct acpi_processor *pr; 1411 struct acpi_processor *pr;
1412 struct acpi_processor_cx *cx = cpuidle_get_statedata(state); 1412 struct acpi_processor_cx *cx = cpuidle_get_statedata(state);
1413 u32 t1, t2; 1413 u32 t1, t2;
1414 int sleep_ticks = 0;
1415
1414 pr = processors[smp_processor_id()]; 1416 pr = processors[smp_processor_id()];
1415 1417
1416 if (unlikely(!pr)) 1418 if (unlikely(!pr))
@@ -1440,6 +1442,8 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
1440 ACPI_FLUSH_CPU_CACHE(); 1442 ACPI_FLUSH_CPU_CACHE();
1441 1443
1442 t1 = inl(acpi_gbl_FADT.xpm_timer_block.address); 1444 t1 = inl(acpi_gbl_FADT.xpm_timer_block.address);
1445 /* Tell the scheduler that we are going deep-idle: */
1446 sched_clock_idle_sleep_event();
1443 acpi_state_timer_broadcast(pr, cx, 1); 1447 acpi_state_timer_broadcast(pr, cx, 1);
1444 acpi_idle_do_entry(cx); 1448 acpi_idle_do_entry(cx);
1445 t2 = inl(acpi_gbl_FADT.xpm_timer_block.address); 1449 t2 = inl(acpi_gbl_FADT.xpm_timer_block.address);
@@ -1448,6 +1452,10 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
1448 /* TSC could halt in idle, so notify users */ 1452 /* TSC could halt in idle, so notify users */
1449 mark_tsc_unstable("TSC halts in idle");; 1453 mark_tsc_unstable("TSC halts in idle");;
1450#endif 1454#endif
1455 sleep_ticks = ticks_elapsed(t1, t2);
1456
1457 /* Tell the scheduler how much we idled: */
1458 sched_clock_idle_wakeup_event(sleep_ticks*PM_TIMER_TICK_NS);
1451 1459
1452 local_irq_enable(); 1460 local_irq_enable();
1453 current_thread_info()->status |= TS_POLLING; 1461 current_thread_info()->status |= TS_POLLING;
@@ -1455,7 +1463,7 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
1455 cx->usage++; 1463 cx->usage++;
1456 1464
1457 acpi_state_timer_broadcast(pr, cx, 0); 1465 acpi_state_timer_broadcast(pr, cx, 0);
1458 cx->time += ticks_elapsed(t1, t2); 1466 cx->time += sleep_ticks;
1459 return ticks_elapsed_in_us(t1, t2); 1467 return ticks_elapsed_in_us(t1, t2);
1460} 1468}
1461 1469
@@ -1475,6 +1483,8 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
1475 struct acpi_processor *pr; 1483 struct acpi_processor *pr;
1476 struct acpi_processor_cx *cx = cpuidle_get_statedata(state); 1484 struct acpi_processor_cx *cx = cpuidle_get_statedata(state);
1477 u32 t1, t2; 1485 u32 t1, t2;
1486 int sleep_ticks = 0;
1487
1478 pr = processors[smp_processor_id()]; 1488 pr = processors[smp_processor_id()];
1479 1489
1480 if (unlikely(!pr)) 1490 if (unlikely(!pr))
@@ -1497,6 +1507,8 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
1497 return 0; 1507 return 0;
1498 } 1508 }
1499 1509
1510 /* Tell the scheduler that we are going deep-idle: */
1511 sched_clock_idle_sleep_event();
1500 /* 1512 /*
1501 * Must be done before busmaster disable as we might need to 1513 * Must be done before busmaster disable as we might need to
1502 * access HPET ! 1514 * access HPET !
@@ -1552,6 +1564,9 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
1552 /* TSC could halt in idle, so notify users */ 1564 /* TSC could halt in idle, so notify users */
1553 mark_tsc_unstable("TSC halts in idle"); 1565 mark_tsc_unstable("TSC halts in idle");
1554#endif 1566#endif
1567 sleep_ticks = ticks_elapsed(t1, t2);
1568 /* Tell the scheduler how much we idled: */
1569 sched_clock_idle_wakeup_event(sleep_ticks*PM_TIMER_TICK_NS);
1555 1570
1556 local_irq_enable(); 1571 local_irq_enable();
1557 current_thread_info()->status |= TS_POLLING; 1572 current_thread_info()->status |= TS_POLLING;
@@ -1559,7 +1574,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
1559 cx->usage++; 1574 cx->usage++;
1560 1575
1561 acpi_state_timer_broadcast(pr, cx, 0); 1576 acpi_state_timer_broadcast(pr, cx, 0);
1562 cx->time += ticks_elapsed(t1, t2); 1577 cx->time += sleep_ticks;
1563 return ticks_elapsed_in_us(t1, t2); 1578 return ticks_elapsed_in_us(t1, t2);
1564} 1579}
1565 1580