Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/alpha Slight tweak to previous changes:



details:   https://anonhg.NetBSD.org/src/rev/2d98305bc6e2
branches:  trunk
changeset: 378646:2d98305bc6e2
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Tue Apr 20 00:09:45 2021 +0000

description:
Slight tweak to previous changes:

Rather than simply increment the interrupt depth for the clock interrupt,
we add 0x10.  Why?  Because while we only use a single Alpha IPL (4) for
IPL_{BIO,NET,TTY,VM}, technically the architecture specification suports
two in the OSF/1 PALcode (3 [low-pri] and 4 [high-pri]), meaning we could
conceiveably have intrdepth > 1 just for device interrupts.

Adding 0x10 here means that cpu_intr_p() can check for "intrdepth != 0" for
"in interrupt context" and CLKF_INTR() can check "(intrdepth & 0xf) != 0" for
"was processing interrupts when the clock interrupt happened".

diffstat:

 sys/arch/alpha/alpha/interrupt.c |  22 ++++++++++++++++++----
 sys/arch/alpha/include/cpu.h     |   4 ++--
 2 files changed, 20 insertions(+), 6 deletions(-)

diffs (68 lines):

diff -r a235238a6a25 -r 2d98305bc6e2 sys/arch/alpha/alpha/interrupt.c
--- a/sys/arch/alpha/alpha/interrupt.c  Mon Apr 19 23:51:42 2021 +0000
+++ b/sys/arch/alpha/alpha/interrupt.c  Tue Apr 20 00:09:45 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: interrupt.c,v 1.93 2021/04/15 00:19:52 rin Exp $ */
+/* $NetBSD: interrupt.c,v 1.94 2021/04/20 00:09:45 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.93 2021/04/15 00:19:52 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.94 2021/04/20 00:09:45 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -212,7 +212,21 @@ interrupt(unsigned long a0, unsigned lon
                break;
                
        case ALPHA_INTR_CLOCK:  /* clock interrupt */
-               atomic_inc_ulong(&ci->ci_intrdepth);
+               /*
+                * Rather than simply increment the interrupt depth
+                * for the clock interrupt, we add 0x10.  Why?  Because
+                * while we only call out a single device interrupt
+                * level, technically the architecture specification
+                * suports two, meaning we could have intrdepth > 1
+                * just for device interrupts.
+                *
+                * Adding 0x10 here means that cpu_intr_p() can check
+                * for "intrdepth != 0" for "in interrupt context" and
+                * CLKF_INTR() can check "(intrdepth & 0xf) != 0" for
+                * "was processing interrupts when the clock interrupt
+                * happened".
+                */
+               atomic_add_long(&ci->ci_intrdepth, 0x10);
                sc->sc_evcnt_clock.ev_count++;
                ci->ci_data.cpu_nintr++;
                if (platform.clockintr) {
@@ -237,7 +251,7 @@ interrupt(unsigned long a0, unsigned lon
                            schedhz != 0)
                                schedclock(ci->ci_curlwp);
                }
-               atomic_dec_ulong(&ci->ci_intrdepth);
+               atomic_add_long(&ci->ci_intrdepth, -0x10);
                break;
 
        case ALPHA_INTR_ERROR:  /* Machine Check or Correctable Error */
diff -r a235238a6a25 -r 2d98305bc6e2 sys/arch/alpha/include/cpu.h
--- a/sys/arch/alpha/include/cpu.h      Mon Apr 19 23:51:42 2021 +0000
+++ b/sys/arch/alpha/include/cpu.h      Tue Apr 20 00:09:45 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.h,v 1.100 2021/04/15 08:23:24 rin Exp $ */
+/* $NetBSD: cpu.h,v 1.101 2021/04/20 00:09:45 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -206,7 +206,7 @@ struct clockframe {
  * like this stastic has to be extremely accurate.
  */
 #define        CLKF_INTR(framep)                                               \
-       (curcpu()->ci_intrdepth > 1)    /* one for clock interrupt itself */
+       ((curcpu()->ci_intrdepth & 0xf) != 0)   /* see interrupt() */
 
 /*
  * This is used during profiling to integrate system time.  It can safely



Home | Main Index | Thread Index | Old Index