Module Name: src
Committed By: ad
Date: Sun May 31 01:39:33 UTC 2020
Modified Files:
src/sys/dev/acpi: acpi_cpu_cstate.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/sys/dev/acpi/acpi_cpu_cstate.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/acpi/acpi_cpu_cstate.c
diff -u src/sys/dev/acpi/acpi_cpu_cstate.c:1.60 src/sys/dev/acpi/acpi_cpu_cstate.c:1.61
--- src/sys/dev/acpi/acpi_cpu_cstate.c:1.60 Sun Feb 3 03:19:27 2019
+++ src/sys/dev/acpi/acpi_cpu_cstate.c Sun May 31 01:39:33 2020
@@ -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 <[email protected]>
@@ -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 @@ static void
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 @@ acpicpu_cstate_idle_enter(struct acpicpu
}
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