svn commit: r209897 - stable/8/sys/dev/acpica
Alexander Motin
mav at FreeBSD.org
Sun Jul 11 11:58:47 UTC 2010
Author: mav
Date: Sun Jul 11 11:58:46 2010
New Revision: 209897
URL: http://svn.freebsd.org/changeset/base/209897
Log:
MFC r209328,r209330:
While we indeed can't precisely measure time spent in C1, we can consider
measured interval as upper bound. It should be more precise then just
assuming 1/(2*hz). For idle CPU it should be quite precise, for busy - not
worse then before.
Modified:
stable/8/sys/dev/acpica/acpi_cpu.c
Directory Properties:
stable/8/sys/ (props changed)
stable/8/sys/amd64/include/xen/ (props changed)
stable/8/sys/cddl/contrib/opensolaris/ (props changed)
stable/8/sys/contrib/dev/acpica/ (props changed)
stable/8/sys/contrib/pf/ (props changed)
stable/8/sys/dev/xen/xenpci/ (props changed)
Modified: stable/8/sys/dev/acpica/acpi_cpu.c
==============================================================================
--- stable/8/sys/dev/acpica/acpi_cpu.c Sun Jul 11 09:37:34 2010 (r209896)
+++ stable/8/sys/dev/acpica/acpi_cpu.c Sun Jul 11 11:58:46 2010 (r209897)
@@ -930,12 +930,16 @@ acpi_cpu_idle()
/*
* Execute HLT (or equivalent) and wait for an interrupt. We can't
- * calculate the time spent in C1 since the place we wake up is an
- * ISR. Assume we slept half of quantum and return.
+ * precisely calculate the time spent in C1 since the place we wake up
+ * is an ISR. Assume we slept no more then half of quantum.
*/
if (cx_next->type == ACPI_STATE_C1) {
- sc->cpu_prev_sleep = (sc->cpu_prev_sleep * 3 + 500000 / hz) / 4;
+ AcpiHwRead(&start_time, &AcpiGbl_FADT.XPmTimerBlock);
acpi_cpu_c1();
+ AcpiHwRead(&end_time, &AcpiGbl_FADT.XPmTimerBlock);
+ end_time = acpi_TimerDelta(end_time, start_time);
+ sc->cpu_prev_sleep = (sc->cpu_prev_sleep * 3 +
+ min(PM_USEC(end_time), 500000 / hz)) / 4;
return;
}
More information about the svn-src-stable-8
mailing list