Date: Sun, 11 Jul 2010 11:58:46 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r209897 - stable/8/sys/dev/acpica Message-ID: <201007111158.o6BBwkiK069922@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201007111158.o6BBwkiK069922>