Use evcount_percpu() with mips64 clock and ipi interrupt counters.
authorvisa <visa@openbsd.org>
Mon, 5 Dec 2022 08:59:28 +0000 (08:59 +0000)
committervisa <visa@openbsd.org>
Mon, 5 Dec 2022 08:59:28 +0000 (08:59 +0000)
OK jca@ cheloha@

sys/arch/mips64/mips64/clock.c
sys/arch/mips64/mips64/ipifuncs.c

index d9a9be8..6ef31ff 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: clock.c,v 1.48 2022/11/19 16:23:48 cheloha Exp $ */
+/*     $OpenBSD: clock.c,v 1.49 2022/12/05 08:59:28 visa Exp $ */
 
 /*
  * Copyright (c) 2001-2004 Opsycon AB  (www.opsycon.se / www.opsycon.com)
@@ -37,7 +37,6 @@
 #include <sys/param.h>
 #include <sys/kernel.h>
 #include <sys/systm.h>
-#include <sys/atomic.h>
 #include <sys/clockintr.h>
 #include <sys/device.h>
 #include <sys/evcount.h>
@@ -100,6 +99,7 @@ clockattach(struct device *parent, struct device *self, void *aux)
         */
        set_intr(INTPRI_CLOCK, CR_INT_5, cp0_int5);
        evcount_attach(&cp0_clock_count, "clock", &cp0_clock_irq);
+       evcount_percpu(&cp0_clock_count);
 
        /* try to avoid getting clock interrupts early */
        cp0_set_compare(cp0_get_count() - 1);
@@ -121,7 +121,7 @@ cp0_int5(uint32_t mask, struct trapframe *tf)
        struct cpu_info *ci = curcpu();
        int s;
 
-       atomic_inc_long((unsigned long *)&cp0_clock_count.ec_count);
+       evcount_inc(&cp0_clock_count);
 
        cp0_set_compare(cp0_get_count() - 1);   /* clear INT5 */
 
index 8f915f6..6268bac 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: ipifuncs.c,v 1.25 2022/04/10 13:23:14 visa Exp $ */
+/* $OpenBSD: ipifuncs.c,v 1.26 2022/12/05 08:59:28 visa Exp $ */
 /* $NetBSD: ipifuncs.c,v 1.40 2008/04/28 20:23:10 martin Exp $ */
 
 /*-
@@ -84,6 +84,7 @@ mips64_ipi_init(void)
        if (!cpuid) {
                mtx_init(&smp_rv_mtx, IPL_HIGH);
                evcount_attach(&ipi_count, "ipi", &ipi_irq);
+               evcount_percpu(&ipi_count);
        }
 
        hw_ipi_intr_clear(cpuid);
@@ -113,8 +114,7 @@ mips64_ipi_intr(void *arg)
                for (bit = 0; bit < MIPS64_NIPIS; bit++) {
                        if (pending_ipis & (1UL << bit)) {
                                (*ipifuncs[bit])();
-                               atomic_inc_long(
-                                   (unsigned long *)&ipi_count.ec_count);
+                               evcount_inc(&ipi_count);
                        }
                }
        }