Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/alpha/alpha Don't use atomics to manipulate cpu_inf...



details:   https://anonhg.NetBSD.org/src/rev/520967154d96
branches:  trunk
changeset: 378647:520967154d96
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Tue Apr 20 01:29:40 2021 +0000

description:
Don't use atomics to manipulate cpu_info::ci_intrdepth: it's modified
only in the interrupt service path by the owning CPU, at entry and exit.
Even if the r/m/w cycle of incrementing the value were interrupted, the
result would still be the same because the interrupting frame will have
completed its own symmetrical increment/decrement cycle upon return.

diffstat:

 sys/arch/alpha/alpha/interrupt.c |  20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diffs (84 lines):

diff -r 2d98305bc6e2 -r 520967154d96 sys/arch/alpha/alpha/interrupt.c
--- a/sys/arch/alpha/alpha/interrupt.c  Tue Apr 20 00:09:45 2021 +0000
+++ b/sys/arch/alpha/alpha/interrupt.c  Tue Apr 20 01:29:40 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: interrupt.c,v 1.94 2021/04/20 00:09:45 thorpej Exp $ */
+/* $NetBSD: interrupt.c,v 1.95 2021/04/20 01:29:40 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.94 2021/04/20 00:09:45 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.95 2021/04/20 01:29:40 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -193,7 +193,7 @@ interrupt(unsigned long a0, unsigned lon
        switch (a0) {
        case ALPHA_INTR_XPROC:  /* interprocessor interrupt */
 #if defined(MULTIPROCESSOR)
-               atomic_inc_ulong(&ci->ci_intrdepth);
+               ci->ci_intrdepth++;
 
                alpha_ipi_process(ci, framep);
 
@@ -205,7 +205,7 @@ interrupt(unsigned long a0, unsigned lon
                    hwrpb->rpb_txrdy != 0)
                        cpu_iccb_receive();
 
-               atomic_dec_ulong(&ci->ci_intrdepth);
+               ci->ci_intrdepth--;
 #else
                printf("WARNING: received interprocessor interrupt!\n");
 #endif /* MULTIPROCESSOR */
@@ -226,7 +226,7 @@ interrupt(unsigned long a0, unsigned lon
                 * "was processing interrupts when the clock interrupt
                 * happened".
                 */
-               atomic_add_long(&ci->ci_intrdepth, 0x10);
+               ci->ci_intrdepth += 0x10;
                sc->sc_evcnt_clock.ev_count++;
                ci->ci_data.cpu_nintr++;
                if (platform.clockintr) {
@@ -251,18 +251,18 @@ interrupt(unsigned long a0, unsigned lon
                            schedhz != 0)
                                schedclock(ci->ci_curlwp);
                }
-               atomic_add_long(&ci->ci_intrdepth, -0x10);
+               ci->ci_intrdepth -= 0x10;
                break;
 
        case ALPHA_INTR_ERROR:  /* Machine Check or Correctable Error */
-               atomic_inc_ulong(&ci->ci_intrdepth);
+               ci->ci_intrdepth++;
                a0 = alpha_pal_rdmces();
                if (platform.mcheck_handler != NULL &&
                    (void *)framep->tf_regs[FRAME_PC] != XentArith)
                        (*platform.mcheck_handler)(a0, framep, a1, a2);
                else
                        machine_check(a0, framep, a1, a2);
-               atomic_dec_ulong(&ci->ci_intrdepth);
+               ci->ci_intrdepth--;
                break;
 
        case ALPHA_INTR_DEVICE: /* I/O device interrupt */
@@ -272,14 +272,14 @@ interrupt(unsigned long a0, unsigned lon
                KDASSERT(a1 >= SCB_IOVECBASE && a1 < SCB_SIZE);
 
                atomic_inc_ulong(&sc->sc_evcnt_device.ev_count);
-               atomic_inc_ulong(&ci->ci_intrdepth);
+               ci->ci_intrdepth++;
 
                ci->ci_data.cpu_nintr++;
 
                struct scbvec * const scb = &scb_iovectab[idx];
                (*scb->scb_func)(scb->scb_arg, a1);
 
-               atomic_dec_ulong(&ci->ci_intrdepth);
+               ci->ci_intrdepth--;
                break;
            }
 



Home | Main Index | Thread Index | Old Index