Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/alpha Clean up soft interrupt related stuff a bit.



details:   https://anonhg.NetBSD.org/src/rev/74afc7bb3701
branches:  trunk
changeset: 508629:74afc7bb3701
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sun Apr 15 23:07:34 2001 +0000

description:
Clean up soft interrupt related stuff a bit.

diffstat:

 sys/arch/alpha/alpha/interrupt.c |  63 ++++++++++++++++++++++++++++++++-------
 sys/arch/alpha/alpha/locore.s    |   6 +-
 sys/arch/alpha/alpha/machdep.c   |  16 +--------
 sys/arch/alpha/include/intr.h    |  22 +++----------
 4 files changed, 62 insertions(+), 45 deletions(-)

diffs (240 lines):

diff -r 73cce8583d04 -r 74afc7bb3701 sys/arch/alpha/alpha/interrupt.c
--- a/sys/arch/alpha/alpha/interrupt.c  Sun Apr 15 22:33:37 2001 +0000
+++ b/sys/arch/alpha/alpha/interrupt.c  Sun Apr 15 23:07:34 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: interrupt.c,v 1.56 2001/04/14 00:45:13 thorpej Exp $ */
+/* $NetBSD: interrupt.c,v 1.57 2001/04/15 23:07:34 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -72,7 +72,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.56 2001/04/14 00:45:13 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.57 2001/04/15 23:07:34 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -381,11 +381,30 @@
 }
 
 struct alpha_soft_intr alpha_soft_intrs[IPL_NSOFT];
+unsigned long ssir;
 
 /* XXX For legacy software interrupts. */
 struct alpha_soft_intrhand *softnet_intrhand;
 
 /*
+ * spl0:
+ *
+ *     Lower interrupt priority to IPL 0 -- must check for
+ *     software interrupts.
+ */
+void
+spl0(void)
+{
+
+       if (ssir) {
+               (void) alpha_pal_swpipl(ALPHA_PSL_IPL_SOFT);
+               softintr_dispatch();
+       }
+
+       (void) alpha_pal_swpipl(ALPHA_PSL_IPL_0);
+}
+
+/*
  * softintr_init:
  *
  *     Initialize the software interrupt system.
@@ -424,28 +443,46 @@
        struct alpha_soft_intr *asi;
        struct alpha_soft_intrhand *sih;
        u_int64_t n, i;
-       int s;
+
+#ifdef DEBUG
+       n = alpha_pal_rdps() & ALPHA_PSL_IPL_MASK;
+       if (n != ALPHA_PSL_IPL_SOFT)
+               panic("softintr_dispatch: entry at ipl %ld", n);
+#endif
 
        KERNEL_LOCK(LK_CANRECURSE|LK_EXCLUSIVE);
 
+#ifdef DEBUG
+       n = alpha_pal_rdps() & ALPHA_PSL_IPL_MASK;
+       if (n != ALPHA_PSL_IPL_SOFT)
+               panic("softintr_dispatch: after kernel lock at ipl %ld", n);
+#endif
+
        while ((n = atomic_loadlatch_ulong(&ssir, 0)) != 0) {
                for (i = 0; i < IPL_NSOFT; i++) {
                        if ((n & (1 << i)) == 0)
                                continue;
+
                        asi = &alpha_soft_intrs[i];
 
                        asi->softintr_evcnt.ev_count++;
 
                        for (;;) {
-                               alpha_softintr_lock(asi, s);
+                               (void) alpha_pal_swpipl(ALPHA_PSL_IPL_HIGH);
+                               simple_lock(&asi->softintr_slock);
+
                                sih = TAILQ_FIRST(&asi->softintr_q);
-                               if (sih == NULL) {
-                                       alpha_softintr_unlock(asi, s);
+                               if (sih != NULL) {
+                                       TAILQ_REMOVE(&asi->softintr_q, sih,
+                                           sih_q);
+                                       sih->sih_pending = 0;
+                               }
+
+                               simple_unlock(&asi->softintr_slock);
+                               (void) alpha_pal_swpipl(ALPHA_PSL_IPL_SOFT);
+
+                               if (sih == NULL)
                                        break;
-                               }
-                               TAILQ_REMOVE(&asi->softintr_q, sih, sih_q);
-                               sih->sih_pending = 0;
-                               alpha_softintr_unlock(asi, s);
 
                                uvmexp.softs++;
                                (*sih->sih_fn)(sih->sih_arg);
@@ -494,12 +531,14 @@
        struct alpha_soft_intr *asi = sih->sih_intrhead;
        int s;
 
-       alpha_softintr_lock(asi, s);
+       s = splhigh();
+       simple_lock(&asi->softintr_slock);
        if (sih->sih_pending) {
                TAILQ_REMOVE(&asi->softintr_q, sih, sih_q);
                sih->sih_pending = 0;
        }
-       alpha_softintr_unlock(asi, s);
+       simple_unlock(&asi->softintr_slock);
+       splx(s);
 
        free(sih, M_DEVBUF);
 }
diff -r 73cce8583d04 -r 74afc7bb3701 sys/arch/alpha/alpha/locore.s
--- a/sys/arch/alpha/alpha/locore.s     Sun Apr 15 22:33:37 2001 +0000
+++ b/sys/arch/alpha/alpha/locore.s     Sun Apr 15 23:07:34 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.s,v 1.89 2001/04/10 10:09:45 ross Exp $ */
+/* $NetBSD: locore.s,v 1.90 2001/04/15 23:07:34 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@@ -72,7 +72,7 @@
 
 #include <machine/asm.h>
 
-__KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.89 2001/04/10 10:09:45 ross Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.90 2001/04/15 23:07:34 thorpej Exp $");
 
 #include "assym.h"
 
@@ -303,7 +303,7 @@
  * exception_return: return from trap, exception, or syscall
  */
 
-BSS(ssir, 8)
+IMPORT(ssir, 8)
 
 LEAF(exception_return, 1)                      /* XXX should be NESTED */
        br      pv, 1f
diff -r 73cce8583d04 -r 74afc7bb3701 sys/arch/alpha/alpha/machdep.c
--- a/sys/arch/alpha/alpha/machdep.c    Sun Apr 15 22:33:37 2001 +0000
+++ b/sys/arch/alpha/alpha/machdep.c    Sun Apr 15 23:07:34 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.231 2001/03/15 06:10:32 chs Exp $ */
+/* $NetBSD: machdep.c,v 1.232 2001/04/15 23:07:34 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.231 2001/03/15 06:10:32 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.232 2001/04/15 23:07:34 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1846,18 +1846,6 @@
 #endif /* MULTIPROCESSOR */
 }
 
-void
-spl0()
-{
-
-       if (ssir) {
-               (void) alpha_pal_swpipl(ALPHA_PSL_IPL_SOFT);
-               softintr_dispatch();
-       }
-
-       (void) alpha_pal_swpipl(ALPHA_PSL_IPL_0);
-}
-
 /*
  * The following primitives manipulate the run queues.  _whichqs tells which
  * of the 32 queues _qs have processes in them.  Setrunqueue puts processes
diff -r 73cce8583d04 -r 74afc7bb3701 sys/arch/alpha/include/intr.h
--- a/sys/arch/alpha/include/intr.h     Sun Apr 15 22:33:37 2001 +0000
+++ b/sys/arch/alpha/include/intr.h     Sun Apr 15 23:07:34 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: intr.h,v 1.42 2001/04/14 00:45:13 thorpej Exp $ */
+/* $NetBSD: intr.h,v 1.43 2001/04/15 23:07:35 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -207,7 +207,7 @@
 /*
  * simulated software interrupt register
  */
-extern u_int64_t ssir;
+extern unsigned long ssir;
 
 #define        setsoft(x)      atomic_setbits_ulong(&ssir, 1 << (x))
 
@@ -228,18 +228,6 @@
        unsigned long softintr_ipl;
 };
 
-#define        alpha_softintr_lock(asi, s)                                     \
-do {                                                                   \
-       (s) = splhigh();                                                \
-       simple_lock(&(asi)->softintr_slock);                            \
-} while (/*CONSTCOND*/0)
-
-#define        alpha_softintr_unlock(asi, s)                                   \
-do {                                                                   \
-       simple_unlock(&(asi)->softintr_slock);                          \
-       splx((s));                                                      \
-} while (/*CONSTCOND*/0)
-
 void   *softintr_establish(int, void (*)(void *), void *);
 void   softintr_disestablish(void *);
 void   softintr_init(void);
@@ -251,13 +239,15 @@
        struct alpha_soft_intr *__si = __sih->sih_intrhead;             \
        int __s;                                                        \
                                                                        \
-       alpha_softintr_lock(__si, __s);                                 \
+       __s = splhigh();                                                \
+       simple_lock(&__si->softintr_slock);                             \
        if (__sih->sih_pending == 0) {                                  \
                TAILQ_INSERT_TAIL(&__si->softintr_q, __sih, sih_q);     \
                __sih->sih_pending = 1;                                 \
                setsoft(__si->softintr_ipl);                            \
        }                                                               \
-       alpha_softintr_unlock(__si, __s);                               \
+       simple_unlock(&__si->softintr_slock);                           \
+       splx(__s);                                                      \
 } while (0)
 
 /* XXX For legacy software interrupts. */



Home | Main Index | Thread Index | Old Index