Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/x86/acpi Fix an oversight; the APERF and MPERF coun...



details:   https://anonhg.NetBSD.org/src/rev/fcb7364da9b3
branches:  trunk
changeset: 762685:fcb7364da9b3
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Fri Feb 25 17:23:34 2011 +0000

description:
Fix an oversight; the APERF and MPERF counters are per-CPU, so also reset
these by broadcasting to all CPUs with x86_msr_xcall(9).

diffstat:

 sys/arch/x86/acpi/acpi_cpu_md.c |  21 +++++++++++++++++----
 1 files changed, 17 insertions(+), 4 deletions(-)

diffs (46 lines):

diff -r 6291c5fdd920 -r fcb7364da9b3 sys/arch/x86/acpi/acpi_cpu_md.c
--- a/sys/arch/x86/acpi/acpi_cpu_md.c   Fri Feb 25 17:07:30 2011 +0000
+++ b/sys/arch/x86/acpi/acpi_cpu_md.c   Fri Feb 25 17:23:34 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu_md.c,v 1.45 2011/02/25 17:07:30 jruoho Exp $ */
+/* $NetBSD: acpi_cpu_md.c,v 1.46 2011/02/25 17:23:34 jruoho 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_md.c,v 1.45 2011/02/25 17:07:30 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_md.c,v 1.46 2011/02/25 17:23:34 jruoho Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -666,12 +666,25 @@
 static void
 acpicpu_md_pstate_percent_reset(struct acpicpu_softc *sc)
 {
+       struct msr_rw_info msr;
+       uint64_t xc;
 
        KASSERT((sc->sc_flags & ACPICPU_FLAG_P) != 0);
        KASSERT((sc->sc_flags & ACPICPU_FLAG_P_HW) != 0);
 
-       wrmsr(MSR_APERF, 0);
-       wrmsr(MSR_MPERF, 0);
+       msr.msr_value = 0;
+       msr.msr_read = false;
+       msr.msr_type = MSR_APERF;
+
+       xc = xc_broadcast(0, (xcfunc_t)x86_msr_xcall, &msr, NULL);
+       xc_wait(xc);
+
+       msr.msr_value = 0;
+       msr.msr_read = false;
+       msr.msr_type = MSR_MPERF;
+
+       xc = xc_broadcast(0, (xcfunc_t)x86_msr_xcall, &msr, NULL);
+       xc_wait(xc);
 
        sc->sc_pstate_aperf = 0;
        sc->sc_pstate_mperf = 0;



Home | Main Index | Thread Index | Old Index