Source-Changes-HG archive

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

[src/trunk]: src/sys Introduce a new process state distinct from SRUN called ...



details:   https://anonhg.NetBSD.org/src/rev/98f6a21f1b1b
branches:  trunk
changeset: 486576:98f6a21f1b1b
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Fri May 26 00:36:42 2000 +0000

description:
Introduce a new process state distinct from SRUN called SONPROC
which indicates that the process is actually running on a
processor.  Test against SONPROC as appropriate rather than
combinations of SRUN and curproc.  Update all context switch code
to properly set SONPROC when the process becomes the current
process on the CPU.

diffstat:

 sys/arch/alpha/alpha/genassym.c        |   8 ++++++--
 sys/arch/alpha/alpha/locore.s          |  19 ++++++++++++++++---
 sys/arch/amiga/amiga/genassym.cf       |   3 ++-
 sys/arch/amiga/amiga/locore.s          |  15 ++++++++-------
 sys/arch/amigappc/amigappc/genassym.cf |   5 ++++-
 sys/arch/amigappc/amigappc/locore.S    |   5 ++++-
 sys/arch/arm26/arm26/Locore.c          |   5 +++--
 sys/arch/arm32/arm32/cpuswitch.S       |   6 +++++-
 sys/arch/arm32/arm32/genassym.cf       |   4 +++-
 sys/arch/atari/atari/genassym.cf       |   3 ++-
 sys/arch/atari/atari/locore.s          |  15 ++++++++-------
 sys/arch/bebox/bebox/genassym.cf       |   5 ++++-
 sys/arch/bebox/bebox/locore.s          |   6 +++++-
 sys/arch/evbsh3/evbsh3/genassym.cf     |   3 ++-
 sys/arch/evbsh3/evbsh3/locore.s        |  14 +++++++++++++-
 sys/arch/hp300/hp300/genassym.cf       |   3 ++-
 sys/arch/hp300/hp300/locore.s          |  15 ++++++++-------
 sys/arch/i386/i386/genassym.cf         |   3 ++-
 sys/arch/i386/i386/locore.s            |   3 ++-
 sys/arch/luna68k/luna68k/genassym.cf   |   3 ++-
 sys/arch/luna68k/luna68k/locore.s      |  15 ++++++++-------
 sys/arch/mac68k/mac68k/genassym.cf     |   3 ++-
 sys/arch/mac68k/mac68k/locore.s        |  15 ++++++++-------
 sys/arch/macppc/macppc/genassym.cf     |   5 ++++-
 sys/arch/macppc/macppc/locore.S        |   6 +++++-
 sys/arch/mips/mips/genassym.cf         |   5 ++++-
 sys/arch/mips/mips/locore.S            |   4 +++-
 sys/arch/mmeye/mmeye/genassym.cf       |   3 ++-
 sys/arch/mmeye/mmeye/locore.s          |  14 +++++++++++++-
 sys/arch/mvme68k/mvme68k/genassym.cf   |   3 ++-
 sys/arch/mvme68k/mvme68k/locore.s      |  15 ++++++++-------
 sys/arch/news68k/news68k/genassym.cf   |   3 ++-
 sys/arch/news68k/news68k/locore.s      |  15 ++++++++-------
 sys/arch/next68k/next68k/genassym.cf   |   3 ++-
 sys/arch/next68k/next68k/locore.s      |  15 ++++++++-------
 sys/arch/ofppc/ofppc/genassym.cf       |   5 ++++-
 sys/arch/ofppc/ofppc/locore.S          |   6 +++++-
 sys/arch/pc532/pc532/genassym.cf       |   3 ++-
 sys/arch/pc532/pc532/locore.s          |   3 ++-
 sys/arch/prep/prep/genassym.cf         |   5 ++++-
 sys/arch/prep/prep/locore.s            |   6 +++++-
 sys/arch/sparc/sparc/genassym.cf       |   3 ++-
 sys/arch/sparc/sparc/locore.s          |   5 ++++-
 sys/arch/sparc64/sparc64/genassym.cf   |   3 ++-
 sys/arch/sparc64/sparc64/locore.s      |   4 +++-
 sys/arch/sun3/sun3/genassym.c          |   3 ++-
 sys/arch/sun3/sun3/locore.s            |  15 ++++++++-------
 sys/arch/sun3/sun3x/genassym.c         |   3 ++-
 sys/arch/sun3/sun3x/locore.s           |  15 ++++++++-------
 sys/arch/vax/vax/genassym.cf           |   5 ++++-
 sys/arch/vax/vax/subr.s                |   3 ++-
 sys/arch/x68k/x68k/genassym.cf         |   3 ++-
 sys/arch/x68k/x68k/locore.s            |  15 ++++++++-------
 sys/kern/init_main.c                   |   4 ++--
 sys/kern/kern_resource.c               |   4 ++--
 sys/kern/kern_sig.c                    |  14 +++++++++-----
 sys/kern/kern_synch.c                  |  22 ++++++++++++----------
 sys/kern/tty.c                         |   8 +++++---
 sys/sys/proc.h                         |  12 ++++++++++--
 sys/uvm/uvm_glue.c                     |   3 ++-
 sys/uvm/uvm_meter.c                    |   4 +++-
 61 files changed, 294 insertions(+), 149 deletions(-)

diffs (truncated from 1541 to 300 lines):

diff -r 83c56c54222c -r 98f6a21f1b1b sys/arch/alpha/alpha/genassym.c
--- a/sys/arch/alpha/alpha/genassym.c   Fri May 26 00:22:06 2000 +0000
+++ b/sys/arch/alpha/alpha/genassym.c   Fri May 26 00:36:42 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: genassym.c,v 1.26 1999/12/16 20:20:11 thorpej Exp $ */
+/* $NetBSD: genassym.c,v 1.27 2000/05/26 00:36:42 thorpej Exp $ */
 
 /*
  * Copyright (c) 1994, 1995 Gordon W. Ross
@@ -62,7 +62,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__RCSID("$NetBSD: genassym.c,v 1.26 1999/12/16 20:20:11 thorpej Exp $");
+__RCSID("$NetBSD: genassym.c,v 1.27 2000/05/26 00:36:42 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/buf.h>
@@ -172,11 +172,15 @@
        off(P_BACK, struct proc, p_back),
        off(P_ADDR, struct proc, p_addr),
        off(P_VMSPACE, struct proc, p_vmspace),
+       off(P_STAT, struct proc, p_stat),
        off(P_MD_FLAGS, struct proc, p_md.md_flags),
        off(P_MD_PCBPADDR, struct proc, p_md.md_pcbpaddr),
        off(PH_LINK, struct prochd, ph_link),
        off(PH_RLINK, struct prochd, ph_rlink),
 
+       /* Process status constants */
+       def1(SONPROC),
+
        /* offsets needed by cpu_switch() to switch mappings. */
        off(VM_MAP_PMAP, struct vmspace, vm_map.pmap), 
 
diff -r 83c56c54222c -r 98f6a21f1b1b sys/arch/alpha/alpha/locore.s
--- a/sys/arch/alpha/alpha/locore.s     Fri May 26 00:22:06 2000 +0000
+++ b/sys/arch/alpha/alpha/locore.s     Fri May 26 00:36:42 2000 +0000
@@ -1,7 +1,7 @@
-/* $NetBSD: locore.s,v 1.72 1999/12/16 20:20:11 thorpej Exp $ */
+/* $NetBSD: locore.s,v 1.73 2000/05/26 00:36:42 thorpej Exp $ */
 
 /*-
- * Copyright (c) 1999 The NetBSD Foundation, Inc.
+ * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -76,7 +76,7 @@
 
 #include <machine/asm.h>
 
-__KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.72 1999/12/16 20:20:11 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.73 2000/05/26 00:36:42 thorpej Exp $");
 
 #ifndef EVCNT_COUNTERS
 #include <machine/intrcnt.h>
@@ -916,6 +916,19 @@
         *
         * Note: GET_CURPROC() clobbers v0, t0, t8...t11.
         */
+#ifdef __alpha_bwx__
+       ldiq    t0, SONPROC                     /* p->p_stat = SONPROC */
+       stb     t0, P_STAT(s2)
+#else
+       addq    s2, P_STAT, t3                  /* p->p_stat = SONPROC */
+       ldq_u   t1, 0(t3)
+       ldiq    t0, SONPROC
+       insbl   t0, t3, t0
+       mskbl   t1, t3, t1
+       or      t0, t1, t0
+       stq_u   t0, 0(t3)
+#endif /* __alpha_bwx__ */
+
        GET_CURPROC(t1)
        stq     s2, 0(t1)                       /* curproc = p */
        stq     zero, want_resched              /* we've rescheduled */
diff -r 83c56c54222c -r 98f6a21f1b1b sys/arch/amiga/amiga/genassym.cf
--- a/sys/arch/amiga/amiga/genassym.cf  Fri May 26 00:22:06 2000 +0000
+++ b/sys/arch/amiga/amiga/genassym.cf  Fri May 26 00:36:42 2000 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: genassym.cf,v 1.11 1999/04/19 21:22:56 kleink Exp $
+#      $NetBSD: genassym.cf,v 1.12 2000/05/26 00:36:43 thorpej Exp $
 
 #
 # Copyright (c) 1982, 1990, 1993
@@ -110,6 +110,7 @@
 define P_PID           offsetof(struct proc, p_pid)
 define MD_REGS         offsetof(struct mdproc, md_regs)
 define SRUN            SRUN
+define SONPROC         SONPROC
 
 # interrupt/fault metering
 define UVMEXP_INTRS    offsetof(struct uvmexp, intrs)
diff -r 83c56c54222c -r 98f6a21f1b1b sys/arch/amiga/amiga/locore.s
--- a/sys/arch/amiga/amiga/locore.s     Fri May 26 00:22:06 2000 +0000
+++ b/sys/arch/amiga/amiga/locore.s     Fri May 26 00:36:42 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore.s,v 1.113 2000/05/14 14:13:50 minoura Exp $     */
+/*     $NetBSD: locore.s,v 1.114 2000/05/26 00:36:43 thorpej Exp $     */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -1209,6 +1209,12 @@
        cmpl    a1@(P_FORW),a1          | anyone on queue?
        jeq     Lbadsw                  | no, panic
        movl    a1@(P_FORW),a0                  | p = q->p_forw
+#ifdef DIAGNOSTIC
+       tstl    a0@(P_WCHAN)
+       jne     Lbadsw
+       cmpb    #SRUN,a0@(P_STAT)
+       jne     Lbadsw
+#endif
        movl    a0@(P_FORW),a1@(P_FORW)         | q->p_forw = p->p_forw
        movl    a0@(P_FORW),a1                  | q = p->p_forw
        movl    a0@(P_BACK),a1@(P_BACK) | q->p_back = p->p_back
@@ -1218,6 +1224,7 @@
        bset    d0,d1                   | yes, reset bit
        movl    d1,_whichqs
 Lsw2:
+       movb    #SONPROC,a0@(P_STAT)            | p->p_stat = SONPROC
        movl    a0,_curproc
        clrl    _want_resched
 #ifdef notyet
@@ -1265,12 +1272,6 @@
 Lswnofpsave:
 #endif
 
-#ifdef DIAGNOSTIC
-       tstl    a0@(P_WCHAN)
-       jne     Lbadsw
-       cmpb    #SRUN,a0@(P_STAT)
-       jne     Lbadsw
-#endif
        clrl    a0@(P_BACK)                     | clear back link
        movl    a0@(P_ADDR),a1                  | get p_addr
        movl    a1,_curpcb
diff -r 83c56c54222c -r 98f6a21f1b1b sys/arch/amigappc/amigappc/genassym.cf
--- a/sys/arch/amigappc/amigappc/genassym.cf    Fri May 26 00:22:06 2000 +0000
+++ b/sys/arch/amigappc/amigappc/genassym.cf    Fri May 26 00:36:42 2000 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: genassym.cf,v 1.1 2000/05/25 22:11:57 is Exp $
+#      $NetBSD: genassym.cf,v 1.2 2000/05/26 00:36:43 thorpej Exp $
 
 #
 # Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -68,3 +68,6 @@
 define P_FORW          offsetof(struct proc, p_forw)
 define P_BACK          offsetof(struct proc, p_back)
 define P_ADDR          offsetof(struct proc, p_addr)
+define P_STAT          offsetof(struct proc, p_stat)
+
+define SONPROC         SONPROC
diff -r 83c56c54222c -r 98f6a21f1b1b sys/arch/amigappc/amigappc/locore.S
--- a/sys/arch/amigappc/amigappc/locore.S       Fri May 26 00:22:06 2000 +0000
+++ b/sys/arch/amigappc/amigappc/locore.S       Fri May 26 00:36:42 2000 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: locore.S,v 1.1 2000/05/25 22:11:57 is Exp $   */
+/*      $NetBSD: locore.S,v 1.2 2000/05/26 00:36:43 thorpej Exp $   */
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -378,6 +378,9 @@
 
        stw     3,P_BACK(31)            /* probably superfluous */
 
+       li      3,SONPROC               /* p->p_stat = SONPROC */
+       stb     3,P_STAT(31)
+
        /* record new process */
        lis     4,_C_LABEL(curproc)@ha
        stw     31,_C_LABEL(curproc)@l(4)
diff -r 83c56c54222c -r 98f6a21f1b1b sys/arch/arm26/arm26/Locore.c
--- a/sys/arch/arm26/arm26/Locore.c     Fri May 26 00:22:06 2000 +0000
+++ b/sys/arch/arm26/arm26/Locore.c     Fri May 26 00:36:42 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: Locore.c,v 1.1 2000/05/09 21:55:55 bjh21 Exp $ */
+/*     $NetBSD: Locore.c,v 1.2 2000/05/26 00:36:44 thorpej Exp $       */
 
 /*
  * Copyright (c) 2000 Ben Harris.
@@ -39,7 +39,7 @@
 
 #include <sys/param.h>
 
-__RCSID("$NetBSD: Locore.c,v 1.1 2000/05/09 21:55:55 bjh21 Exp $");
+__RCSID("$NetBSD: Locore.c,v 1.2 2000/05/26 00:36:44 thorpej Exp $");
 
 #include <sys/proc.h>
 #include <sys/systm.h>
@@ -137,6 +137,7 @@
        p2 = q->ph_link;
        remrunqueue(p2);
        want_resched = 0;
+       p2->p_stat = SONPROC;
        curproc = p2;
 #if 0
        printf(" %p\n", p2);
diff -r 83c56c54222c -r 98f6a21f1b1b sys/arch/arm32/arm32/cpuswitch.S
--- a/sys/arch/arm32/arm32/cpuswitch.S  Fri May 26 00:22:06 2000 +0000
+++ b/sys/arch/arm32/arm32/cpuswitch.S  Fri May 26 00:36:42 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpuswitch.S,v 1.31 1999/10/26 06:53:41 cgd Exp $       */
+/*     $NetBSD: cpuswitch.S,v 1.32 2000/05/26 00:36:44 thorpej Exp $   */
 
 /*
  * Copyright (c) 1994-1998 Mark Brinicombe.
@@ -429,6 +429,10 @@
        mov     r0, #0x00000000
        str     r0, [r6, #(P_BACK)]
 
+       /* Process is now on a processor. */
+       mov     r0, #SONPROC                    /* p->p_stat = SONPROC */
+       strb    r0, [r6, #(P_STAT)]
+
        /* We have a new curproc now so make a note it */
        ldr     r7, Lcurproc
        str     r6, [r7]
diff -r 83c56c54222c -r 98f6a21f1b1b sys/arch/arm32/arm32/genassym.cf
--- a/sys/arch/arm32/arm32/genassym.cf  Fri May 26 00:22:06 2000 +0000
+++ b/sys/arch/arm32/arm32/genassym.cf  Fri May 26 00:36:42 2000 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: genassym.cf,v 1.3 1999/03/24 11:35:30 tron Exp $
+#      $NetBSD: genassym.cf,v 1.4 2000/05/26 00:36:44 thorpej Exp $
 
 # Copyright (c) 1982, 1990 The Regents of the University of California.
 # All rights reserved.
@@ -75,6 +75,8 @@
 define P_USRPRI                offsetof(struct proc, p_usrpri)
 define P_SPARE                 offsetof(struct proc, p_md.__spare)
 
+define SONPROC                 SONPROC
+
 define PCB_PAGEDIR             offsetof(struct pcb, pcb_pagedir)
 define PCB_FLAGS               offsetof(struct pcb, pcb_flags)
 define PCB_R0                  offsetof(struct pcb, pcb_r0)
diff -r 83c56c54222c -r 98f6a21f1b1b sys/arch/atari/atari/genassym.cf
--- a/sys/arch/atari/atari/genassym.cf  Fri May 26 00:22:06 2000 +0000
+++ b/sys/arch/atari/atari/genassym.cf  Fri May 26 00:36:42 2000 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: genassym.cf,v 1.13 1999/10/26 00:20:34 itohy Exp $
+#      $NetBSD: genassym.cf,v 1.14 2000/05/26 00:36:44 thorpej Exp $
 
 #-
 # Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -91,6 +91,7 @@
 define P_PID                   offsetof(struct proc, p_pid)
 define MD_REGS                 offsetof(struct mdproc, md_regs)
 define SRUN                    SRUN
+define SONPROC                 SONPROC
 
 # interrupt/fault metering
 define UVMEXP_INTRS            offsetof(struct uvmexp, intrs)
diff -r 83c56c54222c -r 98f6a21f1b1b sys/arch/atari/atari/locore.s
--- a/sys/arch/atari/atari/locore.s     Fri May 26 00:22:06 2000 +0000
+++ b/sys/arch/atari/atari/locore.s     Fri May 26 00:36:42 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore.s,v 1.65 2000/05/14 14:13:51 minoura Exp $      */
+/*     $NetBSD: locore.s,v 1.66 2000/05/26 00:36:44 thorpej Exp $      */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -1157,6 +1157,12 @@
        cmpl    a1@(P_FORW),a1          | anyone on queue?
        jeq             Lbadsw          | no, panic
        movl    a1@(P_FORW),a0          | p = q->p_forw
+#ifdef DIAGNOSTIC
+       tstl    a0@(P_WCHAN)
+       jne     Lbadsw
+       cmpb    #SRUN,a0@(P_STAT)
+       jne     Lbadsw
+#endif
        movl    a0@(P_FORW),a1@(P_FORW) | q->p_forw = p->p_forw
        movl    a0@(P_FORW),a1          | q = p->p_forw
        movl    a0@(P_BACK),a1@(P_BACK) | q->p_back = p->p_back
@@ -1166,6 +1172,7 @@
        bset    d0,d1                   | yes, reset bit
        movl    d1,_whichqs
 Lsw2:
+       movb    #SONPROC,a0@(P_STAT)    | p->p_stat = SONPROC
        movl    a0,_curproc
        clrl    _want_resched
 #ifdef notyet
@@ -1206,12 +1213,6 @@
 #endif
 Lswnofpsave:
 
-#ifdef DIAGNOSTIC
-       tstl    a0@(P_WCHAN)
-       jne     Lbadsw
-       cmpb    #SRUN,a0@(P_STAT)
-       jne     Lbadsw
-#endif
        clrl    a0@(P_BACK)             | clear back link
        movl    a0@(P_ADDR),a1          | get p_addr
        movl    a1,_curpcb
diff -r 83c56c54222c -r 98f6a21f1b1b sys/arch/bebox/bebox/genassym.cf
--- a/sys/arch/bebox/bebox/genassym.cf  Fri May 26 00:22:06 2000 +0000
+++ b/sys/arch/bebox/bebox/genassym.cf  Fri May 26 00:36:42 2000 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: genassym.cf,v 1.2 1998/02/02 05:17:40 sakamoto Exp $



Home | Main Index | Thread Index | Old Index