Subject: README: scheduler locking changes
To: None <current-users@netbsd.org>
From: Jason R Thorpe <thorpej@zembu.com>
List: current-users
Date: 08/20/2000 15:12:43
As part of the merge of MULTIPROCESSOR support, I have committed
the new scheduler locking protocol to -current.  The new protocol is:

	* mi_switch() must be called at splhigh() and with the
	  sched_lock held.

	* mi_switch() calls cpu_switch() at splhigh() and with
	  the sched_lock held.

	* cpu_switch() *MUST* release the sched_lock before
	  returning to mi_switch().

	* If cpu_switch() lowers interrupt priority, it *MUST*
	  first release the sched_lock.

	* In order to reacquire the sched_lock in cpu_switch(),
	  cpu_switch() *MUST* block interrupts (as it would already).

	* All platforms *MUST* manipulate the sched_lock in
	  machine dependent code as appropriate in the MULTIPROCESSOR
	  or LOCKDEBUG cases.

See the changes made to the Alpha and i386 ports for simple examples.

PORT MASTERS: If I changed your port (m68k, mips, arm26, in particular)
please make sure the changes look sane.  Note, I had to change several
m68k ports Idle/cpu_switch implementations to look like the newer hp300
version.

IF YOU HAVE PROBLEMS, please report them w/ send-pr AS SOON AS POSSIBLE.
Please include any relevant diagnostic information provided by the kernel,
as well as a traceback, if possible.

I have tested this directly on the alpha and i386.

Here is the relevant commit message.

Shar and enjoy.

----- Forwarded message from Jason R Thorpe <thorpej@netbsd.org> -----

To: source-changes@netbsd.org
Date: Mon, 21 Aug 2000 00:50:12 +0300 (EEST)
From: Jason R Thorpe <thorpej@netbsd.org>
Subject: CVS commit: syssrc


Module Name:	syssrc
Committed By:	thorpej
Date:		Sun Aug 20 21:50:12 UTC 2000

Modified Files:
	syssrc/sys/arch/alpha/alpha: locore.s
	syssrc/sys/arch/amiga/amiga: locore.s
	syssrc/sys/arch/arm26/arm26: Locore.c vm_machdep.c
	syssrc/sys/arch/atari/atari: locore.s
	syssrc/sys/arch/hp300/hp300: locore.s
	syssrc/sys/arch/hpcmips/vr: vr_idle.S
	syssrc/sys/arch/i386/i386: locore.s
	syssrc/sys/arch/luna68k/luna68k: locore.s
	syssrc/sys/arch/mac68k/mac68k: locore.s
	syssrc/sys/arch/mips/mips: locore.S
	syssrc/sys/arch/mvme68k/mvme68k: locore.s
	syssrc/sys/arch/news68k/news68k: locore.s
	syssrc/sys/arch/next68k/next68k: locore.s
	syssrc/sys/arch/sun3/sun3: locore.s
	syssrc/sys/arch/sun3/sun3x: locore.s
	syssrc/sys/arch/x68k/x68k: locore.s
	syssrc/sys/kern: kern_resource.c kern_sig.c kern_synch.c sys_generic.c
	    sys_process.c
	syssrc/sys/miscfs/procfs: procfs_ctl.c
	syssrc/sys/miscfs/syncfs: sync_subr.c
	syssrc/sys/sys: sched.h signalvar.h

Log Message:
Add a lock around the scheduler, and use it as necessary, including
in the non-MULTIPROCESSOR case (LOCKDEBUG requires it).  Scheduler
lock is held upon entry to mi_switch() and cpu_switch(), and
cpu_switch() releases the lock before returning.

Largely from Bill Sommerfeld, with some minor bug fixes and
machine-dependent code hacking from me.


To generate a diff of this commit:
cvs rdiff -r1.78 -r1.79 syssrc/sys/arch/alpha/alpha/locore.s
cvs rdiff -r1.116 -r1.117 syssrc/sys/arch/amiga/amiga/locore.s
cvs rdiff -r1.5 -r1.6 syssrc/sys/arch/arm26/arm26/Locore.c
cvs rdiff -r1.4 -r1.5 syssrc/sys/arch/arm26/arm26/vm_machdep.c
cvs rdiff -r1.70 -r1.71 syssrc/sys/arch/atari/atari/locore.s
cvs rdiff -r1.109 -r1.110 syssrc/sys/arch/hp300/hp300/locore.s
cvs rdiff -r1.5 -r1.6 syssrc/sys/arch/hpcmips/vr/vr_idle.S
cvs rdiff -r1.223 -r1.224 syssrc/sys/arch/i386/i386/locore.s
cvs rdiff -r1.8 -r1.9 syssrc/sys/arch/luna68k/luna68k/locore.s
cvs rdiff -r1.129 -r1.130 syssrc/sys/arch/mac68k/mac68k/locore.s
cvs rdiff -r1.112 -r1.113 syssrc/sys/arch/mips/mips/locore.S
cvs rdiff -r1.62 -r1.63 syssrc/sys/arch/mvme68k/mvme68k/locore.s
cvs rdiff -r1.8 -r1.9 syssrc/sys/arch/news68k/news68k/locore.s
cvs rdiff -r1.25 -r1.26 syssrc/sys/arch/next68k/next68k/locore.s
cvs rdiff -r1.74 -r1.75 syssrc/sys/arch/sun3/sun3/locore.s
cvs rdiff -r1.41 -r1.42 syssrc/sys/arch/sun3/sun3x/locore.s
cvs rdiff -r1.59 -r1.60 syssrc/sys/arch/x68k/x68k/locore.s
cvs rdiff -r1.58 -r1.59 syssrc/sys/kern/kern_resource.c
cvs rdiff -r1.103 -r1.104 syssrc/sys/kern/kern_sig.c
cvs rdiff -r1.82 -r1.83 syssrc/sys/kern/kern_synch.c
cvs rdiff -r1.50 -r1.51 syssrc/sys/kern/sys_generic.c
cvs rdiff -r1.63 -r1.64 syssrc/sys/kern/sys_process.c
cvs rdiff -r1.17 -r1.18 syssrc/sys/miscfs/procfs/procfs_ctl.c
cvs rdiff -r1.4 -r1.5 syssrc/sys/miscfs/syncfs/sync_subr.c
cvs rdiff -r1.5 -r1.6 syssrc/sys/sys/sched.h
cvs rdiff -r1.23 -r1.24 syssrc/sys/sys/signalvar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



----- End forwarded message -----

-- 
        -- Jason R. Thorpe <thorpej@zembu.com>