Author: jkim
Date: Tue Apr  5 18:40:19 2011
New Revision: 220369
URL: http://svn.freebsd.org/changeset/base/220369

Log:
  Lower the bar for ACPI-fast on real machines slightly.  Empirical evidences
  show that there are perfectly working PM timers with occasional "hiccups",
  probably because of an SMI.  Now we ignore the maximum if it happens once in
  the test loop and the width is small enough.  Also, relax normal width a bit
  to count in a boundary case.

Modified:
  head/sys/dev/acpica/acpi_timer.c

Modified: head/sys/dev/acpica/acpi_timer.c
==============================================================================
--- head/sys/dev/acpica/acpi_timer.c    Tue Apr  5 17:41:54 2011        
(r220368)
+++ head/sys/dev/acpica/acpi_timer.c    Tue Apr  5 18:40:19 2011        
(r220369)
@@ -306,12 +306,12 @@ SYSCTL_PROC(_machdep, OID_AUTO, acpi_tim
 static int
 acpi_timer_test()
 {
-    uint32_t   last, this;
-    int                min, max, n, delta;
-    register_t s;
+    uint32_t last, this;
+    int delta, max, max2, min, n;
+    register_t s;
 
     min = INT32_MAX;
-    max = 0;
+    max = max2 = 0;
 
     /* Test the timer with interrupts disabled to get accurate results. */
     s = intr_disable();
@@ -319,18 +319,21 @@ acpi_timer_test()
     for (n = 0; n < N; n++) {
        this = acpi_timer_read();
        delta = acpi_TimerDelta(this, last);
-       if (delta > max)
+       if (delta > max) {
+           max2 = max;
            max = delta;
+       } else if (delta > max2)
+           max2 = delta;
        if (delta < min)
            min = delta;
        last = this;
     }
     intr_restore(s);
 
-    delta = max - min;
-    if (delta > 2 && vm_guest == VM_GUEST_NO)
+    delta = max2 - min;
+    if ((max - min > 8 || delta > 3) && vm_guest == VM_GUEST_NO)
        n = 0;
-    else if (min < 0 || max == 0)
+    else if (min < 0 || max == 0 || max2 == 0)
        n = 0;
     else
        n = 1;
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to