Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/acpi Disable read of the ACPI timer during idle, fix...



details:   https://anonhg.NetBSD.org/src/rev/f58b33be9098
branches:  trunk
changeset: 933793:f58b33be9098
user:      ad <ad%NetBSD.org@localhost>
date:      Sun May 31 01:39:33 2020 +0000

description:
Disable read of the ACPI timer during idle, fixing performance degradation
observed with acpicpu.  C1 (MWAIT) is the deepest sleep currently enabled so
there should be no functional change.  Also, the computed nap time is run
through hztoms() which seems incorrect as the ACPI timer is running in the
MHz range.

diffstat:

 sys/dev/acpi/acpi_cpu_cstate.c |  22 +++++++++++++++++++---
 1 files changed, 19 insertions(+), 3 deletions(-)

diffs (54 lines):

diff -r bddcf627124c -r f58b33be9098 sys/dev/acpi/acpi_cpu_cstate.c
--- a/sys/dev/acpi/acpi_cpu_cstate.c    Sat May 30 23:52:09 2020 +0000
+++ b/sys/dev/acpi/acpi_cpu_cstate.c    Sun May 31 01:39:33 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu_cstate.c,v 1.60 2019/02/03 03:19:27 mrg Exp $ */
+/* $NetBSD: acpi_cpu_cstate.c,v 1.61 2020/05/31 01:39:33 ad Exp $ */
 
 /*-
  * Copyright (c) 2010, 2011 Jukka Ruohonen <jruohonen%iki.fi@localhost>
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_cstate.c,v 1.60 2019/02/03 03:19:27 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_cstate.c,v 1.61 2020/05/31 01:39:33 ad Exp $");
 
 #include <sys/param.h>
 #include <sys/cpu.h>
@@ -739,9 +739,18 @@
 acpicpu_cstate_idle_enter(struct acpicpu_softc *sc, int state)
 {
        struct acpicpu_cstate *cs = &sc->sc_cstate[state];
-       uint32_t end, start, val;
+       uint32_t val;
 
+#ifdef notyet
+       /*
+        * XXX This has a significant performance impact because the ACPI
+        * timer seems very slow and with many CPUs becomes a chokepoint. 
+        * Better to use the TSC (if invariant) or APIC timer instead. 
+        * Proably even getbintime().  Disabled for now as no functional
+        * change - only C1 sleep is enabled.
+        */
        start = acpitimer_read_fast(NULL);
+#endif
 
        switch (cs->cs_method) {
 
@@ -756,8 +765,15 @@
        }
 
        cs->cs_evcnt.ev_count++;
+
+#ifdef notyet
+       /*
+        * XXX As above.  Also, hztoms() seems incorrect as the ACPI timer
+        * is running the MHz region.
+        */
        end = acpitimer_read_fast(NULL);
        sc->sc_cstate_sleep = hztoms(acpitimer_delta(end, start)) * 1000;
+#endif
 }
 
 static bool



Home | Main Index | Thread Index | Old Index