Scheduler locking changes.

This commit is contained in:
tsubai 2000-08-21 18:46:03 +00:00
parent efb0ce0996
commit 365ec2aa42
6 changed files with 172 additions and 36 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: locore.S,v 1.4 2000/05/31 05:06:45 thorpej Exp $ */
/* $NetBSD: locore.S,v 1.5 2000/08/21 18:46:03 tsubai Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -40,6 +40,7 @@
#include "opt_ddb.h"
#include "opt_ipkdb.h"
#include "opt_lockdebug.h"
#include "assym.h"
#include <sys/syscall.h>
@ -264,20 +265,21 @@ _C_LABEL(adamintsize) = .-_C_LABEL(adamint)
/*
* No processes are runnable, so loop waiting for one.
* Separate label here for accounting purposes.
* When we get here, interrupts are off (MSR[EE]=0) and sched_lock is held.
*/
.text
ASENTRY(Idle)
mfmsr 3
andi. 3,3,~PSL_EE@l /* disable interrupts while
manipulating runque */
mtmsr 3
lis 8,_C_LABEL(sched_whichqs)@ha
lwz 9,_C_LABEL(sched_whichqs)@l(8)
or. 9,9,9
bne- .Lsw1 /* at least one queue non-empty */
#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
bl _C_LABEL(sched_unlock_idle)
#endif
mfmsr 3
ori 3,3,PSL_EE@l /* reenable ints again */
mtmsr 3
isync
@ -294,6 +296,13 @@ ASENTRY(Idle)
mtmsr 3
isync
1:
andi. 3,3,~PSL_EE@l /* disable interrupts while
manipulating runque */
mtmsr 3
#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
bl _C_LABEL(sched_lock_idle)
#endif
b _ASM_LABEL(Idle)
/*
@ -312,6 +321,10 @@ ENTRY(switchexit)
*/
bl _C_LABEL(exit2)
#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
bl _C_LABEL(sched_lock_idle)
#endif
/* Fall through to cpu_switch to actually select another proc */
li 3,0 /* indicate exited process */
@ -334,17 +347,26 @@ ENTRY(cpu_switch)
lis 3,_C_LABEL(curpcb)@ha
lwz 31,_C_LABEL(curpcb)@l(3)
#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
/* Release the sched_lock before processing interrupts. */
bl _C_LABEL(sched_unlock_idle)
#endif
xor 3,3,3
bl _C_LABEL(lcsplx)
stw 3,PCB_SPL(31) /* save spl */
/* Find a new process */
/* Lock the scheduler. */
mfmsr 3
andi. 3,3,~PSL_EE@l /* disable interrupts while
manipulating runque */
mtmsr 3
isync
#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
bl _C_LABEL(sched_lock_idle)
#endif
/* Find a new process */
lis 8,_C_LABEL(sched_whichqs)@ha
lwz 9,_C_LABEL(sched_whichqs)@l(8)
@ -378,6 +400,11 @@ ENTRY(cpu_switch)
stw 3,P_BACK(31) /* probably superfluous */
#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
/* Unlock the sched_lock, but leave interrupts off, for now. */
bl _C_LABEL(sched_unlock_idle)
#endif
/* p->p_cpu initialized in fork1() for single-processor */
li 3,SONPROC /* p->p_stat = SONPROC */

View File

@ -1,4 +1,4 @@
/* $NetBSD: locore.s,v 1.17 2000/05/31 05:09:14 thorpej Exp $ */
/* $NetBSD: locore.s,v 1.18 2000/08/21 18:46:03 tsubai Exp $ */
/* $OpenBSD: locore.S,v 1.4 1997/01/26 09:06:38 rahnds Exp $ */
/*
@ -35,6 +35,7 @@
#include "opt_ddb.h"
#include "fs_kernfs.h"
#include "opt_ipkdb.h"
#include "opt_lockdebug.h"
#include "opt_multiprocessor.h"
#include "assym.h"
@ -178,25 +179,33 @@ loop: b loop /* XXX not reached */
/*
* No processes are runnable, so loop waiting for one.
* Separate label here for accounting purposes.
* When we get here, interrupts are off (MSR[EE]=0) and sched_lock is held.
*/
ASENTRY(Idle)
mfmsr 3
andi. 3,3,~PSL_EE@l /* disable interrupts while
manipulating runque */
mtmsr 3
lis 8,_C_LABEL(sched_whichqs)@ha
lwz 9,_C_LABEL(sched_whichqs)@l(8)
or. 9,9,9
bne- .Lsw1 /* at least one queue non-empty */
#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
bl _C_LABEL(sched_unlock_idle)
#endif
mfmsr 3
ori 3,3,PSL_EE@l /* reenable ints again */
mtmsr 3
isync
/* May do some power saving here? */
andi. 3,3,~PSL_EE@l /* disable interrupts while
manipulating runque */
mtmsr 3
#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
bl _C_LABEL(sched_lock_idle)
#endif
b _ASM_LABEL(Idle)
/*
@ -215,6 +224,10 @@ ENTRY(switchexit)
*/
bl _C_LABEL(exit2)
#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
bl _C_LABEL(sched_lock_idle)
#endif
/* Fall through to cpu_switch to actually select another proc */
li 3,0 /* indicate exited process */
@ -237,17 +250,26 @@ ENTRY(cpu_switch)
lis 3,_C_LABEL(curpcb)@ha
lwz 31,_C_LABEL(curpcb)@l(3)
#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
/* Release the sched_lock before processing interrupts. */
bl _C_LABEL(sched_unlock_idle)
#endif
xor 3,3,3
bl _C_LABEL(lcsplx)
stw 3,PCB_SPL(31) /* save spl */
/* Find a new process */
/* Lock the scheduler. */
mfmsr 3
andi. 3,3,~PSL_EE@l /* disable interrupts while
manipulating runque */
mtmsr 3
isync
#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
bl _C_LABEL(sched_lock_idle)
#endif
/* Find a new process */
lis 8,_C_LABEL(sched_whichqs)@ha
lwz 9,_C_LABEL(sched_whichqs)@l(8)
@ -281,6 +303,11 @@ ENTRY(cpu_switch)
stw 3,P_BACK(31) /* probably superfluous */
#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
/* Unlock the sched_lock, but leave interrupts off, for now. */
bl _C_LABEL(sched_unlock_idle)
#endif
#if defined(MULTIPROCESSOR)
/*
* XXXSMP

View File

@ -1,4 +1,4 @@
/* $NetBSD: locore.S,v 1.26 2000/07/06 22:56:24 tsubai Exp $ */
/* $NetBSD: locore.S,v 1.27 2000/08/21 18:46:03 tsubai Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -33,6 +33,7 @@
#include "opt_ddb.h"
#include "opt_ipkdb.h"
#include "opt_lockdebug.h"
#include "opt_multiprocessor.h"
#include "assym.h"
@ -338,19 +339,20 @@ ofw_back:
/*
* No processes are runnable, so loop waiting for one.
* Separate label here for accounting purposes.
* When we get here, interrupts are off (MSR[EE]=0) and sched_lock is held.
*/
ASENTRY(Idle)
mfmsr 3
andi. 3,3,~PSL_EE@l /* disable interrupts while
manipulating runque */
mtmsr 3
lis 8,_C_LABEL(sched_whichqs)@ha
lwz 9,_C_LABEL(sched_whichqs)@l(8)
or. 9,9,9
bne- .Lsw1 /* at least one queue non-empty */
#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
bl _C_LABEL(sched_unlock_idle)
#endif
mfmsr 3
ori 3,3,PSL_EE@l /* reenable ints again */
mtmsr 3
isync
@ -367,6 +369,13 @@ ASENTRY(Idle)
mtmsr 3
isync
1:
andi. 3,3,~PSL_EE@l /* disable interrupts while
manipulating runque */
mtmsr 3
#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
bl _C_LABEL(sched_lock_idle)
#endif
b _ASM_LABEL(Idle)
/*
@ -391,6 +400,10 @@ ENTRY(switchexit)
*/
bl _C_LABEL(exit2)
#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
bl _C_LABEL(sched_lock_idle)
#endif
/* Fall through to cpu_switch to actually select another proc */
li 3,0 /* indicate exited process */
@ -420,17 +433,26 @@ ENTRY(cpu_switch)
lwz 31,_C_LABEL(curpcb)@l(3)
#endif
#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
/* Release the sched_lock before processing interrupts. */
bl _C_LABEL(sched_unlock_idle)
#endif
xor 3,3,3
bl _C_LABEL(lcsplx)
stw 3,PCB_SPL(31) /* save spl */
/* Find a new process */
/* Lock the scheduler. */
mfmsr 3
andi. 3,3,~PSL_EE@l /* disable interrupts while
manipulating runque */
mtmsr 3
isync
#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
bl _C_LABEL(sched_lock_idle)
#endif
/* Find a new process */
lis 8,_C_LABEL(sched_whichqs)@ha
lwz 9,_C_LABEL(sched_whichqs)@l(8)
@ -464,6 +486,11 @@ ENTRY(cpu_switch)
stw 3,P_BACK(31) /* probably superfluous */
#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
/* Unlock the sched_lock, but leave interrupts off, for now. */
bl _C_LABEL(sched_unlock_idle)
#endif
#if defined(MULTIPROCESSOR)
GET_CPUINFO(4)
stw 4,P_CPU(31) /* p->p_cpu = curcpu() */

View File

@ -1,4 +1,4 @@
/* $NetBSD: locore.S,v 1.18 2000/05/31 05:09:18 thorpej Exp $ */
/* $NetBSD: locore.S,v 1.19 2000/08/21 18:46:03 tsubai Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -33,6 +33,7 @@
#include "opt_ddb.h"
#include "opt_ipkdb.h"
#include "opt_lockdebug.h"
#include "opt_multiprocessor.h"
#include "assym.h"
@ -233,25 +234,33 @@ ofw_back:
/*
* No processes are runnable, so loop waiting for one.
* Separate label here for accounting purposes.
* When we get here, interrupts are off (MSR[EE]=0) and sched_lock is held.
*/
ASENTRY(Idle)
mfmsr 3
andi. 3,3,~PSL_EE@l /* disable interrupts while
manipulating runque */
mtmsr 3
lis 8,_C_LABEL(sched_whichqs)@ha
lwz 9,_C_LABEL(sched_whichqs)@l(8)
or. 9,9,9
bne- .Lsw1 /* at least one queue non-empty */
#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
bl _C_LABEL(sched_unlock_idle)
#endif
mfmsr 3
ori 3,3,PSL_EE@l /* reenable ints again */
mtmsr 3
isync
/* May do some power saving here? */
andi. 3,3,~PSL_EE@l /* disable interrupts while
manipulating runque */
mtmsr 3
#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
bl _C_LABEL(sched_lock_idle)
#endif
b _ASM_LABEL(Idle)
/*
@ -270,6 +279,10 @@ ENTRY(switchexit)
*/
bl _C_LABEL(exit2)
#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
bl _C_LABEL(sched_lock_idle)
#endif
/* Fall through to cpu_switch to actually select another proc */
li 3,0 /* indicate exited process */
@ -292,6 +305,11 @@ ENTRY(cpu_switch)
lis 3,_C_LABEL(curpcb)@ha
lwz 31,_C_LABEL(curpcb)@l(3)
#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
/* Release the sched_lock before processing interrupts. */
bl _C_LABEL(sched_unlock_idle)
#endif
xor 3,3,3
lis 4,_C_LABEL(machine_interface)+SPLX@ha
lwz 0,_C_LABEL(machine_interface)+SPLX@l(4)
@ -299,13 +317,17 @@ ENTRY(cpu_switch)
blrl
stw 3,PCB_SPL(31) /* save spl */
/* Find a new process */
/* Lock the scheduler. */
mfmsr 3
andi. 3,3,~PSL_EE@l /* disable interrupts while
manipulating runque */
mtmsr 3
isync
#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
bl _C_LABEL(sched_lock_idle)
#endif
/* Find a new process */
lis 8,_C_LABEL(sched_whichqs)@ha
lwz 9,_C_LABEL(sched_whichqs)@l(8)
@ -339,6 +361,11 @@ ENTRY(cpu_switch)
stw 3,P_BACK(31) /* probably superfluous */
#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
/* Unlock the sched_lock, but leave interrupts off, for now. */
bl _C_LABEL(sched_unlock_idle)
#endif
#ifdef MULTIPROCESSOR
/*
* XXXSMP

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.20 2000/06/29 07:48:18 mrg Exp $ */
/* $NetBSD: vm_machdep.c,v 1.21 2000/08/21 18:46:04 tsubai Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -180,6 +180,7 @@ cpu_exit(p)
if (p == fpuproc) /* release the fpu */
fpuproc = 0;
splsched();
switchexit(p);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: locore.s,v 1.6 2000/05/31 05:09:19 thorpej Exp $ */
/* $NetBSD: locore.s,v 1.7 2000/08/21 18:46:04 tsubai Exp $ */
/* $OpenBSD: locore.S,v 1.4 1997/01/26 09:06:38 rahnds Exp $ */
/*
@ -35,6 +35,7 @@
#include "opt_ddb.h"
#include "fs_kernfs.h"
#include "opt_ipkdb.h"
#include "opt_lockdebug.h"
#include "opt_multiprocessor.h"
#include "assym.h"
@ -185,25 +186,33 @@ loop:
/*
* No processes are runnable, so loop waiting for one.
* Separate label here for accounting purposes.
* When we get here, interrupts are off (MSR[EE]=0) and sched_lock is held.
*/
ASENTRY(Idle)
mfmsr 3
andi. 3,3,~PSL_EE@l /* disable interrupts while
manipulating runque */
mtmsr 3
lis 8,_C_LABEL(sched_whichqs)@ha
lwz 9,_C_LABEL(sched_whichqs)@l(8)
or. 9,9,9
bne- .Lsw1 /* at least one queue non-empty */
#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
bl _C_LABEL(sched_unlock_idle)
#endif
mfmsr 3
ori 3,3,PSL_EE@l /* reenable ints again */
mtmsr 3
isync
/* May do some power saving here? */
andi. 3,3,~PSL_EE@l /* disable interrupts while
manipulating runque */
mtmsr 3
#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
bl _C_LABEL(sched_lock_idle)
#endif
b _ASM_LABEL(Idle)
/*
@ -222,6 +231,10 @@ ENTRY(switchexit)
*/
bl _C_LABEL(exit2)
#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
bl _C_LABEL(sched_lock_idle)
#endif
/* Fall through to cpu_switch to actually select another proc */
li 3,0 /* indicate exited process */
@ -244,17 +257,26 @@ ENTRY(cpu_switch)
lis 3,_C_LABEL(curpcb)@ha
lwz 31,_C_LABEL(curpcb)@l(3)
#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
/* Release the sched_lock before processing interrupts. */
bl _C_LABEL(sched_unlock_idle)
#endif
xor 3,3,3
bl _C_LABEL(lcsplx)
stw 3,PCB_SPL(31) /* save spl */
/* Find a new process */
/* Lock the scheduler. */
mfmsr 3
andi. 3,3,~PSL_EE@l /* disable interrupts while
manipulating runque */
mtmsr 3
isync
#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
bl _C_LABEL(sched_lock_idle)
#endif
/* Find a new process */
lis 8,_C_LABEL(sched_whichqs)@ha
lwz 9,_C_LABEL(sched_whichqs)@l(8)
@ -288,6 +310,11 @@ ENTRY(cpu_switch)
stw 3,P_BACK(31) /* probably superfluous */
#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
/* Unlock the sched_lock, but leave interrupts off, for now. */
bl _C_LABEL(sched_unlock_idle)
#endif
#if defined(MULTIPROCESSOR)
/*
* XXXSMP