Collapse gd_astpending and gd_reqpri together into gd_reqflags. gd_reqflags
authorMatthew Dillon <dillon@dragonflybsd.org>
Sat, 12 Jul 2003 17:54:36 +0000 (17:54 +0000)
committerMatthew Dillon <dillon@dragonflybsd.org>
Sat, 12 Jul 2003 17:54:36 +0000 (17:54 +0000)
now rollsup requests made pending for doreti.  Cleanup a number of scheduling
primitives and note that we do not need to use locked bus cycles on per-cpu
variables.

Note that the aweful idelayed hack for certain softints (used only by the TTY
subsystem, BTW) gets slightly broken in this commit because idelayed has become
per-cpu and the clock ints aren't yet distributed.

37 files changed:
sys/cpu/i386/include/cpu.h
sys/ddb/db_ps.c
sys/i386/apic/apic_vector.s
sys/i386/i386/exception.s
sys/i386/i386/genassym.c
sys/i386/i386/globals.s
sys/i386/i386/trap.c
sys/i386/icu/icu_vector.s
sys/i386/include/cpu.h
sys/i386/include/globaldata.h
sys/i386/include/ipl.h
sys/i386/isa/apic_vector.s
sys/i386/isa/icu_vector.s
sys/i386/isa/intr_machdep.c
sys/i386/isa/ipl.s
sys/i386/isa/ipl_funcs.c
sys/kern/kern_sig.c
sys/kern/lwkt_thread.c
sys/kern/subr_prof.c
sys/platform/pc32/apic/apic_vector.s
sys/platform/pc32/i386/exception.s
sys/platform/pc32/i386/genassym.c
sys/platform/pc32/i386/globals.s
sys/platform/pc32/i386/trap.c
sys/platform/pc32/icu/icu_vector.s
sys/platform/pc32/include/globaldata.h
sys/platform/pc32/include/ipl.h
sys/platform/pc32/isa/apic_vector.s
sys/platform/pc32/isa/icu_vector.s
sys/platform/pc32/isa/intr_machdep.c
sys/platform/pc32/isa/ipl.s
sys/platform/pc32/isa/ipl_funcs.c
sys/platform/vkernel/i386/genassym.c
sys/sys/globaldata.h
sys/sys/proc.h
sys/sys/thread.h
sys/sys/thread2.h

index 71f1bf4..cafca62 100644 (file)
@@ -35,7 +35,7 @@
  *
  *     from: @(#)cpu.h 5.4 (Berkeley) 5/9/91
  * $FreeBSD: src/sys/i386/include/cpu.h,v 1.43.2.2 2001/06/15 09:37:57 scottl Exp $
- * $DragonFly: src/sys/cpu/i386/include/cpu.h,v 1.7 2003/07/10 04:47:53 dillon Exp $
+ * $DragonFly: src/sys/cpu/i386/include/cpu.h,v 1.8 2003/07/12 17:54:34 dillon Exp $
  */
 
 #ifndef _MACHINE_CPU_H_
  *
  * We do not have to use a locked bus cycle but we do have to use an
  * atomic instruction because an interrupt on the local cpu can modify
- * the field.
+ * the gd_reqflags field.
  */
 #define        need_resched()          \
-    atomic_set_int_nonlocked(&mycpu->gd_astpending, AST_RESCHED|AST_PENDING)
+    atomic_set_int_nonlocked(&mycpu->gd_reqflags, RQF_AST_RESCHED)
+#define        need_proftick()         \
+    atomic_set_int_nonlocked(&mycpu->gd_reqflags, RQF_AST_OWEUPC)
+#define        signotify()             \
+    atomic_set_int_nonlocked(&mycpu->gd_reqflags, RQF_AST_SIGNAL)
 #define        clear_resched()         \
-    atomic_clear_int_nonlocked(&mycpu->gd_astpending, AST_RESCHED)
-#define        resched_wanted()        (mycpu->gd_astpending & AST_RESCHED)
-
-/*
- * Arrange to handle pending profiling ticks before returning to user mode.
- *
- * XXX this is now poorly named and implemented.  It used to handle only a
- * single tick and the P_OWEUPC flag served as a counter.  Now there is a
- * counter in the proc table and flag isn't really necessary.
- */
-#define        need_proftick(p) \
-       do { (p)->p_flag |= P_OWEUPC; aston(); } while (0)
-
-/*
- * Notify the current process (p) that it has a signal pending,
- * process as soon as possible.
- *
- * XXX: aston() really needs to be an atomic (not locked, but an orl),
- * in case need_resched() is set by an interrupt.  But with astpending a
- * per-cpu variable this is not trivial to do efficiently.  For now we blow
- * it off (asynchronous need_resched() conflicts are not critical).
- */
-#define        signotify(p)    aston()
-
-#define        aston()                 do { mycpu->gd_astpending |= AST_PENDING; } while (0)
-#define astoff()
+    atomic_clear_int_nonlocked(&mycpu->gd_reqflags, RQF_AST_RESCHED)
+#define        resched_wanted()        \
+    (mycpu->gd_reqflags & RQF_AST_RESCHED)
 
 /*
  * CTL_MACHDEP definitions.
index ca2c3b5..3f5a8c4 100644 (file)
@@ -31,7 +31,7 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/ddb/db_ps.c,v 1.20 1999/08/28 00:41:09 peter Exp $
- * $DragonFly: src/sys/ddb/db_ps.c,v 1.7 2003/07/10 04:47:49 dillon Exp $
+ * $DragonFly: src/sys/ddb/db_ps.c,v 1.8 2003/07/12 17:54:30 dillon Exp $
  */
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -123,9 +123,9 @@ db_ps(dummy1, dummy2, dummy3, dummy4)
            thread_t td;
            struct globaldata *gd = &CPU_prvspace[cpuidx].mdglobaldata.mi;
 
-           db_printf("cpu %d tdrunqmask %08x curthread %p ast %02x\n",
+           db_printf("cpu %d tdrunqmask %08x curthread %p reqflags %04x\n",
                    gd->gd_cpuid, gd->gd_runqmask,
-                   gd->gd_curthread, gd->gd_astpending);
+                   gd->gd_curthread, gd->gd_reqflags);
            db_printf("  tdq     thread    pid flags  pri(act)        sp    wmesg comm\n");
            for (np = 0; np < 32; ++np) {
                TAILQ_FOREACH(td, &gd->gd_tdrunq[np], td_threadq) {
index 2714a33..3de9dcb 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *     from: vector.s, 386BSD 0.1 unknown origin
  * $FreeBSD: src/sys/i386/isa/apic_vector.s,v 1.47.2.5 2001/09/01 22:33:38 tegge Exp $
- * $DragonFly: src/sys/i386/apic/Attic/apic_vector.s,v 1.11 2003/07/12 16:55:50 dillon Exp $
+ * $DragonFly: src/sys/i386/apic/Attic/apic_vector.s,v 1.12 2003/07/12 17:54:35 dillon Exp $
  */
 
 
@@ -163,7 +163,7 @@ IDTVEC(vec_name) ;                                                  \
        /* in critical section, make interrupt pending */               \
        /* set the pending bit and return, leave interrupt masked */    \
        orl     $IRQ_LBIT(irq_num),PCPU(fpending) ;                     \
-       movl    $TDPRI_CRIT, PCPU(reqpri) ;                             \
+       orl     $RQF_INTPEND,PCPU(reqflags) ;                           \
        jmp     5f ;                                                    \
 2: ;                                                                   \
        /* try to get the MP lock */                                    \
@@ -273,7 +273,7 @@ IDTVEC(vec_name) ;                                                  \
 1: ;                                                                   \
        /* set the pending bit and return, leave the interrupt masked */ \
        orl     $IRQ_LBIT(irq_num), PCPU(ipending) ;                    \
-       movl    $TDPRI_CRIT, PCPU(reqpri) ;                             \
+       orl     $RQF_INTPEND,PCPU(reqflags) ;                           \
        jmp     5f ;                                                    \
 2: ;                                                                   \
        /* set running bit, clear pending bit, run handler */           \
@@ -490,8 +490,7 @@ Xipiq:
        MEXITCOUNT
        jmp     doreti
 1:
-       movl    $TDPRI_CRIT,PCPU(reqpri)
-       orl     $AST_IPIQ,PCPU(astpending)
+       orl     $RQF_IPIQ,PCPU(reqflags)
        MEXITCOUNT
        POP_FRAME
        iret
index dfa5a92..f652ce4 100644 (file)
@@ -31,7 +31,7 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/i386/i386/exception.s,v 1.65.2.3 2001/08/15 01:23:49 peter Exp $
- * $DragonFly: src/sys/i386/i386/Attic/exception.s,v 1.13 2003/07/11 17:42:08 dillon Exp $
+ * $DragonFly: src/sys/i386/i386/Attic/exception.s,v 1.14 2003/07/12 17:54:32 dillon Exp $
  */
 
 #include "npx.h"
@@ -263,8 +263,8 @@ IDTVEC(syscall)
        incl    PCPU(cnt)+V_SYSCALL     /* YYY per-cpu */
        call    syscall2
        MEXITCOUNT
-       cli                             /* atomic astpending access */
-       cmpl    $0,PCPU(astpending)
+       cli                             /* atomic reqflags interlock w/iret */
+       cmpl    $0,PCPU(reqflags)
        je      doreti_syscall_ret
        pushl   $0                      /* cpl to restore */
        movl    $1,PCPU(intr_nesting_level)
@@ -297,8 +297,8 @@ IDTVEC(int0x80_syscall)
        incl    PCPU(cnt)+V_SYSCALL     /* YYY per-cpu */
        call    syscall2
        MEXITCOUNT
-       cli                             /* atomic astpending access */
-       cmpl    $0,PCPU(astpending)
+       cli                             /* atomic reqflags interlock w/irq */
+       cmpl    $0,PCPU(reqflags)
        je      doreti_syscall_ret
        pushl   $0                      /* cpl to restore */
        movl    $1,PCPU(intr_nesting_level)
index 7ee752d..7cbca5f 100644 (file)
@@ -35,7 +35,7 @@
  *
  *     from: @(#)genassym.c    5.11 (Berkeley) 5/10/91
  * $FreeBSD: src/sys/i386/i386/genassym.c,v 1.86.2.3 2002/03/03 05:42:49 nyan Exp $
- * $DragonFly: src/sys/i386/i386/Attic/genassym.c,v 1.25 2003/07/12 16:55:47 dillon Exp $
+ * $DragonFly: src/sys/i386/i386/Attic/genassym.c,v 1.26 2003/07/12 17:54:32 dillon Exp $
  */
 
 #include "opt_user_ldt.h"
@@ -187,17 +187,23 @@ ASSYM(BI_ESYMTAB, offsetof(struct bootinfo, bi_esymtab));
 ASSYM(BI_KERNEND, offsetof(struct bootinfo, bi_kernend));
 
 ASSYM(GD_CURTHREAD, offsetof(struct mdglobaldata, mi.gd_curthread));
-ASSYM(GD_REQPRI, offsetof(struct mdglobaldata, mi.gd_reqpri));
 ASSYM(GD_CPUID, offsetof(struct mdglobaldata, mi.gd_cpuid));
 ASSYM(GD_CNT, offsetof(struct mdglobaldata, mi.gd_cnt));
 ASSYM(GD_PRIVATE_TSS, offsetof(struct mdglobaldata, gd_private_tss));
 ASSYM(GD_INTR_NESTING_LEVEL, offsetof(struct mdglobaldata, mi.gd_intr_nesting_level));
-ASSYM(GD_ASTPENDING, offsetof(struct mdglobaldata, mi.gd_astpending));
+ASSYM(GD_REQFLAGS, offsetof(struct mdglobaldata, mi.gd_reqflags));
 
 #ifdef USER_LDT
 ASSYM(GD_CURRENTLDT, offsetof(struct mdglobaldata, gd_currentldt));
 #endif
 
+ASSYM(RQF_IPIQ, RQF_IPIQ);
+ASSYM(RQF_INTPEND, RQF_INTPEND);
+ASSYM(RQF_AST_OWEUPC, RQF_AST_OWEUPC);
+ASSYM(RQF_AST_SIGNAL, RQF_AST_SIGNAL);
+ASSYM(RQF_AST_RESCHED, RQF_AST_RESCHED);
+ASSYM(RQF_AST_MASK, RQF_AST_MASK);
+
 ASSYM(GD_FPENDING, offsetof(struct mdglobaldata, gd_fpending));
 ASSYM(GD_IPENDING, offsetof(struct mdglobaldata, gd_ipending));
 ASSYM(GD_COMMON_TSS, offsetof(struct mdglobaldata, gd_common_tss));
index c58310c..fda07c0 100644 (file)
@@ -24,7 +24,7 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/i386/i386/globals.s,v 1.13.2.1 2000/05/16 06:58:06 dillon Exp $
- * $DragonFly: src/sys/i386/i386/Attic/globals.s,v 1.16 2003/07/10 04:47:53 dillon Exp $
+ * $DragonFly: src/sys/i386/i386/Attic/globals.s,v 1.17 2003/07/12 17:54:32 dillon Exp $
  */
 
 #include "opt_user_ldt.h"
         * Define layout of the global data.  On SMP this lives in
         * the per-cpu address space, otherwise it's in the data segment.
         */
-       .globl  gd_curthread, gd_npxthread, gd_astpending, gd_reqpri
-       .globl  gd_common_tss
+       .globl  gd_curthread, gd_npxthread, gd_reqflags, gd_common_tss
        .set    gd_curthread,globaldata + GD_CURTHREAD
-       .set    gd_astpending,globaldata + GD_ASTPENDING
-       .set    gd_reqpri,globaldata + GD_REQPRI
        .set    gd_npxthread,globaldata + GD_NPXTHREAD
+       .set    gd_reqflags,globaldata + GD_REQFLAGS
        .set    gd_common_tss,globaldata + GD_COMMON_TSS
 
        .globl  gd_common_tssd, gd_tss_gdt
index c3b6680..cbe3b9b 100644 (file)
@@ -36,7 +36,7 @@
  *
  *     from: @(#)trap.c        7.4 (Berkeley) 5/13/91
  * $FreeBSD: src/sys/i386/i386/trap.c,v 1.147.2.11 2003/02/27 19:09:59 luoqi Exp $
- * $DragonFly: src/sys/i386/i386/Attic/trap.c,v 1.23 2003/07/11 23:26:15 dillon Exp $
+ * $DragonFly: src/sys/i386/i386/Attic/trap.c,v 1.24 2003/07/12 17:54:32 dillon Exp $
  */
 
 /*
@@ -431,10 +431,10 @@ restart:
                        break;
 
                case T_ASTFLT:          /* Allow process switch */
-                       astoff();
                        mycpu->gd_cnt.v_soft++;
-                       if (p->p_flag & P_OWEUPC) {
-                               p->p_flag &= ~P_OWEUPC;
+                       if (mycpu->gd_reqflags & RQF_AST_OWEUPC) {
+                               atomic_clear_int_nonlocked(&mycpu->gd_reqflags,
+                                           RQF_AST_OWEUPC);
                                addupc_task(p, p->p_stats->p_prof.pr_addr,
                                            p->p_stats->p_prof.pr_ticks);
                        }
index 79ea6ce..d121616 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *     from: vector.s, 386BSD 0.1 unknown origin
  * $FreeBSD: src/sys/i386/isa/icu_vector.s,v 1.14.2.2 2000/07/18 21:12:42 dfr Exp $
- * $DragonFly: src/sys/i386/icu/Attic/icu_vector.s,v 1.12 2003/07/08 06:27:27 dillon Exp $
+ * $DragonFly: src/sys/i386/icu/Attic/icu_vector.s,v 1.13 2003/07/12 17:54:35 dillon Exp $
  */
 
 /*
@@ -130,7 +130,7 @@ IDTVEC(vec_name) ;                                                  \
 1: ;                                                                   \
        /* set pending bit and return, leave interrupt masked */        \
        orl     $IRQ_LBIT(irq_num),PCPU(fpending) ;                     \
-       movl    $TDPRI_CRIT, PCPU(reqpri) ;                             \
+       orl     $RQF_INTPEND, PCPU(reqflags) ;                          \
        jmp     5f ;                                                    \
 2: ;                                                                   \
        /* clear pending bit, run handler */                            \
@@ -220,7 +220,7 @@ IDTVEC(vec_name) ;                                                  \
 1: ;                                                                   \
        /* set the pending bit and return, leave interrupt masked */    \
        orl     $IRQ_LBIT(irq_num), PCPU(ipending) ;                    \
-       movl    $TDPRI_CRIT, PCPU(reqpri) ;                             \
+       orl     $RQF_INTPEND, PCPU(reqflags) ;                          \
        jmp     5f ;                                                    \
 2: ;                                                                   \
        /* set running bit, clear pending bit, run handler */           \
index 3afae06..1cf874a 100644 (file)
@@ -35,7 +35,7 @@
  *
  *     from: @(#)cpu.h 5.4 (Berkeley) 5/9/91
  * $FreeBSD: src/sys/i386/include/cpu.h,v 1.43.2.2 2001/06/15 09:37:57 scottl Exp $
- * $DragonFly: src/sys/i386/include/Attic/cpu.h,v 1.7 2003/07/10 04:47:53 dillon Exp $
+ * $DragonFly: src/sys/i386/include/Attic/cpu.h,v 1.8 2003/07/12 17:54:34 dillon Exp $
  */
 
 #ifndef _MACHINE_CPU_H_
  *
  * We do not have to use a locked bus cycle but we do have to use an
  * atomic instruction because an interrupt on the local cpu can modify
- * the field.
+ * the gd_reqflags field.
  */
 #define        need_resched()          \
-    atomic_set_int_nonlocked(&mycpu->gd_astpending, AST_RESCHED|AST_PENDING)
+    atomic_set_int_nonlocked(&mycpu->gd_reqflags, RQF_AST_RESCHED)
+#define        need_proftick()         \
+    atomic_set_int_nonlocked(&mycpu->gd_reqflags, RQF_AST_OWEUPC)
+#define        signotify()             \
+    atomic_set_int_nonlocked(&mycpu->gd_reqflags, RQF_AST_SIGNAL)
 #define        clear_resched()         \
-    atomic_clear_int_nonlocked(&mycpu->gd_astpending, AST_RESCHED)
-#define        resched_wanted()        (mycpu->gd_astpending & AST_RESCHED)
-
-/*
- * Arrange to handle pending profiling ticks before returning to user mode.
- *
- * XXX this is now poorly named and implemented.  It used to handle only a
- * single tick and the P_OWEUPC flag served as a counter.  Now there is a
- * counter in the proc table and flag isn't really necessary.
- */
-#define        need_proftick(p) \
-       do { (p)->p_flag |= P_OWEUPC; aston(); } while (0)
-
-/*
- * Notify the current process (p) that it has a signal pending,
- * process as soon as possible.
- *
- * XXX: aston() really needs to be an atomic (not locked, but an orl),
- * in case need_resched() is set by an interrupt.  But with astpending a
- * per-cpu variable this is not trivial to do efficiently.  For now we blow
- * it off (asynchronous need_resched() conflicts are not critical).
- */
-#define        signotify(p)    aston()
-
-#define        aston()                 do { mycpu->gd_astpending |= AST_PENDING; } while (0)
-#define astoff()
+    atomic_clear_int_nonlocked(&mycpu->gd_reqflags, RQF_AST_RESCHED)
+#define        resched_wanted()        \
+    (mycpu->gd_reqflags & RQF_AST_RESCHED)
 
 /*
  * CTL_MACHDEP definitions.
index a2c46f5..ec3f169 100644 (file)
@@ -28,7 +28,7 @@
  *     should not include this file.
  *
  * $FreeBSD: src/sys/i386/include/globaldata.h,v 1.11.2.1 2000/05/16 06:58:10 dillon Exp $
- * $DragonFly: src/sys/i386/include/Attic/globaldata.h,v 1.17 2003/07/10 04:47:53 dillon Exp $
+ * $DragonFly: src/sys/i386/include/Attic/globaldata.h,v 1.18 2003/07/12 17:54:34 dillon Exp $
  */
 
 #ifndef _MACHINE_GLOBALDATA_H_
@@ -67,6 +67,7 @@ struct mdglobaldata {
        struct i386tss  gd_common_tss;
        int             gd_fpending;    /* fast interrupt pending */
        int             gd_ipending;    /* normal interrupt pending */
+       int             gd_idelayed;    /* delayed software ints */
        int             gd_currentldt;  /* USER_LDT */
        int             gd_private_tss;
        u_int           gd_cpu_lockid;
index 5c10d17..c6827f7 100644 (file)
@@ -31,7 +31,7 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/i386/include/ipl.h,v 1.17.2.3 2002/12/17 18:04:02 sam Exp $
- * $DragonFly: src/sys/i386/include/Attic/ipl.h,v 1.4 2003/07/08 06:27:26 dillon Exp $
+ * $DragonFly: src/sys/i386/include/Attic/ipl.h,v 1.5 2003/07/12 17:54:34 dillon Exp $
  */
 
 #ifndef _MACHINE_IPL_H_
 #define        SWI_LOW_MASK    (SWI_TQ_PENDING | SWI_CLOCK_MASK)
 #define        SWI_MASK        (~HWI_MASK)
 
-/*
- * astpending bits
- */
-#define        AST_PENDING     0x00000001
-#define        AST_RESCHED     0x00000002
-#define        AST_IPIQ        0x00000004
-
 #ifndef        LOCORE
 
 /*
index 9d4c071..562ce79 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *     from: vector.s, 386BSD 0.1 unknown origin
  * $FreeBSD: src/sys/i386/isa/apic_vector.s,v 1.47.2.5 2001/09/01 22:33:38 tegge Exp $
- * $DragonFly: src/sys/i386/isa/Attic/apic_vector.s,v 1.11 2003/07/12 16:55:50 dillon Exp $
+ * $DragonFly: src/sys/i386/isa/Attic/apic_vector.s,v 1.12 2003/07/12 17:54:35 dillon Exp $
  */
 
 
@@ -163,7 +163,7 @@ IDTVEC(vec_name) ;                                                  \
        /* in critical section, make interrupt pending */               \
        /* set the pending bit and return, leave interrupt masked */    \
        orl     $IRQ_LBIT(irq_num),PCPU(fpending) ;                     \
-       movl    $TDPRI_CRIT, PCPU(reqpri) ;                             \
+       orl     $RQF_INTPEND,PCPU(reqflags) ;                           \
        jmp     5f ;                                                    \
 2: ;                                                                   \
        /* try to get the MP lock */                                    \
@@ -273,7 +273,7 @@ IDTVEC(vec_name) ;                                                  \
 1: ;                                                                   \
        /* set the pending bit and return, leave the interrupt masked */ \
        orl     $IRQ_LBIT(irq_num), PCPU(ipending) ;                    \
-       movl    $TDPRI_CRIT, PCPU(reqpri) ;                             \
+       orl     $RQF_INTPEND,PCPU(reqflags) ;                           \
        jmp     5f ;                                                    \
 2: ;                                                                   \
        /* set running bit, clear pending bit, run handler */           \
@@ -490,8 +490,7 @@ Xipiq:
        MEXITCOUNT
        jmp     doreti
 1:
-       movl    $TDPRI_CRIT,PCPU(reqpri)
-       orl     $AST_IPIQ,PCPU(astpending)
+       orl     $RQF_IPIQ,PCPU(reqflags)
        MEXITCOUNT
        POP_FRAME
        iret
index 7b3c49b..a991b1b 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *     from: vector.s, 386BSD 0.1 unknown origin
  * $FreeBSD: src/sys/i386/isa/icu_vector.s,v 1.14.2.2 2000/07/18 21:12:42 dfr Exp $
- * $DragonFly: src/sys/i386/isa/Attic/icu_vector.s,v 1.12 2003/07/08 06:27:27 dillon Exp $
+ * $DragonFly: src/sys/i386/isa/Attic/icu_vector.s,v 1.13 2003/07/12 17:54:35 dillon Exp $
  */
 
 /*
@@ -130,7 +130,7 @@ IDTVEC(vec_name) ;                                                  \
 1: ;                                                                   \
        /* set pending bit and return, leave interrupt masked */        \
        orl     $IRQ_LBIT(irq_num),PCPU(fpending) ;                     \
-       movl    $TDPRI_CRIT, PCPU(reqpri) ;                             \
+       orl     $RQF_INTPEND, PCPU(reqflags) ;                          \
        jmp     5f ;                                                    \
 2: ;                                                                   \
        /* clear pending bit, run handler */                            \
@@ -220,7 +220,7 @@ IDTVEC(vec_name) ;                                                  \
 1: ;                                                                   \
        /* set the pending bit and return, leave interrupt masked */    \
        orl     $IRQ_LBIT(irq_num), PCPU(ipending) ;                    \
-       movl    $TDPRI_CRIT, PCPU(reqpri) ;                             \
+       orl     $RQF_INTPEND, PCPU(reqflags) ;                          \
        jmp     5f ;                                                    \
 2: ;                                                                   \
        /* set running bit, clear pending bit, run handler */           \
index 8c0b1d5..63e06b6 100644 (file)
@@ -35,7 +35,7 @@
  *
  *     from: @(#)isa.c 7.2 (Berkeley) 5/13/91
  * $FreeBSD: src/sys/i386/isa/intr_machdep.c,v 1.29.2.5 2001/10/14 06:54:27 luigi Exp $
- * $DragonFly: src/sys/i386/isa/Attic/intr_machdep.c,v 1.10 2003/07/12 16:55:50 dillon Exp $
+ * $DragonFly: src/sys/i386/isa/Attic/intr_machdep.c,v 1.11 2003/07/12 17:54:35 dillon Exp $
  */
 /*
  * This file contains an aggregated module marked:
@@ -985,7 +985,7 @@ forward_fastint_remote(void *arg)
     struct mdglobaldata *gd = mdcpu;
 
     atomic_set_int_nonlocked(&gd->gd_fpending, 1 << irq);
-    gd->mi.gd_reqpri = TDPRI_CRIT;
+    atomic_set_int_nonlocked(&gd->mi.gd_reqflags, RQF_INTPEND);
 }
 
 #endif
index 6fe1c50..beffc68 100644 (file)
@@ -37,7 +37,7 @@
  *     @(#)ipl.s
  *
  * $FreeBSD: src/sys/i386/isa/ipl.s,v 1.32.2.3 2002/05/16 16:03:56 bde Exp $
- * $DragonFly: src/sys/i386/isa/Attic/ipl.s,v 1.9 2003/07/11 22:30:07 dillon Exp $
+ * $DragonFly: src/sys/i386/isa/Attic/ipl.s,v 1.10 2003/07/12 17:54:35 dillon Exp $
  */
 
 
@@ -85,6 +85,8 @@ doreti:
        popl    %eax                    /* cpl to restore */
        movl    PCPU(curthread),%ebx
        cli                             /* interlock with TDPRI_CRIT */
+       cmpl    $0,PCPU(reqflags)       /* short cut if nothing to do */
+       je      5f
        movl    %eax,TD_CPL(%ebx)       /* save cpl being restored */
        cmpl    $TDPRI_CRIT,TD_PRI(%ebx) /* can't unpend if in critical sec */
        jge     5f
@@ -95,7 +97,7 @@ doreti_next:
        notl    %ecx
        cli                             /* disallow YYY remove */
 #ifdef SMP
-       testl   $AST_IPIQ,PCPU(astpending)
+       testl   $RQF_IPIQ,PCPU(reqflags)
        jnz     doreti_ipiq
 #endif
        testl   PCPU(fpending),%ecx     /* check for an unmasked fast int */
@@ -103,26 +105,27 @@ doreti_next:
 
        testl   PCPU(ipending),%ecx
        jnz     doreti_intr
-       testl   $AST_PENDING,PCPU(astpending) /* any pending ASTs? */
+
+       testl   $RQF_AST_MASK,PCPU(reqflags) /* any pending ASTs? */
        jz      2f
        testl   $PSL_VM,TF_EFLAGS(%esp)
        jz      1f
-       cmpl    $1,in_vm86call          /* YYY make per 'cpu' */
-       jnz     doreti_ast2
+       cmpl    $1,in_vm86call          /* YYY make per 'cpu'? */
+       jnz     doreti_ast
 1:
        testb   $SEL_RPL_MASK,TF_CS(%esp)
-       jnz     doreti_ast2
+       jnz     doreti_ast
 2:
        /*
         * Nothing left to do, finish up.  Interrupts are still disabled.
         * If our temporary cpl mask is 0 then we have processed everything
         * (including any pending fast ints requiring the MP lock), and
-        * we can clear reqpri.
+        * we can clear reqflags.
         */
        subl    $TDPRI_CRIT,TD_PRI(%ebx)        /* interlocked with cli */
        testl   %eax,%eax
        jnz     5f
-       movl    $0,PCPU(reqpri)
+       movl    $0,PCPU(reqflags)
 5:
        decl    PCPU(intr_nesting_level)
        MEXITCOUNT
@@ -212,29 +215,17 @@ doreti_intr:
        jmp     doreti_next
 
        /*
-        * AST pending
+        * AST pending.  We clear RQF_AST_SIGNAL automatically, the others
+        * are cleared by the trap as they are processed.
         *
         * Temporarily back-out our critical section because trap() can be
         * a long-winded call, and we want to be more syscall-like.  
         *
-        * YYY If we came in from user mode (doreti_ast1) we can call
-        * lwkt_switch *RIGHT* *NOW* to deal with interrupts more quickly,
-        * but should still fall through to the trap code to properly 
-        * reschedule.
+        * YYY theoretically we can call lwkt_switch directly if all we need
+        * to do is a reschedule.
         */
-#if 0
-doreti_ast1:
-       andl    $~AST_PENDING,PCPU(astpending)
-       sti
-       movl    %eax,%esi               /* save cpl (can't use stack) */
-       movl    $T_ASTFLT,TF_TRAPNO(%esp)
-       decl    PCPU(intr_nesting_level) /* syscall-like, not interrupt-like */
-       subl    $TDPRI_CRIT,TD_PRI(%ebx)
-       call    lwkt_switch
-       jmp     1f
-#endif
-doreti_ast2:
-       andl    $~AST_PENDING,PCPU(astpending)
+doreti_ast:
+       andl    $~RQF_AST_SIGNAL,PCPU(reqflags)
        sti
        movl    %eax,%esi               /* save cpl (can't use stack) */
        movl    $T_ASTFLT,TF_TRAPNO(%esp)
@@ -248,10 +239,10 @@ doreti_ast2:
 
 #ifdef SMP
        /*
-        * IPIQ message pending
+        * IPIQ message pending.  We clear RQF_IPIQ automatically.
         */
 doreti_ipiq:
-       andl    $~AST_IPIQ,PCPU(astpending)
+       andl    $~RQF_IPIQ,PCPU(reqflags)
        call    lwkt_process_ipiq
        movl    TD_CPL(%ebx),%eax       /* retrieve cpl again for loop */
        jmp     doreti_next
@@ -280,7 +271,7 @@ splz_next:
        movl    %eax,%ecx               /* ecx = ~CPL */
        notl    %ecx
 #ifdef SMP
-       testl   $AST_IPIQ,PCPU(astpending)
+       testl   $RQF_IPIQ,PCPU(reqflags)
        jnz     splz_ipiq
 #endif
        testl   PCPU(fpending),%ecx     /* check for an unmasked fast int */
@@ -290,15 +281,16 @@ splz_next:
        jnz     splz_intr
 
        subl    $TDPRI_CRIT,TD_PRI(%ebx)
+
        /*
         * Nothing left to do, finish up.  Interrupts are still disabled.
         * If our temporary cpl mask is 0 then we have processed everything
         * (including any pending fast ints requiring the MP lock), and
-        * we can clear reqpri.
+        * we can clear RQF_INTPEND.
         */
        testl   %eax,%eax
        jnz     5f
-       movl    $0,PCPU(reqpri)
+       andl    $~RQF_INTPEND,PCPU(reqflags)
 5:
        popl    %ebx
        popfl
@@ -357,7 +349,7 @@ splz_intr:
 
 #ifdef SMP
 splz_ipiq:
-       andl    $~AST_IPIQ,PCPU(astpending)
+       andl    $~RQF_IPIQ,PCPU(reqflags)
        pushl   %eax
        call    lwkt_process_ipiq
        popl    %eax
index 3c7268d..e5d29e2 100644 (file)
@@ -24,7 +24,7 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/i386/isa/ipl_funcs.c,v 1.32.2.5 2002/12/17 18:04:02 sam Exp $
- * $DragonFly: src/sys/i386/isa/Attic/ipl_funcs.c,v 1.6 2003/06/29 03:28:43 dillon Exp $
+ * $DragonFly: src/sys/i386/isa/Attic/ipl_funcs.c,v 1.7 2003/07/12 17:54:35 dillon Exp $
  */
 
 #include <sys/param.h>
  *
  * Note: setbits uses a locked or, making simple cases MP safe.
  */
-#define DO_SETBITS(name, var, bits) \
-void name(void)                                        \
-{                                              \
-       atomic_set_int(var, bits);              \
-       mdcpu->mi.gd_reqpri = TDPRI_CRIT;       \
-}
-
-DO_SETBITS(setdelayed,   &mdcpu->gd_ipending, loadandclear(&idelayed))
-
-DO_SETBITS(setsoftcamnet,&mdcpu->gd_ipending, SWI_CAMNET_PENDING)
-DO_SETBITS(setsoftcambio,&mdcpu->gd_ipending, SWI_CAMBIO_PENDING)
-DO_SETBITS(setsoftclock, &mdcpu->gd_ipending, SWI_CLOCK_PENDING)
-DO_SETBITS(setsoftnet,   &mdcpu->gd_ipending, SWI_NET_PENDING)
-DO_SETBITS(setsofttty,   &mdcpu->gd_ipending, SWI_TTY_PENDING)
-DO_SETBITS(setsoftvm,   &mdcpu->gd_ipending, SWI_VM_PENDING)
-DO_SETBITS(setsofttq,   &mdcpu->gd_ipending, SWI_TQ_PENDING)
-DO_SETBITS(setsoftcrypto,&mdcpu->gd_ipending, SWI_CRYPTO_PENDING)
-
-DO_SETBITS(schedsoftcamnet, &idelayed, SWI_CAMNET_PENDING)
-DO_SETBITS(schedsoftcambio, &idelayed, SWI_CAMBIO_PENDING)
-DO_SETBITS(schedsoftnet, &idelayed, SWI_NET_PENDING)
-DO_SETBITS(schedsofttty, &idelayed, SWI_TTY_PENDING)
-DO_SETBITS(schedsoftvm,        &idelayed, SWI_VM_PENDING)
-DO_SETBITS(schedsofttq,        &idelayed, SWI_TQ_PENDING)
+#define DO_SETBITS(name, var, bits)                                    \
+void name(void)                                                                \
+{                                                                      \
+       struct mdglobaldata *gd = mdcpu;                                \
+       atomic_set_int_nonlocked(var, bits);                            \
+       atomic_set_int_nonlocked(&gd->mi.gd_reqflags, RQF_INTPEND);     \
+}                                                                      \
+
+DO_SETBITS(setdelayed,   &gd->gd_ipending, loadandclear(&gd->gd_idelayed))
+
+DO_SETBITS(setsoftcamnet,&gd->gd_ipending, SWI_CAMNET_PENDING)
+DO_SETBITS(setsoftcambio,&gd->gd_ipending, SWI_CAMBIO_PENDING)
+DO_SETBITS(setsoftclock, &gd->gd_ipending, SWI_CLOCK_PENDING)
+DO_SETBITS(setsoftnet,   &gd->gd_ipending, SWI_NET_PENDING)
+DO_SETBITS(setsofttty,   &gd->gd_ipending, SWI_TTY_PENDING)
+DO_SETBITS(setsoftvm,   &gd->gd_ipending, SWI_VM_PENDING)
+DO_SETBITS(setsofttq,   &gd->gd_ipending, SWI_TQ_PENDING)
+DO_SETBITS(setsoftcrypto,&gd->gd_ipending, SWI_CRYPTO_PENDING)
+
+DO_SETBITS(schedsoftcamnet, &gd->gd_idelayed, SWI_CAMNET_PENDING)
+DO_SETBITS(schedsoftcambio, &gd->gd_idelayed, SWI_CAMBIO_PENDING)
+DO_SETBITS(schedsoftnet, &gd->gd_idelayed, SWI_NET_PENDING)
+DO_SETBITS(schedsofttty, &gd->gd_idelayed, SWI_TTY_PENDING)
+DO_SETBITS(schedsoftvm,         &gd->gd_idelayed, SWI_VM_PENDING)
+DO_SETBITS(schedsofttq,         &gd->gd_idelayed, SWI_TQ_PENDING)
 /* YYY schedsoft what? */
 
 unsigned
index 38f3e79..e2213c4 100644 (file)
@@ -37,7 +37,7 @@
  *
  *     @(#)kern_sig.c  8.7 (Berkeley) 4/18/94
  * $FreeBSD: src/sys/kern/kern_sig.c,v 1.72.2.17 2003/05/16 16:34:34 obrien Exp $
- * $DragonFly: src/sys/kern/kern_sig.c,v 1.9 2003/07/11 01:23:24 dillon Exp $
+ * $DragonFly: src/sys/kern/kern_sig.c,v 1.10 2003/07/12 17:54:35 dillon Exp $
  */
 
 #include "opt_compat.h"
@@ -1163,7 +1163,7 @@ psignal(p, sig)
                 */
 #ifdef SMP
                if (p == lwkt_preempted_proc()) {
-                       signotify(p);
+                       signotify();
                } else {
                        int cpuid = p->p_thread->td_cpu;
                        if (cpuid != mycpu->gd_cpuid)
@@ -1171,7 +1171,7 @@ psignal(p, sig)
                }
 #else
                if (p == lwkt_preempted_proc())
-                       signotify(p);
+                       signotify();
 #endif
                goto out;
        }
@@ -1194,7 +1194,7 @@ signotify_remote(void *arg)
 {
        struct proc *p = arg;
        if (p == lwkt_preempted_proc())
-               signotify(p);
+               signotify();
 }
 
 #endif
index add355b..84f5579 100644 (file)
@@ -28,7 +28,7 @@
  *     to use a critical section to avoid problems.  Foreign thread 
  *     scheduling is queued via (async) IPIs.
  *
- * $DragonFly: src/sys/kern/lwkt_thread.c,v 1.22 2003/07/11 22:30:09 dillon Exp $
+ * $DragonFly: src/sys/kern/lwkt_thread.c,v 1.23 2003/07/12 17:54:35 dillon Exp $
  */
 
 #include <sys/param.h>
@@ -107,14 +107,6 @@ _lwkt_enqueue(thread_t td)
        td->td_flags |= TDF_RUNQ;
        TAILQ_INSERT_TAIL(&gd->gd_tdrunq[nq], td, td_threadq);
        gd->gd_runqmask |= 1 << nq;
-#if 0
-       /* 
-        * YYY needs cli/sti protection? gd_reqpri set by interrupt
-        * when made pending.  need better mechanism.
-        */
-       if (gd->gd_reqpri < (td->td_pri & TDPRI_MASK))
-           gd->gd_reqpri = (td->td_pri & TDPRI_MASK);
-#endif
     }
 }
 
@@ -415,7 +407,7 @@ again:
             * pending interrupts, spin in idle if so.
             */
            ntd = &gd->gd_idlethread;
-           if (gd->gd_reqpri)
+           if (gd->gd_reqflags)
                ntd->td_flags |= TDF_IDLE_NOHLT;
        }
     }
@@ -577,7 +569,7 @@ lwkt_preempt(thread_t ntd, int critpri)
  * inside the critical section to pervent its own crit_exit() from reentering
  * lwkt_yield_quick().
  *
- * gd_reqpri indicates that *something* changed, e.g. an interrupt or softint
+ * gd_reqflags indicates that *something* changed, e.g. an interrupt or softint
  * came along but was blocked and made pending.
  *
  * (self contained on a per cpu basis)
@@ -588,7 +580,7 @@ lwkt_yield_quick(void)
     thread_t td = curthread;
 
     /*
-     * gd_reqpri is cleared in splz if the cpl is 0.  If we were to clear
+     * gd_reqflags is cleared in splz if the cpl is 0.  If we were to clear
      * it with a non-zero cpl then we might not wind up calling splz after
      * a task switch when the critical section is exited even though the
      * new task could accept the interrupt.  YYY alternative is to have
@@ -597,9 +589,8 @@ lwkt_yield_quick(void)
      * XXX from crit_exit() only called after last crit section is released.
      * If called directly will run splz() even if in a critical section.
      */
-    if ((td->td_pri & TDPRI_MASK) < mycpu->gd_reqpri) {
+    if (mycpu->gd_reqflags)
        splz();
-    }
 
     /*
      * YYY enabling will cause wakeup() to task-switch, which really
@@ -626,7 +617,7 @@ lwkt_yield_quick(void)
 
 /*
  * This implements a normal yield which, unlike _quick, will yield to equal
- * priority threads as well.  Note that gd_reqpri tests will be handled by
+ * priority threads as well.  Note that gd_reqflags tests will be handled by
  * the crit_exit() call in lwkt_switch().
  *
  * (self contained on a per cpu basis)
index 431a754..f914b7c 100644 (file)
@@ -32,7 +32,7 @@
  *
  *     @(#)subr_prof.c 8.3 (Berkeley) 9/23/93
  * $FreeBSD: src/sys/kern/subr_prof.c,v 1.32.2.2 2000/08/03 00:09:32 ps Exp $
- * $DragonFly: src/sys/kern/subr_prof.c,v 1.3 2003/06/23 17:55:41 dillon Exp $
+ * $DragonFly: src/sys/kern/subr_prof.c,v 1.4 2003/07/12 17:54:35 dillon Exp $
  */
 
 #include <sys/param.h>
@@ -423,7 +423,7 @@ addupc_intr(p, pc, ticks)
        if ((v = fuswintr(addr)) == -1 || suswintr(addr, v + ticks) == -1) {
                prof->pr_addr = pc;
                prof->pr_ticks = ticks;
-               need_proftick(p);
+               need_proftick();
        }
 }
 
index 15cb5f5..e7e9457 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *     from: vector.s, 386BSD 0.1 unknown origin
  * $FreeBSD: src/sys/i386/isa/apic_vector.s,v 1.47.2.5 2001/09/01 22:33:38 tegge Exp $
- * $DragonFly: src/sys/platform/pc32/apic/apic_vector.s,v 1.11 2003/07/12 16:55:50 dillon Exp $
+ * $DragonFly: src/sys/platform/pc32/apic/apic_vector.s,v 1.12 2003/07/12 17:54:35 dillon Exp $
  */
 
 
@@ -163,7 +163,7 @@ IDTVEC(vec_name) ;                                                  \
        /* in critical section, make interrupt pending */               \
        /* set the pending bit and return, leave interrupt masked */    \
        orl     $IRQ_LBIT(irq_num),PCPU(fpending) ;                     \
-       movl    $TDPRI_CRIT, PCPU(reqpri) ;                             \
+       orl     $RQF_INTPEND,PCPU(reqflags) ;                           \
        jmp     5f ;                                                    \
 2: ;                                                                   \
        /* try to get the MP lock */                                    \
@@ -273,7 +273,7 @@ IDTVEC(vec_name) ;                                                  \
 1: ;                                                                   \
        /* set the pending bit and return, leave the interrupt masked */ \
        orl     $IRQ_LBIT(irq_num), PCPU(ipending) ;                    \
-       movl    $TDPRI_CRIT, PCPU(reqpri) ;                             \
+       orl     $RQF_INTPEND,PCPU(reqflags) ;                           \
        jmp     5f ;                                                    \
 2: ;                                                                   \
        /* set running bit, clear pending bit, run handler */           \
@@ -490,8 +490,7 @@ Xipiq:
        MEXITCOUNT
        jmp     doreti
 1:
-       movl    $TDPRI_CRIT,PCPU(reqpri)
-       orl     $AST_IPIQ,PCPU(astpending)
+       orl     $RQF_IPIQ,PCPU(reqflags)
        MEXITCOUNT
        POP_FRAME
        iret
index 0fe0d47..184e7c7 100644 (file)
@@ -31,7 +31,7 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/i386/i386/exception.s,v 1.65.2.3 2001/08/15 01:23:49 peter Exp $
- * $DragonFly: src/sys/platform/pc32/i386/exception.s,v 1.13 2003/07/11 17:42:08 dillon Exp $
+ * $DragonFly: src/sys/platform/pc32/i386/exception.s,v 1.14 2003/07/12 17:54:32 dillon Exp $
  */
 
 #include "npx.h"
@@ -263,8 +263,8 @@ IDTVEC(syscall)
        incl    PCPU(cnt)+V_SYSCALL     /* YYY per-cpu */
        call    syscall2
        MEXITCOUNT
-       cli                             /* atomic astpending access */
-       cmpl    $0,PCPU(astpending)
+       cli                             /* atomic reqflags interlock w/iret */
+       cmpl    $0,PCPU(reqflags)
        je      doreti_syscall_ret
        pushl   $0                      /* cpl to restore */
        movl    $1,PCPU(intr_nesting_level)
@@ -297,8 +297,8 @@ IDTVEC(int0x80_syscall)
        incl    PCPU(cnt)+V_SYSCALL     /* YYY per-cpu */
        call    syscall2
        MEXITCOUNT
-       cli                             /* atomic astpending access */
-       cmpl    $0,PCPU(astpending)
+       cli                             /* atomic reqflags interlock w/irq */
+       cmpl    $0,PCPU(reqflags)
        je      doreti_syscall_ret
        pushl   $0                      /* cpl to restore */
        movl    $1,PCPU(intr_nesting_level)
index 6392a22..719f03c 100644 (file)
@@ -35,7 +35,7 @@
  *
  *     from: @(#)genassym.c    5.11 (Berkeley) 5/10/91
  * $FreeBSD: src/sys/i386/i386/genassym.c,v 1.86.2.3 2002/03/03 05:42:49 nyan Exp $
- * $DragonFly: src/sys/platform/pc32/i386/genassym.c,v 1.25 2003/07/12 16:55:47 dillon Exp $
+ * $DragonFly: src/sys/platform/pc32/i386/genassym.c,v 1.26 2003/07/12 17:54:32 dillon Exp $
  */
 
 #include "opt_user_ldt.h"
@@ -187,17 +187,23 @@ ASSYM(BI_ESYMTAB, offsetof(struct bootinfo, bi_esymtab));
 ASSYM(BI_KERNEND, offsetof(struct bootinfo, bi_kernend));
 
 ASSYM(GD_CURTHREAD, offsetof(struct mdglobaldata, mi.gd_curthread));
-ASSYM(GD_REQPRI, offsetof(struct mdglobaldata, mi.gd_reqpri));
 ASSYM(GD_CPUID, offsetof(struct mdglobaldata, mi.gd_cpuid));
 ASSYM(GD_CNT, offsetof(struct mdglobaldata, mi.gd_cnt));
 ASSYM(GD_PRIVATE_TSS, offsetof(struct mdglobaldata, gd_private_tss));
 ASSYM(GD_INTR_NESTING_LEVEL, offsetof(struct mdglobaldata, mi.gd_intr_nesting_level));
-ASSYM(GD_ASTPENDING, offsetof(struct mdglobaldata, mi.gd_astpending));
+ASSYM(GD_REQFLAGS, offsetof(struct mdglobaldata, mi.gd_reqflags));
 
 #ifdef USER_LDT
 ASSYM(GD_CURRENTLDT, offsetof(struct mdglobaldata, gd_currentldt));
 #endif
 
+ASSYM(RQF_IPIQ, RQF_IPIQ);
+ASSYM(RQF_INTPEND, RQF_INTPEND);
+ASSYM(RQF_AST_OWEUPC, RQF_AST_OWEUPC);
+ASSYM(RQF_AST_SIGNAL, RQF_AST_SIGNAL);
+ASSYM(RQF_AST_RESCHED, RQF_AST_RESCHED);
+ASSYM(RQF_AST_MASK, RQF_AST_MASK);
+
 ASSYM(GD_FPENDING, offsetof(struct mdglobaldata, gd_fpending));
 ASSYM(GD_IPENDING, offsetof(struct mdglobaldata, gd_ipending));
 ASSYM(GD_COMMON_TSS, offsetof(struct mdglobaldata, gd_common_tss));
index f7a7a07..af18f93 100644 (file)
@@ -24,7 +24,7 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/i386/i386/globals.s,v 1.13.2.1 2000/05/16 06:58:06 dillon Exp $
- * $DragonFly: src/sys/platform/pc32/i386/globals.s,v 1.16 2003/07/10 04:47:53 dillon Exp $
+ * $DragonFly: src/sys/platform/pc32/i386/globals.s,v 1.17 2003/07/12 17:54:32 dillon Exp $
  */
 
 #include "opt_user_ldt.h"
         * Define layout of the global data.  On SMP this lives in
         * the per-cpu address space, otherwise it's in the data segment.
         */
-       .globl  gd_curthread, gd_npxthread, gd_astpending, gd_reqpri
-       .globl  gd_common_tss
+       .globl  gd_curthread, gd_npxthread, gd_reqflags, gd_common_tss
        .set    gd_curthread,globaldata + GD_CURTHREAD
-       .set    gd_astpending,globaldata + GD_ASTPENDING
-       .set    gd_reqpri,globaldata + GD_REQPRI
        .set    gd_npxthread,globaldata + GD_NPXTHREAD
+       .set    gd_reqflags,globaldata + GD_REQFLAGS
        .set    gd_common_tss,globaldata + GD_COMMON_TSS
 
        .globl  gd_common_tssd, gd_tss_gdt
index 9ada4e7..c952b13 100644 (file)
@@ -36,7 +36,7 @@
  *
  *     from: @(#)trap.c        7.4 (Berkeley) 5/13/91
  * $FreeBSD: src/sys/i386/i386/trap.c,v 1.147.2.11 2003/02/27 19:09:59 luoqi Exp $
- * $DragonFly: src/sys/platform/pc32/i386/trap.c,v 1.23 2003/07/11 23:26:15 dillon Exp $
+ * $DragonFly: src/sys/platform/pc32/i386/trap.c,v 1.24 2003/07/12 17:54:32 dillon Exp $
  */
 
 /*
@@ -431,10 +431,10 @@ restart:
                        break;
 
                case T_ASTFLT:          /* Allow process switch */
-                       astoff();
                        mycpu->gd_cnt.v_soft++;
-                       if (p->p_flag & P_OWEUPC) {
-                               p->p_flag &= ~P_OWEUPC;
+                       if (mycpu->gd_reqflags & RQF_AST_OWEUPC) {
+                               atomic_clear_int_nonlocked(&mycpu->gd_reqflags,
+                                           RQF_AST_OWEUPC);
                                addupc_task(p, p->p_stats->p_prof.pr_addr,
                                            p->p_stats->p_prof.pr_ticks);
                        }
index 88cc251..bef74d2 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *     from: vector.s, 386BSD 0.1 unknown origin
  * $FreeBSD: src/sys/i386/isa/icu_vector.s,v 1.14.2.2 2000/07/18 21:12:42 dfr Exp $
- * $DragonFly: src/sys/platform/pc32/icu/icu_vector.s,v 1.12 2003/07/08 06:27:27 dillon Exp $
+ * $DragonFly: src/sys/platform/pc32/icu/icu_vector.s,v 1.13 2003/07/12 17:54:35 dillon Exp $
  */
 
 /*
@@ -130,7 +130,7 @@ IDTVEC(vec_name) ;                                                  \
 1: ;                                                                   \
        /* set pending bit and return, leave interrupt masked */        \
        orl     $IRQ_LBIT(irq_num),PCPU(fpending) ;                     \
-       movl    $TDPRI_CRIT, PCPU(reqpri) ;                             \
+       orl     $RQF_INTPEND, PCPU(reqflags) ;                          \
        jmp     5f ;                                                    \
 2: ;                                                                   \
        /* clear pending bit, run handler */                            \
@@ -220,7 +220,7 @@ IDTVEC(vec_name) ;                                                  \
 1: ;                                                                   \
        /* set the pending bit and return, leave interrupt masked */    \
        orl     $IRQ_LBIT(irq_num), PCPU(ipending) ;                    \
-       movl    $TDPRI_CRIT, PCPU(reqpri) ;                             \
+       orl     $RQF_INTPEND, PCPU(reqflags) ;                          \
        jmp     5f ;                                                    \
 2: ;                                                                   \
        /* set running bit, clear pending bit, run handler */           \
index aaa4309..1a52e63 100644 (file)
@@ -28,7 +28,7 @@
  *     should not include this file.
  *
  * $FreeBSD: src/sys/i386/include/globaldata.h,v 1.11.2.1 2000/05/16 06:58:10 dillon Exp $
- * $DragonFly: src/sys/platform/pc32/include/globaldata.h,v 1.17 2003/07/10 04:47:53 dillon Exp $
+ * $DragonFly: src/sys/platform/pc32/include/globaldata.h,v 1.18 2003/07/12 17:54:34 dillon Exp $
  */
 
 #ifndef _MACHINE_GLOBALDATA_H_
@@ -67,6 +67,7 @@ struct mdglobaldata {
        struct i386tss  gd_common_tss;
        int             gd_fpending;    /* fast interrupt pending */
        int             gd_ipending;    /* normal interrupt pending */
+       int             gd_idelayed;    /* delayed software ints */
        int             gd_currentldt;  /* USER_LDT */
        int             gd_private_tss;
        u_int           gd_cpu_lockid;
index 53cd23c..5b39b64 100644 (file)
@@ -31,7 +31,7 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/i386/include/ipl.h,v 1.17.2.3 2002/12/17 18:04:02 sam Exp $
- * $DragonFly: src/sys/platform/pc32/include/ipl.h,v 1.4 2003/07/08 06:27:26 dillon Exp $
+ * $DragonFly: src/sys/platform/pc32/include/ipl.h,v 1.5 2003/07/12 17:54:34 dillon Exp $
  */
 
 #ifndef _MACHINE_IPL_H_
 #define        SWI_LOW_MASK    (SWI_TQ_PENDING | SWI_CLOCK_MASK)
 #define        SWI_MASK        (~HWI_MASK)
 
-/*
- * astpending bits
- */
-#define        AST_PENDING     0x00000001
-#define        AST_RESCHED     0x00000002
-#define        AST_IPIQ        0x00000004
-
 #ifndef        LOCORE
 
 /*
index f375444..79c041a 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *     from: vector.s, 386BSD 0.1 unknown origin
  * $FreeBSD: src/sys/i386/isa/apic_vector.s,v 1.47.2.5 2001/09/01 22:33:38 tegge Exp $
- * $DragonFly: src/sys/platform/pc32/isa/Attic/apic_vector.s,v 1.11 2003/07/12 16:55:50 dillon Exp $
+ * $DragonFly: src/sys/platform/pc32/isa/Attic/apic_vector.s,v 1.12 2003/07/12 17:54:35 dillon Exp $
  */
 
 
@@ -163,7 +163,7 @@ IDTVEC(vec_name) ;                                                  \
        /* in critical section, make interrupt pending */               \
        /* set the pending bit and return, leave interrupt masked */    \
        orl     $IRQ_LBIT(irq_num),PCPU(fpending) ;                     \
-       movl    $TDPRI_CRIT, PCPU(reqpri) ;                             \
+       orl     $RQF_INTPEND,PCPU(reqflags) ;                           \
        jmp     5f ;                                                    \
 2: ;                                                                   \
        /* try to get the MP lock */                                    \
@@ -273,7 +273,7 @@ IDTVEC(vec_name) ;                                                  \
 1: ;                                                                   \
        /* set the pending bit and return, leave the interrupt masked */ \
        orl     $IRQ_LBIT(irq_num), PCPU(ipending) ;                    \
-       movl    $TDPRI_CRIT, PCPU(reqpri) ;                             \
+       orl     $RQF_INTPEND,PCPU(reqflags) ;                           \
        jmp     5f ;                                                    \
 2: ;                                                                   \
        /* set running bit, clear pending bit, run handler */           \
@@ -490,8 +490,7 @@ Xipiq:
        MEXITCOUNT
        jmp     doreti
 1:
-       movl    $TDPRI_CRIT,PCPU(reqpri)
-       orl     $AST_IPIQ,PCPU(astpending)
+       orl     $RQF_IPIQ,PCPU(reqflags)
        MEXITCOUNT
        POP_FRAME
        iret
index 5c79f47..22364cc 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *     from: vector.s, 386BSD 0.1 unknown origin
  * $FreeBSD: src/sys/i386/isa/icu_vector.s,v 1.14.2.2 2000/07/18 21:12:42 dfr Exp $
- * $DragonFly: src/sys/platform/pc32/isa/Attic/icu_vector.s,v 1.12 2003/07/08 06:27:27 dillon Exp $
+ * $DragonFly: src/sys/platform/pc32/isa/Attic/icu_vector.s,v 1.13 2003/07/12 17:54:35 dillon Exp $
  */
 
 /*
@@ -130,7 +130,7 @@ IDTVEC(vec_name) ;                                                  \
 1: ;                                                                   \
        /* set pending bit and return, leave interrupt masked */        \
        orl     $IRQ_LBIT(irq_num),PCPU(fpending) ;                     \
-       movl    $TDPRI_CRIT, PCPU(reqpri) ;                             \
+       orl     $RQF_INTPEND, PCPU(reqflags) ;                          \
        jmp     5f ;                                                    \
 2: ;                                                                   \
        /* clear pending bit, run handler */                            \
@@ -220,7 +220,7 @@ IDTVEC(vec_name) ;                                                  \
 1: ;                                                                   \
        /* set the pending bit and return, leave interrupt masked */    \
        orl     $IRQ_LBIT(irq_num), PCPU(ipending) ;                    \
-       movl    $TDPRI_CRIT, PCPU(reqpri) ;                             \
+       orl     $RQF_INTPEND, PCPU(reqflags) ;                          \
        jmp     5f ;                                                    \
 2: ;                                                                   \
        /* set running bit, clear pending bit, run handler */           \
index e4604fb..f35bf8c 100644 (file)
@@ -35,7 +35,7 @@
  *
  *     from: @(#)isa.c 7.2 (Berkeley) 5/13/91
  * $FreeBSD: src/sys/i386/isa/intr_machdep.c,v 1.29.2.5 2001/10/14 06:54:27 luigi Exp $
- * $DragonFly: src/sys/platform/pc32/isa/intr_machdep.c,v 1.10 2003/07/12 16:55:50 dillon Exp $
+ * $DragonFly: src/sys/platform/pc32/isa/intr_machdep.c,v 1.11 2003/07/12 17:54:35 dillon Exp $
  */
 /*
  * This file contains an aggregated module marked:
@@ -985,7 +985,7 @@ forward_fastint_remote(void *arg)
     struct mdglobaldata *gd = mdcpu;
 
     atomic_set_int_nonlocked(&gd->gd_fpending, 1 << irq);
-    gd->mi.gd_reqpri = TDPRI_CRIT;
+    atomic_set_int_nonlocked(&gd->mi.gd_reqflags, RQF_INTPEND);
 }
 
 #endif
index 7f2515c..4f7b9d8 100644 (file)
@@ -37,7 +37,7 @@
  *     @(#)ipl.s
  *
  * $FreeBSD: src/sys/i386/isa/ipl.s,v 1.32.2.3 2002/05/16 16:03:56 bde Exp $
- * $DragonFly: src/sys/platform/pc32/isa/ipl.s,v 1.9 2003/07/11 22:30:07 dillon Exp $
+ * $DragonFly: src/sys/platform/pc32/isa/ipl.s,v 1.10 2003/07/12 17:54:35 dillon Exp $
  */
 
 
@@ -85,6 +85,8 @@ doreti:
        popl    %eax                    /* cpl to restore */
        movl    PCPU(curthread),%ebx
        cli                             /* interlock with TDPRI_CRIT */
+       cmpl    $0,PCPU(reqflags)       /* short cut if nothing to do */
+       je      5f
        movl    %eax,TD_CPL(%ebx)       /* save cpl being restored */
        cmpl    $TDPRI_CRIT,TD_PRI(%ebx) /* can't unpend if in critical sec */
        jge     5f
@@ -95,7 +97,7 @@ doreti_next:
        notl    %ecx
        cli                             /* disallow YYY remove */
 #ifdef SMP
-       testl   $AST_IPIQ,PCPU(astpending)
+       testl   $RQF_IPIQ,PCPU(reqflags)
        jnz     doreti_ipiq
 #endif
        testl   PCPU(fpending),%ecx     /* check for an unmasked fast int */
@@ -103,26 +105,27 @@ doreti_next:
 
        testl   PCPU(ipending),%ecx
        jnz     doreti_intr
-       testl   $AST_PENDING,PCPU(astpending) /* any pending ASTs? */
+
+       testl   $RQF_AST_MASK,PCPU(reqflags) /* any pending ASTs? */
        jz      2f
        testl   $PSL_VM,TF_EFLAGS(%esp)
        jz      1f
-       cmpl    $1,in_vm86call          /* YYY make per 'cpu' */
-       jnz     doreti_ast2
+       cmpl    $1,in_vm86call          /* YYY make per 'cpu'? */
+       jnz     doreti_ast
 1:
        testb   $SEL_RPL_MASK,TF_CS(%esp)
-       jnz     doreti_ast2
+       jnz     doreti_ast
 2:
        /*
         * Nothing left to do, finish up.  Interrupts are still disabled.
         * If our temporary cpl mask is 0 then we have processed everything
         * (including any pending fast ints requiring the MP lock), and
-        * we can clear reqpri.
+        * we can clear reqflags.
         */
        subl    $TDPRI_CRIT,TD_PRI(%ebx)        /* interlocked with cli */
        testl   %eax,%eax
        jnz     5f
-       movl    $0,PCPU(reqpri)
+       movl    $0,PCPU(reqflags)
 5:
        decl    PCPU(intr_nesting_level)
        MEXITCOUNT
@@ -212,29 +215,17 @@ doreti_intr:
        jmp     doreti_next
 
        /*
-        * AST pending
+        * AST pending.  We clear RQF_AST_SIGNAL automatically, the others
+        * are cleared by the trap as they are processed.
         *
         * Temporarily back-out our critical section because trap() can be
         * a long-winded call, and we want to be more syscall-like.  
         *
-        * YYY If we came in from user mode (doreti_ast1) we can call
-        * lwkt_switch *RIGHT* *NOW* to deal with interrupts more quickly,
-        * but should still fall through to the trap code to properly 
-        * reschedule.
+        * YYY theoretically we can call lwkt_switch directly if all we need
+        * to do is a reschedule.
         */
-#if 0
-doreti_ast1:
-       andl    $~AST_PENDING,PCPU(astpending)
-       sti
-       movl    %eax,%esi               /* save cpl (can't use stack) */
-       movl    $T_ASTFLT,TF_TRAPNO(%esp)
-       decl    PCPU(intr_nesting_level) /* syscall-like, not interrupt-like */
-       subl    $TDPRI_CRIT,TD_PRI(%ebx)
-       call    lwkt_switch
-       jmp     1f
-#endif
-doreti_ast2:
-       andl    $~AST_PENDING,PCPU(astpending)
+doreti_ast:
+       andl    $~RQF_AST_SIGNAL,PCPU(reqflags)
        sti
        movl    %eax,%esi               /* save cpl (can't use stack) */
        movl    $T_ASTFLT,TF_TRAPNO(%esp)
@@ -248,10 +239,10 @@ doreti_ast2:
 
 #ifdef SMP
        /*
-        * IPIQ message pending
+        * IPIQ message pending.  We clear RQF_IPIQ automatically.
         */
 doreti_ipiq:
-       andl    $~AST_IPIQ,PCPU(astpending)
+       andl    $~RQF_IPIQ,PCPU(reqflags)
        call    lwkt_process_ipiq
        movl    TD_CPL(%ebx),%eax       /* retrieve cpl again for loop */
        jmp     doreti_next
@@ -280,7 +271,7 @@ splz_next:
        movl    %eax,%ecx               /* ecx = ~CPL */
        notl    %ecx
 #ifdef SMP
-       testl   $AST_IPIQ,PCPU(astpending)
+       testl   $RQF_IPIQ,PCPU(reqflags)
        jnz     splz_ipiq
 #endif
        testl   PCPU(fpending),%ecx     /* check for an unmasked fast int */
@@ -290,15 +281,16 @@ splz_next:
        jnz     splz_intr
 
        subl    $TDPRI_CRIT,TD_PRI(%ebx)
+
        /*
         * Nothing left to do, finish up.  Interrupts are still disabled.
         * If our temporary cpl mask is 0 then we have processed everything
         * (including any pending fast ints requiring the MP lock), and
-        * we can clear reqpri.
+        * we can clear RQF_INTPEND.
         */
        testl   %eax,%eax
        jnz     5f
-       movl    $0,PCPU(reqpri)
+       andl    $~RQF_INTPEND,PCPU(reqflags)
 5:
        popl    %ebx
        popfl
@@ -357,7 +349,7 @@ splz_intr:
 
 #ifdef SMP
 splz_ipiq:
-       andl    $~AST_IPIQ,PCPU(astpending)
+       andl    $~RQF_IPIQ,PCPU(reqflags)
        pushl   %eax
        call    lwkt_process_ipiq
        popl    %eax
index 4e17cc9..50e027e 100644 (file)
@@ -24,7 +24,7 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/i386/isa/ipl_funcs.c,v 1.32.2.5 2002/12/17 18:04:02 sam Exp $
- * $DragonFly: src/sys/platform/pc32/isa/ipl_funcs.c,v 1.6 2003/06/29 03:28:43 dillon Exp $
+ * $DragonFly: src/sys/platform/pc32/isa/ipl_funcs.c,v 1.7 2003/07/12 17:54:35 dillon Exp $
  */
 
 #include <sys/param.h>
  *
  * Note: setbits uses a locked or, making simple cases MP safe.
  */
-#define DO_SETBITS(name, var, bits) \
-void name(void)                                        \
-{                                              \
-       atomic_set_int(var, bits);              \
-       mdcpu->mi.gd_reqpri = TDPRI_CRIT;       \
-}
-
-DO_SETBITS(setdelayed,   &mdcpu->gd_ipending, loadandclear(&idelayed))
-
-DO_SETBITS(setsoftcamnet,&mdcpu->gd_ipending, SWI_CAMNET_PENDING)
-DO_SETBITS(setsoftcambio,&mdcpu->gd_ipending, SWI_CAMBIO_PENDING)
-DO_SETBITS(setsoftclock, &mdcpu->gd_ipending, SWI_CLOCK_PENDING)
-DO_SETBITS(setsoftnet,   &mdcpu->gd_ipending, SWI_NET_PENDING)
-DO_SETBITS(setsofttty,   &mdcpu->gd_ipending, SWI_TTY_PENDING)
-DO_SETBITS(setsoftvm,   &mdcpu->gd_ipending, SWI_VM_PENDING)
-DO_SETBITS(setsofttq,   &mdcpu->gd_ipending, SWI_TQ_PENDING)
-DO_SETBITS(setsoftcrypto,&mdcpu->gd_ipending, SWI_CRYPTO_PENDING)
-
-DO_SETBITS(schedsoftcamnet, &idelayed, SWI_CAMNET_PENDING)
-DO_SETBITS(schedsoftcambio, &idelayed, SWI_CAMBIO_PENDING)
-DO_SETBITS(schedsoftnet, &idelayed, SWI_NET_PENDING)
-DO_SETBITS(schedsofttty, &idelayed, SWI_TTY_PENDING)
-DO_SETBITS(schedsoftvm,        &idelayed, SWI_VM_PENDING)
-DO_SETBITS(schedsofttq,        &idelayed, SWI_TQ_PENDING)
+#define DO_SETBITS(name, var, bits)                                    \
+void name(void)                                                                \
+{                                                                      \
+       struct mdglobaldata *gd = mdcpu;                                \
+       atomic_set_int_nonlocked(var, bits);                            \
+       atomic_set_int_nonlocked(&gd->mi.gd_reqflags, RQF_INTPEND);     \
+}                                                                      \
+
+DO_SETBITS(setdelayed,   &gd->gd_ipending, loadandclear(&gd->gd_idelayed))
+
+DO_SETBITS(setsoftcamnet,&gd->gd_ipending, SWI_CAMNET_PENDING)
+DO_SETBITS(setsoftcambio,&gd->gd_ipending, SWI_CAMBIO_PENDING)
+DO_SETBITS(setsoftclock, &gd->gd_ipending, SWI_CLOCK_PENDING)
+DO_SETBITS(setsoftnet,   &gd->gd_ipending, SWI_NET_PENDING)
+DO_SETBITS(setsofttty,   &gd->gd_ipending, SWI_TTY_PENDING)
+DO_SETBITS(setsoftvm,   &gd->gd_ipending, SWI_VM_PENDING)
+DO_SETBITS(setsofttq,   &gd->gd_ipending, SWI_TQ_PENDING)
+DO_SETBITS(setsoftcrypto,&gd->gd_ipending, SWI_CRYPTO_PENDING)
+
+DO_SETBITS(schedsoftcamnet, &gd->gd_idelayed, SWI_CAMNET_PENDING)
+DO_SETBITS(schedsoftcambio, &gd->gd_idelayed, SWI_CAMBIO_PENDING)
+DO_SETBITS(schedsoftnet, &gd->gd_idelayed, SWI_NET_PENDING)
+DO_SETBITS(schedsofttty, &gd->gd_idelayed, SWI_TTY_PENDING)
+DO_SETBITS(schedsoftvm,         &gd->gd_idelayed, SWI_VM_PENDING)
+DO_SETBITS(schedsofttq,         &gd->gd_idelayed, SWI_TQ_PENDING)
 /* YYY schedsoft what? */
 
 unsigned
index 9dfa1d0..7e7ffa8 100644 (file)
@@ -35,7 +35,7 @@
  *
  *     from: @(#)genassym.c    5.11 (Berkeley) 5/10/91
  * $FreeBSD: src/sys/i386/i386/genassym.c,v 1.86.2.3 2002/03/03 05:42:49 nyan Exp $
- * $DragonFly: src/sys/platform/vkernel/i386/genassym.c,v 1.25 2003/07/12 16:55:47 dillon Exp $
+ * $DragonFly: src/sys/platform/vkernel/i386/genassym.c,v 1.26 2003/07/12 17:54:32 dillon Exp $
  */
 
 #include "opt_user_ldt.h"
@@ -187,17 +187,23 @@ ASSYM(BI_ESYMTAB, offsetof(struct bootinfo, bi_esymtab));
 ASSYM(BI_KERNEND, offsetof(struct bootinfo, bi_kernend));
 
 ASSYM(GD_CURTHREAD, offsetof(struct mdglobaldata, mi.gd_curthread));
-ASSYM(GD_REQPRI, offsetof(struct mdglobaldata, mi.gd_reqpri));
 ASSYM(GD_CPUID, offsetof(struct mdglobaldata, mi.gd_cpuid));
 ASSYM(GD_CNT, offsetof(struct mdglobaldata, mi.gd_cnt));
 ASSYM(GD_PRIVATE_TSS, offsetof(struct mdglobaldata, gd_private_tss));
 ASSYM(GD_INTR_NESTING_LEVEL, offsetof(struct mdglobaldata, mi.gd_intr_nesting_level));
-ASSYM(GD_ASTPENDING, offsetof(struct mdglobaldata, mi.gd_astpending));
+ASSYM(GD_REQFLAGS, offsetof(struct mdglobaldata, mi.gd_reqflags));
 
 #ifdef USER_LDT
 ASSYM(GD_CURRENTLDT, offsetof(struct mdglobaldata, gd_currentldt));
 #endif
 
+ASSYM(RQF_IPIQ, RQF_IPIQ);
+ASSYM(RQF_INTPEND, RQF_INTPEND);
+ASSYM(RQF_AST_OWEUPC, RQF_AST_OWEUPC);
+ASSYM(RQF_AST_SIGNAL, RQF_AST_SIGNAL);
+ASSYM(RQF_AST_RESCHED, RQF_AST_RESCHED);
+ASSYM(RQF_AST_MASK, RQF_AST_MASK);
+
 ASSYM(GD_FPENDING, offsetof(struct mdglobaldata, gd_fpending));
 ASSYM(GD_IPENDING, offsetof(struct mdglobaldata, gd_ipending));
 ASSYM(GD_COMMON_TSS, offsetof(struct mdglobaldata, gd_common_tss));
index 050e53d..db14c56 100644 (file)
@@ -24,7 +24,7 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/i386/include/globaldata.h,v 1.11.2.1 2000/05/16 06:58:10 dillon Exp $
- * $DragonFly: src/sys/sys/globaldata.h,v 1.10 2003/07/11 23:26:18 dillon Exp $
+ * $DragonFly: src/sys/sys/globaldata.h,v 1.11 2003/07/12 17:54:36 dillon Exp $
  */
 
 #ifndef _SYS_GLOBALDATA_H_
@@ -55,7 +55,7 @@
  * NOTE! this structure needs to remain compatible between module accessors
  * and the kernel, so we can't throw in lots of #ifdef's.
  *
- * gd_reqpri serves serveral purposes, bu it is primarily an interrupt
+ * gd_reqflags serves serveral purposes, but it is primarily an interrupt
  * rollup flag used by the task switcher and spl mechanisms to decide that
  * further checks are necessary.  Interrupts are typically managed on a
  * per-processor basis at least until you leave a critical section, but
@@ -68,7 +68,7 @@ struct globaldata {
        struct privatespace *gd_prvspace;       /* self-reference */
        struct thread   *gd_curthread;
        int             gd_tdfreecount;         /* new thread cache */
-       int             gd_reqpri;              /* (see note above) */
+       u_int32_t       gd_reqflags;            /* (see note above) */
        TAILQ_HEAD(,thread) gd_tdallq;          /* all threads */
        TAILQ_HEAD(,thread) gd_tdfreeq;         /* new thread cache */
        TAILQ_HEAD(,thread) gd_tdrunq[32];      /* runnable threads */
@@ -77,7 +77,6 @@ struct globaldata {
        u_int           gd_other_cpus;          /* mask of 'other' cpus */
        struct timeval  gd_stattv;
        int             gd_intr_nesting_level;  /* (for fast interrupts) */
-       int             gd_astpending;          /* sorta MD but easier here */
        int             gd_psticks;             /* profile kern/kern_clock.c */
        int             gd_psdiv;               /* profile kern/kern_clock.c */
        struct vmmeter  gd_cnt;
@@ -87,6 +86,19 @@ struct globaldata {
        /* extended by <machine/pcpu.h> */
 };
 
+#define RQB_IPIQ       0
+#define RQB_INTPEND    1
+#define RQB_AST_OWEUPC 2
+#define RQB_AST_SIGNAL 3
+#define RQB_AST_RESCHED        4
+
+#define RQF_IPIQ       (1 << RQB_IPIQ)
+#define RQF_INTPEND    (1 << RQB_INTPEND)
+#define RQF_AST_OWEUPC (1 << RQB_AST_OWEUPC)
+#define RQF_AST_SIGNAL (1 << RQB_AST_SIGNAL)
+#define RQF_AST_RESCHED        (1 << RQB_AST_RESCHED)
+#define RQF_AST_MASK   (RQF_AST_OWEUPC|RQF_AST_SIGNAL|RQF_AST_RESCHED)
+
 #ifdef _KERNEL
 struct globaldata *globaldata_find(int cpu);
 #endif
index 94277a9..07001ce 100644 (file)
@@ -37,7 +37,7 @@
  *
  *     @(#)proc.h      8.15 (Berkeley) 5/19/95
  * $FreeBSD: src/sys/sys/proc.h,v 1.99.2.9 2003/06/06 20:21:32 tegge Exp $
- * $DragonFly: src/sys/sys/proc.h,v 1.25 2003/07/11 17:42:11 dillon Exp $
+ * $DragonFly: src/sys/sys/proc.h,v 1.26 2003/07/12 17:54:36 dillon Exp $
  */
 
 #ifndef _SYS_PROC_H_
@@ -265,8 +265,7 @@ struct      proc {
 /* was P_NOSWAP        0x08000 was: Do not swap upages; p->p_hold */
 /* was P_PHYSIO        0x10000 was: Doing physical I/O; use p->p_hold */
 
-/* Should be moved to machine-dependent areas. */
-#define        P_OWEUPC        0x20000 /* Owe process an addupc() call at next ast. */
+#define        P_UNUSED20000   0x20000
 
 #define        P_SWAPPING      0x40000 /* Process is being swapped. */
 #define        P_SWAPINREQ     0x80000 /* Swapin request due to wakeup */
index c3c5048..2573457 100644 (file)
@@ -4,7 +4,7 @@
  *     Implements the architecture independant portion of the LWKT 
  *     subsystem.
  * 
- * $DragonFly: src/sys/sys/thread.h,v 1.23 2003/07/11 17:42:11 dillon Exp $
+ * $DragonFly: src/sys/sys/thread.h,v 1.24 2003/07/12 17:54:36 dillon Exp $
  */
 
 #ifndef _SYS_THREAD_H_
@@ -213,9 +213,8 @@ struct thread {
  * Remember that there is one LWKT run queue per cpu.
  *
  * Critical sections are handled by bumping td_pri above TDPRI_MAX, which
- * causes interrupts to be masked as they occur.  When this occurs
- * mycpu->gd_reqpri will be raised (possibly just set to TDPRI_CRIT for
- * interrupt masking).
+ * causes interrupts to be masked as they occur.  When this occurs a
+ * rollup flag will be set in mycpu->gd_reqflags.
  */
 #define TDPRI_IDLE_THREAD      0       /* the idle thread */
 #define TDPRI_USER_IDLE                4       /* user scheduler idle */
index dc36ef8..baa330e 100644 (file)
@@ -8,7 +8,7 @@
  *     on a different cpu will not be immediately scheduled by a yield() on
  *     this cpu.
  *
- * $DragonFly: src/sys/sys/thread2.h,v 1.7 2003/07/08 09:57:13 dillon Exp $
+ * $DragonFly: src/sys/sys/thread2.h,v 1.8 2003/07/12 17:54:36 dillon Exp $
  */
 
 #ifndef _SYS_THREAD2_H_
@@ -19,7 +19,7 @@
  * above the highest possible interrupting priority.  Additionally, the
  * current cpu will not be able to schedule a new thread but will instead
  * place it on a pending list (with interrupts physically disabled) and
- * set mycpu->gd_reqpri to indicate that work needs to be done, which
+ * set mycpu->gd_reqflags to indicate that work needs to be done, which
  * lwkt_yield_quick() takes care of.
  *
  * Synchronous switching and blocking is allowed while in a critical section.
@@ -53,7 +53,7 @@ crit_exit(void)
     td->td_pri -= TDPRI_CRIT;
     if (td->td_pri < 0)
        crit_panic();
-    if (td->td_pri < mycpu->gd_reqpri)
+    if (td->td_pri < TDPRI_CRIT && mycpu->gd_reqflags)
        lwkt_yield_quick();
 }